Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge multiple Vorbis (and FLAC) tags #60

Open
pgalbavy opened this issue Nov 21, 2019 · 1 comment
Open

Merge multiple Vorbis (and FLAC) tags #60

pgalbavy opened this issue Nov 21, 2019 · 1 comment

Comments

@pgalbavy
Copy link

pgalbavy commented Nov 21, 2019

Another small patch, but needs thought:

diff --git a/vorbis.go b/vorbis.go
index c250615..bf8fc96 100644
--- a/vorbis.go
+++ b/vorbis.go
@@ -64,7 +64,11 @@ func (m *metadataVorbis) readVorbisComment(r io.Reader) error {
                if err != nil {
                        return err
                }
-               m.c[strings.ToLower(k)] = v
+               if _, ok := m.c[strings.ToLower(k)]; ok {
+                       m.c[strings.ToLower(k)] = m.c[strings.ToLower(k)] + "\\" + "\\" + v
+               } else {
+                       m.c[strings.ToLower(k)] = v
+               }
        }
        return nil
 }

The convention in many editors and players is two literal backslahes as value separators, but I would also propose being able to pass this down into ReadFrom() perhaps? mediainfo uses " / "

(I know my golang may not be perfectly clean, just learning it coming from C and perl)

Before:

 $ ./tag -raw  '/media/sda/Music/Compilations/Latin Fever/Disc 1 - 01 - Ricky Martin - Livin'\'' La Vida Loca (Pablo Flores English Radio Edit).flac'
Metadata Format: VORBIS
File Type: FLAC
 Title: Livin' La Visa Loca (Pablo Flores English radio edit)
 Album: Latin Fever
 Artist: Ricky Martin
 Composer: Desmond Child
 Genre: Latin
 Year: 2000
 Track: 1 of 19
 Disc: 1 of 2
 Picture: Picture{Ext: jpg, MIMEType: image/jpeg, Type: Cover (front), Description: , Data.Size: 27688}
 Lyrics:
 Comment:

[...]
"style": "Latin Pop"
"composer": "Desmond Child"
...

After:

$ ./tag -raw  '/media/sda/Music/Compilations/Latin Fever/Disc 1 - 01 - Ricky Martin - Livin'\'' La Vida Loca (Pablo Flores English Radio Edit).flac'
Metadata Format: VORBIS
File Type: FLAC
 Title: Livin' La Visa Loca (Pablo Flores English radio edit)
 Album: Latin Fever
 Artist: Ricky Martin
 Composer: Robi Rosa\Desmond Child
 Genre: Latin
 Year: 2000
 Track: 1 of 19
 Disc: 1 of 2
 Picture: Picture{Ext: jpg, MIMEType: image/jpeg, Type: Cover (front), Description: , Data.Size: 27688}
 Lyrics:
 Comment:


[...]
"composer": "Robi Rosa\\Desmond Child"
"style": "Urban\\Early Pop/Rock\\Mambo\\Salsa\\Latin Dance\\Adult Contemporary\\Club/Dance\\Dance-Pop\\Tropical\\Latin Pop"

file-trimmed.zip

@bertvandepoel
Copy link

Have you considered making this into a PR? It seems sensible, but I guess it has gotten stalled inside this issue. A PR may revive all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants