mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
fix source-aware download tracking and filter/path regressions
Make download dedupe source-specific to prevent cross-provider ID collisions. Also correct non-remaster filtering, avoid FLAC tagging on non-FLAC files, and use album IDs for singles folder templating.
This commit is contained in:
@@ -258,7 +258,7 @@ func applyQobuzArtistFilters(artistName string, albums []collectionAlbum, filt c
|
||||
if filt.NonRemaster {
|
||||
tmp := out[:0]
|
||||
for _, a := range out {
|
||||
if qobuzRemasterRe.MatchString(a.Title) {
|
||||
if !qobuzRemasterRe.MatchString(a.Title) {
|
||||
tmp = append(tmp, a)
|
||||
}
|
||||
}
|
||||
@@ -592,7 +592,7 @@ func (m *Main) ripPlaylist(ctx context.Context, p provider.Client, source, playl
|
||||
}
|
||||
|
||||
func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fallbackTitle string, opts ripTrackOptions) error {
|
||||
alreadyDownloaded, err := m.Store.IsDownloaded(ctx, id)
|
||||
alreadyDownloaded, err := m.Store.IsDownloaded(ctx, source, id)
|
||||
if err == nil && alreadyDownloaded {
|
||||
if m.IgnoreDB {
|
||||
alreadyDownloaded = false
|
||||
@@ -680,8 +680,10 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
|
||||
coverPath = tag.CoverPathForTrack(outPath, opts.albumFolder)
|
||||
}
|
||||
}
|
||||
if err = m.Tagger.TagFLAC(outPath, tagMeta, coverPath); err != nil {
|
||||
m.logf("warning: tag failed for %s: %v\n", filepath.Base(outPath), err)
|
||||
if strings.EqualFold(filepath.Ext(outPath), ".flac") {
|
||||
if err = m.Tagger.TagFLAC(outPath, tagMeta, coverPath); err != nil {
|
||||
m.logf("warning: tag failed for %s: %v\n", filepath.Base(outPath), err)
|
||||
}
|
||||
}
|
||||
|
||||
if m.Config.Session.Conversion.Enabled {
|
||||
@@ -693,7 +695,7 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
|
||||
outPath = convertedPath
|
||||
}
|
||||
|
||||
return m.Store.MarkDownloaded(ctx, id)
|
||||
return m.Store.MarkDownloaded(ctx, source, id)
|
||||
}
|
||||
|
||||
func (m *Main) qualityForSource(source string) int {
|
||||
@@ -772,6 +774,10 @@ func (m *Main) trackOutputPath(source, id, title, ext string, trackMeta map[stri
|
||||
|
||||
if albumFolder == "" && m.Config.Session.Filepaths.AddSinglesToFolder {
|
||||
albumTitle := nestedString(trackMeta, "album", "title")
|
||||
albumID := nestedString(trackMeta, "album", "id")
|
||||
if albumID == "" {
|
||||
albumID = id
|
||||
}
|
||||
albumArtist := nestedString(trackMeta, "album", "artist", "name")
|
||||
if albumArtist == "" {
|
||||
albumArtist = nestedString(trackMeta, "performer", "name")
|
||||
@@ -780,7 +786,7 @@ func (m *Main) trackOutputPath(source, id, title, ext string, trackMeta map[stri
|
||||
if albumYear == "Unknown" {
|
||||
albumYear = naming.YearFromDate(stringFromAny(trackMeta["release_date"]))
|
||||
}
|
||||
albumFolder = m.albumFolderPath(source, id, albumTitle, albumArtist, albumYear, intFromAny(trackMeta["maximum_bit_depth"]), stringFromAny(trackMeta["maximum_sampling_rate"]))
|
||||
albumFolder = m.albumFolderPath(source, albumID, albumTitle, albumArtist, albumYear, intFromAny(trackMeta["maximum_bit_depth"]), stringFromAny(trackMeta["maximum_sampling_rate"]))
|
||||
}
|
||||
if albumFolder != "" {
|
||||
base = albumFolder
|
||||
|
||||
Reference in New Issue
Block a user