2023-09-23 10:45:10 +00:00
|
|
|
package pkg
|
|
|
|
|
|
|
|
import (
|
2023-09-24 05:34:51 +00:00
|
|
|
debuglog "cli-go/pkg/log"
|
2023-09-23 10:45:10 +00:00
|
|
|
"cli-go/pkg/model"
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *ClICtrl) syncRemoteCollections(ctx context.Context, info model.Account) error {
|
|
|
|
collections, err := c.Client.GetCollections(ctx, 0)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to get collections: %s", err)
|
|
|
|
}
|
2023-09-24 05:34:51 +00:00
|
|
|
|
2023-09-23 10:45:10 +00:00
|
|
|
for _, collection := range collections {
|
2023-09-24 05:34:51 +00:00
|
|
|
album, err2 := c.mapCollectionToAlbum(ctx, collection)
|
|
|
|
if err2 != nil {
|
|
|
|
return err2
|
2023-09-23 10:45:10 +00:00
|
|
|
}
|
2023-09-24 05:34:51 +00:00
|
|
|
debuglog.PrintAlbum(album)
|
2023-09-23 10:45:10 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|