fix qobuz EOF downloads with mobile fallback flow

This commit is contained in:
2026-05-01 17:23:52 +02:00
parent 9618108f2a
commit 59b476034e
3 changed files with 640 additions and 0 deletions

View File

@@ -91,6 +91,10 @@ type videoDownloadableProvider interface {
GetVideoDownloadable(ctx context.Context, videoID string) (*provider.Downloadable, error)
}
type trackFallbackDownloader interface {
DownloadTrackFallback(ctx context.Context, trackID string, quality int, outputPath string) error
}
func New(cfg *config.Config) (*Main, error) {
var db store.Database
if cfg.Session.Database.DownloadsEnabled || cfg.Session.Database.FailedDownloadsEnabled {
@@ -885,11 +889,21 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
if err = downloadOnce(); err != nil {
m.logf("retry: %s (%v)\n", filepath.Base(outPath), err)
if err = downloadOnce(); err != nil {
if fallbackProvider, ok := p.(trackFallbackDownloader); ok {
m.logf("fallback: %s via provider backup flow\n", filepath.Base(outPath))
if fbErr := fallbackProvider.DownloadTrackFallback(ctx, id, m.qualityForSource(source), outPath); fbErr == nil {
goto downloaded
} else {
m.logf("fallback failed: %s (%v)\n", filepath.Base(outPath), fbErr)
}
}
_ = m.Store.MarkFailed(ctx, source, "track", id)
return fmt.Errorf("id=%s title=%q download: %w", id, title, err)
}
}
downloaded:
embedCoverPath := opts.albumEmbedCover
if opts.forPlaylist {
parent := opts.albumFolder