Use file name for unknown tag title retrieval.

When taglib get empty or null title from file/album, use file name or
folder name as the tag_title field. It could be confuse to user, but at
leaset it is better than tracks/albums can't be search in ID3 mode API.
This commit is contained in:
2024-06-24 16:17:45 +08:00
parent 332f00ff7a
commit 8914c59978
3 changed files with 24 additions and 7 deletions

View File

@@ -465,8 +465,9 @@ func populateTrack(tx *db.DB, album *db.Album, track *db.Track, trags tagcommon.
track.Size = size
track.AlbumID = album.ID
track.TagTitle = trags.Title()
track.TagTitleUDec = decoded(trags.Title())
tagTitle := tagcommon.MustTitle(trags)
track.TagTitle = tagTitle
track.TagTitleUDec = decoded(tagTitle)
track.TagTrackArtist = tagcommon.MustArtist(trags)
track.TagTrackNumber = trags.TrackNumber()
track.TagDiscNumber = trags.DiscNumber()