add playlists and profiles init/pull/push

This commit is contained in:
Simon Vieille 2024-08-29 00:47:17 +02:00
commit fe5eb2db34
15 changed files with 305 additions and 114 deletions

View file

@ -17,11 +17,15 @@ func LoadPlaylists() []model.Playlist {
var item model.Playlist
json.Unmarshal([]byte(lines[i]), &item)
if !added[item.Id] {
added[item.Id] = true
if !added[item.RemoteId] {
added[item.RemoteId] = true
collection = append(collection, item)
}
}
return collection
}
func UpdatePlaylists(data []string) {
file.WriteDatabase(config.GetConfig().DbPath("playlists"), data)
}

View file

@ -17,11 +17,15 @@ func LoadProfiles() []model.Profile {
var item model.Profile
json.Unmarshal([]byte(lines[i]), &item)
if !added[item.Name] {
added[item.Name] = true
if !added[item.RemoteId] {
added[item.RemoteId] = true
collection = append(collection, item)
}
}
return collection
}
func UpdateProfiles(data []string) {
file.WriteDatabase(config.GetConfig().DbPath("profiles"), data)
}