mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
implement native Deezer download/decrypt pipeline
Replace Deezer yt-dlp usage with native ARL session + media.get_url resolution, add BF_CBC_STRIPE decryption in downloader, and wire cipher-aware Deezer downloads through the main rip pipeline. Includes validation hardening and metadata/source-id improvements used by tagging flows.
This commit is contained in:
@@ -818,9 +818,19 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
|
||||
if opts.total > 0 && (!m.Config.Session.CLI.ProgressBars || !m.Config.Session.CLI.TextOutput || !m.DL.ProgressEnabled()) {
|
||||
m.logf("[%d/%d] %s\n", opts.index, opts.total, filepath.Base(outPath))
|
||||
}
|
||||
if err = m.DL.File(ctx, d.URL, outPath); err != nil {
|
||||
downloadOnce := func() error {
|
||||
if d.Source == "deezer" && strings.EqualFold(strings.TrimSpace(d.Cipher), "BF_CBC_STRIPE") {
|
||||
trackID := d.TrackID
|
||||
if strings.TrimSpace(trackID) == "" {
|
||||
trackID = id
|
||||
}
|
||||
return m.DL.FileDeezerEncrypted(ctx, d.URL, outPath, trackID)
|
||||
}
|
||||
return m.DL.File(ctx, d.URL, outPath)
|
||||
}
|
||||
if err = downloadOnce(); err != nil {
|
||||
m.logf("retry: %s (%v)\n", filepath.Base(outPath), err)
|
||||
if err = m.DL.File(ctx, d.URL, outPath); err != nil {
|
||||
if err = downloadOnce(); err != nil {
|
||||
_ = m.Store.MarkFailed(ctx, source, "track", id)
|
||||
return fmt.Errorf("id=%s title=%q download: %w", id, title, err)
|
||||
}
|
||||
@@ -1225,10 +1235,20 @@ func buildTagMetadata(trackMeta map[string]any, title, source, trackID string, o
|
||||
}
|
||||
|
||||
sourceAlbumID := nestedString(trackMeta, "album", "id")
|
||||
if sourceAlbumID == "" {
|
||||
sourceAlbumID = stringFromAny(trackMeta["source_album_id"])
|
||||
}
|
||||
sourceArtistID := nestedString(trackMeta, "artist", "id")
|
||||
if sourceArtistID == "" {
|
||||
sourceArtistID = nestedString(trackMeta, "performer", "id")
|
||||
}
|
||||
if sourceArtistID == "" {
|
||||
sourceArtistID = stringFromAny(trackMeta["source_artist_id"])
|
||||
}
|
||||
sourceTrackID := trackID
|
||||
if v := stringFromAny(trackMeta["source_track_id"]); v != "" {
|
||||
sourceTrackID = v
|
||||
}
|
||||
|
||||
return tag.Metadata{
|
||||
Title: title,
|
||||
@@ -1251,7 +1271,7 @@ func buildTagMetadata(trackMeta map[string]any, title, source, trackID string, o
|
||||
ReplaygainTrackPeak: trackPeak,
|
||||
ReplaygainAlbumPeak: albumPeak,
|
||||
SourcePlatform: source,
|
||||
SourceTrackID: trackID,
|
||||
SourceTrackID: sourceTrackID,
|
||||
SourceAlbumID: sourceAlbumID,
|
||||
SourceArtistID: sourceArtistID,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user