Skip to content

🎧 Your Personal Streaming Service

fix: cover art detection regex

Deluanfc7595a464d6
diff --git a/scanner/metadata_ffmpeg.go b/scanner/metadata_ffmpeg.go
index 76d0f0df5..854137af7 100644
--- a/scanner/metadata_ffmpeg.go
+++ b/scanner/metadata_ffmpeg.go
@@ -143,21 +143,21 @@ func isAudioFile(extension string) bool {
var (
tagsRx = map[*regexp.Regexp]string{
- regexp.MustCompile(`(?i)^\s{4,6}compilation\s+:(.*)`): "compilation",
- regexp.MustCompile(`(?i)^\s{4,6}genre\s+:\s(.*)`): "genre",
- regexp.MustCompile(`(?i)^\s{4,6}title\s+:\s(.*)`): "title",
- regexp.MustCompile(`(?i)^\s{4,6}comment\s+:\s(.*)`): "comment",
- regexp.MustCompile(`(?i)^\s{4,6}artist\s+:\s(.*)`): "artist",
- regexp.MustCompile(`(?i)^\s{4,6}album_artist\s+:\s(.*)`): "album_artist",
- regexp.MustCompile(`(?i)^\s{4,6}TCM\s+:\s(.*)`): "composer",
- regexp.MustCompile(`(?i)^\s{4,6}album\s+:\s(.*)`): "album",
- regexp.MustCompile(`(?i)^\s{4,6}track\s+:\s(.*)`): "trackNum",
- regexp.MustCompile(`(?i)^\s{4,6}tracktotal\s+:\s(.*)`): "trackTotal",
- regexp.MustCompile(`(?i)^\s{4,6}disc\s+:\s(.*)`): "discNum",
- regexp.MustCompile(`(?i)^\s{4,6}disctotal\s+:\s(.*)`): "discTotal",
- regexp.MustCompile(`(?i)^\s{4,6}TPA\s+:\s(.*)`): "discNum",
- regexp.MustCompile(`(?i)^\s{4,6}date\s+:\s(.*)`): "year",
- regexp.MustCompile(`^\s{4}Stream #\d+:\d+: (Video):.*pic\)$`): "hasPicture",
+ regexp.MustCompile(`(?i)^\s{4,6}compilation\s+:(.*)`): "compilation",
+ regexp.MustCompile(`(?i)^\s{4,6}genre\s+:\s(.*)`): "genre",
+ regexp.MustCompile(`(?i)^\s{4,6}title\s+:\s(.*)`): "title",
+ regexp.MustCompile(`(?i)^\s{4,6}comment\s+:\s(.*)`): "comment",
+ regexp.MustCompile(`(?i)^\s{4,6}artist\s+:\s(.*)`): "artist",
+ regexp.MustCompile(`(?i)^\s{4,6}album_artist\s+:\s(.*)`): "album_artist",
+ regexp.MustCompile(`(?i)^\s{4,6}TCM\s+:\s(.*)`): "composer",
+ regexp.MustCompile(`(?i)^\s{4,6}album\s+:\s(.*)`): "album",
+ regexp.MustCompile(`(?i)^\s{4,6}track\s+:\s(.*)`): "trackNum",
+ regexp.MustCompile(`(?i)^\s{4,6}tracktotal\s+:\s(.*)`): "trackTotal",
+ regexp.MustCompile(`(?i)^\s{4,6}disc\s+:\s(.*)`): "discNum",
+ regexp.MustCompile(`(?i)^\s{4,6}disctotal\s+:\s(.*)`): "discTotal",
+ regexp.MustCompile(`(?i)^\s{4,6}TPA\s+:\s(.*)`): "discNum",
+ regexp.MustCompile(`(?i)^\s{4,6}date\s+:\s(.*)`): "year",
+ regexp.MustCompile(`^\s{4}Stream #\d+:\d+: (Video):.*`): "hasPicture",
}
durationRx = regexp.MustCompile(`^\s\sDuration: ([\d.:]+).*bitrate: (\d+)`)
diff --git a/scanner/metadata_test.go b/scanner/metadata_test.go
index 7b926004b..c0ae0b770 100644
--- a/scanner/metadata_test.go
+++ b/scanner/metadata_test.go
@@ -74,7 +74,7 @@ Input #0, mp3, from '/Users/deluan/Music/iTunes/iTunes Media/Music/Compilations/
compilation : 1
Duration: 00:00:01.02, start: 0.000000, bitrate: 477 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
- Stream #0:1: Video: mjpeg (Baseline), gray(bt470bg/unknown/unknown), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)`
+ Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc`
md, _ := extractMetadata("tests/fixtures/test.mp3", output)
Expect(md.HasPicture()).To(BeTrue())
})