Skip to content

🎧 Your Personal Streaming Service

Don't override input tags with stream tags

Deluan22a0b7e17022
diff --git a/scanner/metadata_ffmpeg.go b/scanner/metadata_ffmpeg.go
index 4599d8a0a..f4bda6df9 100644
--- a/scanner/metadata_ffmpeg.go
+++ b/scanner/metadata_ffmpeg.go
@@ -131,18 +131,18 @@ func isAudioFile(extension string) bool {
var (
tagsRx = map[*regexp.Regexp]string{
- regexp.MustCompile(`^\s+compilation\s+:(.*)`): "compilation",
- regexp.MustCompile(`^\s+genre\s+:\s(.*)`): "genre",
- regexp.MustCompile(`^\s+title\s+:\s(.*)`): "title",
+ regexp.MustCompile(`^\s{4}compilation\s+:(.*)`): "compilation",
+ regexp.MustCompile(`^\s{4}genre\s+:\s(.*)`): "genre",
+ regexp.MustCompile(`^\s{4}title\s+:\s(.*)`): "title",
regexp.MustCompile(`^\s{4}comment\s+:\s(.*)`): "comment",
- regexp.MustCompile(`^\s+artist\s+:\s(.*)`): "artist",
- regexp.MustCompile(`^\s+album_artist\s+:\s(.*)`): "album_artist",
- regexp.MustCompile(`^\s+TCM\s+:\s(.*)`): "composer",
- regexp.MustCompile(`^\s+album\s+:\s(.*)`): "album",
- regexp.MustCompile(`^\s+track\s+:\s(.*)`): "trackNum",
- regexp.MustCompile(`^\s+disc\s+:\s(.*)`): "discNum",
- regexp.MustCompile(`^\s+TPA\s+:\s(.*)`): "discNum",
- regexp.MustCompile(`^\s+date\s+:\s(.*)`): "year",
+ regexp.MustCompile(`^\s{4}artist\s+:\s(.*)`): "artist",
+ regexp.MustCompile(`^\s{4}album_artist\s+:\s(.*)`): "album_artist",
+ regexp.MustCompile(`^\s{4}TCM\s+:\s(.*)`): "composer",
+ regexp.MustCompile(`^\s{4}album\s+:\s(.*)`): "album",
+ regexp.MustCompile(`^\s{4}track\s+:\s(.*)`): "trackNum",
+ regexp.MustCompile(`^\s{4}disc\s+:\s(.*)`): "discNum",
+ regexp.MustCompile(`^\s{4}TPA\s+:\s(.*)`): "discNum",
+ regexp.MustCompile(`^\s{4}date\s+:\s(.*)`): "year",
regexp.MustCompile(`^\s{4}Stream #\d+:1: (.+):\s`): "hasPicture",
}
diff --git a/scanner/metadata_test.go b/scanner/metadata_test.go
index 7ec559821..9d6a6bb45 100644
--- a/scanner/metadata_test.go
+++ b/scanner/metadata_test.go
@@ -52,4 +52,33 @@ var _ = Describe("Metadata", func() {
It("returns empty map if there are no audio files in path", func() {
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)"))
+ })
+ })
})