Skip to content

Commit 40c2029

Browse files
committed
feat(wrtag): output covers with lowercase extension
closes #198
1 parent 7500d2f commit 40c2029

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
exec tag write kat_moda/01.flac title 'Alarms'
2+
exec tag write kat_moda/02.flac title 'The Bells'
3+
exec tag write kat_moda/03.flac title 'The Bells (Festival mix)'
4+
5+
exec tag write kat_moda/*.flac musicbrainz_albumid 'e47d04a4-7460-427d-a731-cc82386d85f1'
6+
exec tag write kat_moda/*.flac album 'Kat Moda'
7+
exec tag write kat_moda/*.flac albumartist 'Jeff Mills'
8+
exec tag write kat_moda/*.flac label 'Purpose Maker'
9+
exec tag write kat_moda/*.flac catalognumber 'PMD002'
10+
exec tag write kat_moda/*.flac media 'Digital Media'
11+
12+
exec touch kat_moda/folder.PNG
13+
14+
env WRTAG_PATH_FORMAT='albums/{{ .Release.Title }}/{{ .TrackNum }}{{ .Ext }}'
15+
16+
exec wrtag move -yes kat_moda/
17+
18+
exec find albums/
19+
cmp stdout exp-layout
20+
21+
! exists 'albums/Kat Moda/cover.PNG'
22+
exists 'albums/Kat Moda/cover.png'
23+
24+
-- exp-layout --
25+
albums
26+
albums/Kat Moda
27+
albums/Kat Moda/1.flac
28+
albums/Kat Moda/2.flac
29+
albums/Kat Moda/3.flac
30+
albums/Kat Moda/cover.png

wrtag.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,8 @@ func processCover(
10041004
op FileSystemOperation, dc DirContext, release *musicbrainz.Release, destDir string, cover string,
10051005
) (string, error) {
10061006
coverPath := func(p string) string {
1007-
return filepath.Join(destDir, "cover"+filepath.Ext(p))
1007+
ext := strings.ToLower(filepath.Ext(p))
1008+
return filepath.Join(destDir, "cover"+ext)
10081009
}
10091010

10101011
if op.CanModifyDest() && (cover == "" || cfg.UpgradeCover) {
@@ -1078,7 +1079,7 @@ func tryDownloadMusicBrainzCover(ctx context.Context, caa *musicbrainz.CAAClient
10781079
return "", nil
10791080
}
10801081

1081-
ext := path.Ext(coverURL)
1082+
ext := strings.ToLower(path.Ext(coverURL))
10821083
tmpf, err := os.CreateTemp("", ".wrtag-cover-tmp-*"+ext)
10831084
if err != nil {
10841085
return "", fmt.Errorf("mktmp: %w", err)

0 commit comments

Comments
 (0)