mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
fix qobuz EOF downloads with mobile fallback flow
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user