Maintenant capter les URL des documents didl parser et les stocker dans le cache...
This commit is contained in:
26
pmodidl/parser.go
Normal file
26
pmodidl/parser.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package pmodidl
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
|
||||
"gargoton.petite-maison-orange.fr/eric/pmomusic/pmocover"
|
||||
)
|
||||
|
||||
func Parse(metadata string) (*DIDLLite, error) {
|
||||
var didl DIDLLite
|
||||
err := xml.Unmarshal([]byte(metadata), &didl)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse DIDL-Lite: %v", err)
|
||||
|
||||
}
|
||||
|
||||
cache, err := pmocover.GetCoverCache()
|
||||
if err != nil {
|
||||
return &didl, fmt.Errorf("failed to get cover cache: %v", err)
|
||||
}
|
||||
|
||||
didl.CacheAllCoverArts(cache)
|
||||
|
||||
return &didl, nil
|
||||
}
|
||||
Reference in New Issue
Block a user