AndrewRadev / id3.vim

"Edit" mp3 files with Vim, or rather, their ID3 tags
MIT License
51 stars 2 forks source link

Support flac metadata editing #2

Closed elvis-sik closed 8 years ago

elvis-sik commented 8 years ago

Is this doable? For my use case, covering mp3 and FLAC would make this perfect :smile:

EDIT Just to say thank you for making this anyway. This is great software, and it is amazing how the time from thinking "it would be nice to be able to use vim to edit audio metadata" to having that software installed and running was absurdly small!

AndrewRadev commented 8 years ago

Thanks for the kind words :). I did it on a whim, but it's actually turned out to be quite useful to me sometimes as well :D.

Anyway, it shouldn't be difficult to support more filetypes, as long as I've got the commands to convert them. I don't usually use flac files, though, so I'll have to experiment a bit with the tagging options. I see that the flac command I have on my linux has a -T flag that allows someone to add tags. I'll also have to restructure things a bit. I'll see what I can do.

AndrewRadev commented 8 years ago

I've pushed FLAC support to master. You'll need the metaflac command, which should come with your flac package, I hope. If not, you'll have to give me a hint on what I could use to pull tags out of FLAC files, but this one seems to be the most portable way.

Try it out and let me know if it works.

elvis-sik commented 8 years ago

Man, it almost feels like I am paying you! :laughing:

I tested it on some files. It mostly worked. Though some files gave me errors such as the following:

Error detected while processing function id3#ReadFlac: line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value line 18: E688: More targets than List items line 19: E121: Undefined variable: value E15: Invalid expression: value

I can provide you with some files with which this happens (via some private channel) if you feel like investigating. If it is not timely for you, leave the issue open, and in a couple of weeks I might take a look at it (college is making me busy).

AndrewRadev commented 8 years ago

I don't need the files, but the contents of their tags might be useful. Could you run the following command on them:

metaflac --export-tags-to=- <filename>

(Note the - after the = sign).

I'm generally not in a rush :). If you don't have the time to test this out, I don't mind leaving the issue open, and you can ping me with your tests (though, I can never promise any timing on my responses, either :))

elvis-sik commented 8 years ago

Okay, two examples:

album=J.S.Bach: h-Moll-Messe BWV 232 artist=Gächinger Kantorei, Bach-Collegium Stuttgart, Helmuth Rilling date=2006 genre=Classical title=I. Missa. 1. Kyrie eleison TRACKTOTAL=12 tracknumber=1

And

album=J.S.Bach: h-Moll-Messe BWV 232 artist=Gächinger Kantorei, Bach-Collegium Stuttgart, Helmuth Rilling date=2006 genre=Classical title=I. Missa. 1. Kyrie eleison TRACKTOTAL=12 tracknumber=1

AndrewRadev commented 8 years ago

Interesting, it seems that it's possible to get lowercase output. Didn't expect that. Unrelated, I'm also noticing (on the local files I'm testing) that setting a tag with a particular name adds a new tag, so you can actually have 2 or more tags called "title", for instance :/. Which is a bit weird. I might start removing the old tag first. I'll experiment and I'll see what I can do.

AndrewRadev commented 8 years ago

I think I managed to fix the lowercase output thing, and I also started removing the old tag before adding the new one. This is done through a single command-line, so I assume the metaflac tool won't botch it if something happens. Do be careful with testing, though, I can't be 100% sure it won't mess up the tags. Try it out on copies of files.

You can test the end result by using the command-line I gave you. On my test files, it used to result in duplicate tags, but that's no longer the case. Check if it does anything weird to the metadata.

elvis-sik commented 8 years ago

I notice I mis-pasted the second info, I'm sorry. Nevertheless, I tested it on the actual two files I had in mind in which id3.vim wasn't working, and it did fine. I could edit everything, and test with the given command :tada:

AndrewRadev commented 8 years ago

Great to hear :). Now I'm just unhappy that the project name is a bit misleading (since FLAC doesn't use "id3" tags), but I don't think there's enough usage of it to matter that much.

Anyway, feel free to reopen the issue or open a new one if you run into any problems.

elvis-sik commented 8 years ago

When it hits big time and we convert the whole word to powerful vim-based audio metadata editing, you rename it and create one of those fancy github organization pages :laughing: