mirror of
https://github.com/navidrome/navidrome.git
synced 2025-07-26 21:28:21 +03:00
Don't override input tags with stream tags
This commit is contained in:
parent
4b789e1364
commit
22a0b7e170
@ -131,18 +131,18 @@ func isAudioFile(extension string) bool {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
tagsRx = map[*regexp.Regexp]string{
|
tagsRx = map[*regexp.Regexp]string{
|
||||||
regexp.MustCompile(`^\s+compilation\s+:(.*)`): "compilation",
|
regexp.MustCompile(`^\s{4}compilation\s+:(.*)`): "compilation",
|
||||||
regexp.MustCompile(`^\s+genre\s+:\s(.*)`): "genre",
|
regexp.MustCompile(`^\s{4}genre\s+:\s(.*)`): "genre",
|
||||||
regexp.MustCompile(`^\s+title\s+:\s(.*)`): "title",
|
regexp.MustCompile(`^\s{4}title\s+:\s(.*)`): "title",
|
||||||
regexp.MustCompile(`^\s{4}comment\s+:\s(.*)`): "comment",
|
regexp.MustCompile(`^\s{4}comment\s+:\s(.*)`): "comment",
|
||||||
regexp.MustCompile(`^\s+artist\s+:\s(.*)`): "artist",
|
regexp.MustCompile(`^\s{4}artist\s+:\s(.*)`): "artist",
|
||||||
regexp.MustCompile(`^\s+album_artist\s+:\s(.*)`): "album_artist",
|
regexp.MustCompile(`^\s{4}album_artist\s+:\s(.*)`): "album_artist",
|
||||||
regexp.MustCompile(`^\s+TCM\s+:\s(.*)`): "composer",
|
regexp.MustCompile(`^\s{4}TCM\s+:\s(.*)`): "composer",
|
||||||
regexp.MustCompile(`^\s+album\s+:\s(.*)`): "album",
|
regexp.MustCompile(`^\s{4}album\s+:\s(.*)`): "album",
|
||||||
regexp.MustCompile(`^\s+track\s+:\s(.*)`): "trackNum",
|
regexp.MustCompile(`^\s{4}track\s+:\s(.*)`): "trackNum",
|
||||||
regexp.MustCompile(`^\s+disc\s+:\s(.*)`): "discNum",
|
regexp.MustCompile(`^\s{4}disc\s+:\s(.*)`): "discNum",
|
||||||
regexp.MustCompile(`^\s+TPA\s+:\s(.*)`): "discNum",
|
regexp.MustCompile(`^\s{4}TPA\s+:\s(.*)`): "discNum",
|
||||||
regexp.MustCompile(`^\s+date\s+:\s(.*)`): "year",
|
regexp.MustCompile(`^\s{4}date\s+:\s(.*)`): "year",
|
||||||
regexp.MustCompile(`^\s{4}Stream #\d+:1: (.+):\s`): "hasPicture",
|
regexp.MustCompile(`^\s{4}Stream #\d+:1: (.+):\s`): "hasPicture",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,4 +52,33 @@ var _ = Describe("Metadata", func() {
|
|||||||
It("returns empty map if there are no audio files in path", func() {
|
It("returns empty map if there are no audio files in path", func() {
|
||||||
Expect(ExtractAllMetadata(".")).To(BeEmpty())
|
Expect(ExtractAllMetadata(".")).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Context("extractMetadata", func() {
|
||||||
|
const outputWithOverlappingTitleTag = `
|
||||||
|
Input #0, mp3, from 'groovin.mp3':
|
||||||
|
Metadata:
|
||||||
|
title : Groovin' (feat. Daniel Sneijers, Susanne Alt)
|
||||||
|
artist : Bone 40
|
||||||
|
track : 1
|
||||||
|
album : Groovin'
|
||||||
|
album_artist : Bone 40
|
||||||
|
comment : Visit http://bone40.bandcamp.com
|
||||||
|
date : 2016
|
||||||
|
Duration: 00:03:34.28, start: 0.025056, bitrate: 323 kb/s
|
||||||
|
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
|
||||||
|
Metadata:
|
||||||
|
encoder : LAME3.99r
|
||||||
|
Side data:
|
||||||
|
replaygain: track gain - -6.000000, track peak - unknown, album gain - unknown, album peak - unknown,
|
||||||
|
Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 700x700 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
|
||||||
|
Metadata:
|
||||||
|
title : cover
|
||||||
|
comment : Cover (front)
|
||||||
|
At least one output file must be specified`
|
||||||
|
|
||||||
|
It("parses correct the title without overlapping with the stream tag", func() {
|
||||||
|
md, _ := extractMetadata("groovin.mp3", outputWithOverlappingTitleTag)
|
||||||
|
Expect(md.Title()).To(Equal("Groovin' (feat. Daniel Sneijers, Susanne Alt)"))
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user