mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
harden deezer auth errors and mixed playlist preflight
This commit is contained in:
@@ -728,6 +728,20 @@ func (m *Main) ripPlaylist(ctx context.Context, p provider.Client, source, playl
|
||||
}
|
||||
|
||||
func (m *Main) ripPlaylistMixed(ctx context.Context, playlistID, name string, refs []PlaylistTrackRef) error {
|
||||
requiredSources := map[string]struct{}{}
|
||||
for _, ref := range refs {
|
||||
s := strings.TrimSpace(ref.Source)
|
||||
if s == "" {
|
||||
continue
|
||||
}
|
||||
requiredSources[s] = struct{}{}
|
||||
}
|
||||
for source := range requiredSources {
|
||||
if err := m.requireSourceDownloadAuth(source); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
folder := filepath.Join(m.Config.Session.Downloads.Folder, naming.CleanName(name, naming.Config{
|
||||
RestrictCharacters: m.Config.Session.Filepaths.RestrictCharacters,
|
||||
TruncateTo: m.Config.Session.Filepaths.TruncateTo,
|
||||
|
||||
@@ -535,6 +535,16 @@ func TestRipAlbumRequiresDeezerARL(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRipPlaylistMixedRequiresDeezerAuth(t *testing.T) {
|
||||
d := config.DefaultConfigData()
|
||||
m := &Main{Config: &config.Config{File: d, Session: d}}
|
||||
|
||||
err := m.ripPlaylistMixed(context.Background(), "mix1", "Mix", []PlaylistTrackRef{{Source: "deezer", ID: "1"}})
|
||||
if err == nil || !strings.Contains(err.Error(), "deezer") {
|
||||
t.Fatalf("expected deezer auth error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyQobuzArtistFiltersRepeats(t *testing.T) {
|
||||
albums := []collectionAlbum{
|
||||
{ID: "a1", Title: "Album X", BitDepth: 16, Sampling: 44.1, Explicit: false},
|
||||
|
||||
Reference in New Issue
Block a user