feat: update discover medias

This commit is contained in:
Rogee
2024-12-06 14:13:04 +08:00
parent d42911eff8
commit 2b551f1b69
7 changed files with 115 additions and 123 deletions

View File

@@ -9,12 +9,12 @@ import (
log "github.com/sirupsen/logrus"
)
type Store []UUIDMap
type Store []VideoInfo
type UUIDMap struct {
UUID string
Name string
Price uint
type VideoInfo struct {
Hash string
Name string
Duration uint
}
func NewStore(path string) (Store, error) {
@@ -56,17 +56,17 @@ func (s Store) Save(path string) error {
return nil
}
func (s Store) Add(uuid, name string, price uint) {
s = append(s, UUIDMap{UUID: uuid, Name: name, Price: price})
func (s Store) Append(info VideoInfo) Store {
return append(s, info)
}
func (s Store) UUIDs() []string {
var uuids []string
func (s Store) Hashes() []string {
var hashes []string
for _, m := range s {
uuids = append(uuids, m.UUID)
hashes = append(hashes, m.Hash)
}
return uuids
return hashes
}
// Exists