ye
This commit is contained in:
@@ -20,11 +20,12 @@ type TrackMatcher interface {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
DryRun bool
|
||||
PublicPlaylists bool
|
||||
Concurrency int
|
||||
LikedName string
|
||||
Progress ProgressFunc
|
||||
DryRun bool
|
||||
PublicPlaylists bool
|
||||
Concurrency int
|
||||
LikedName string
|
||||
TargetPlaylistID int64 // when set, add tracks to this existing playlist instead of creating a new one
|
||||
Progress ProgressFunc
|
||||
}
|
||||
|
||||
type ProgressFunc func(message string)
|
||||
@@ -87,14 +88,21 @@ func processPlaylist(ctx context.Context, cfg Config, writer QobuzWriter, matche
|
||||
return res
|
||||
}
|
||||
|
||||
notify(cfg, fmt.Sprintf("Transfer %d/%d creating playlist: %s", playlistIndex, playlistTotal, shortName(pl.Name)))
|
||||
playlistID, err := writer.CreatePlaylist(ctx, pl.Name, sanitizeDescription(pl.Description), cfg.PublicPlaylists)
|
||||
if err != nil {
|
||||
res.Errors = append(res.Errors, fmt.Sprintf("create playlist: %v", err))
|
||||
notify(cfg, fmt.Sprintf("Transfer %d/%d failed creating playlist: %s", playlistIndex, playlistTotal, shortName(pl.Name)))
|
||||
return res
|
||||
var playlistID int64
|
||||
if cfg.TargetPlaylistID > 0 {
|
||||
playlistID = cfg.TargetPlaylistID
|
||||
res.TargetID = playlistID
|
||||
} else {
|
||||
notify(cfg, fmt.Sprintf("Transfer %d/%d creating playlist: %s", playlistIndex, playlistTotal, shortName(pl.Name)))
|
||||
created, err := writer.CreatePlaylist(ctx, pl.Name, sanitizeDescription(pl.Description), cfg.PublicPlaylists)
|
||||
if err != nil {
|
||||
res.Errors = append(res.Errors, fmt.Sprintf("create playlist: %v", err))
|
||||
notify(cfg, fmt.Sprintf("Transfer %d/%d failed creating playlist: %s", playlistIndex, playlistTotal, shortName(pl.Name)))
|
||||
return res
|
||||
}
|
||||
playlistID = created
|
||||
res.TargetID = playlistID
|
||||
}
|
||||
res.TargetID = playlistID
|
||||
|
||||
ids := uniqueIDs(matched)
|
||||
if len(ids) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user