Open jaja360 opened 1 year ago
The problem I had was that @thaffenden seems to be merging two values when writing, which worried me:
I'm also currently setting the value of TPE2 (band/orchestra/accompaniment) to the same as the value for TPE1 (lead performer(s)/soloist(s) - used as the Artist tag), as I had some files where they were set differently but in reality I needed them as the same value.
Unfortunately, I didn't get an answer, so I never ended up merging.
There's also the problem that, even if I merged that PR, it wouldn't help you, I think, because you can't choose which command to execute, it just goes through them in a list. The better way to do this, I think, would be to list what order you want the tools to be tried in, something like this from a different plugin of mine: https://github.com/AndrewRadev/writable_search.vim/blob/master/doc/writable_search.txt#L132-L136
It's been a while, so I'd like to maybe sit down, checkout the PR in a separate branch and revise it a bit, but I have to actually find the time for it :). Could you try to use that branch and see if it works for you? You'd probably have to uninstall id3
and install one of the other two tools.
Thanks for you answer !
So I tried to use @thaffenden's branch:
With id3tool
, it seems to work. The only problem is that it returns an error if the genre is empty or not one of the "official" genre supported by the id3v1 standard. Maybe it would be possible to add a condition in the code of the vim plugin to not try to write the genre if the field is empty in the buffer.
With id3v2
, everything seems to work. I was not familiar with the id3v2
standard so I took a look at it, and apparently, compared to id3v1, where there is simply an artist
tag, in id3v2 there's both a tag for "lead performer" (TPE1) and "band" (TPE2). Apparently, some people use them to distinguish between "track artist" and "album artist". I think the best thing that should be done is to add a field in the vim buffer for the track artist. If this field is empty, we simply use the same value (the Artist field) for TPE1 and TPE2. Otherwise, we write the "Artist" field to TPE2 and "track artist" field to TPE1.
Maybe it would be possible to add a condition in the code of the vim plugin to not try to write the genre if the field is empty in the buffer. I think the best thing that should be done is to add a field in the vim buffer for the track artist.
Yes, I agree on all accounts. I'll try to tackle this next weekend, since I'll be having a busy week. I'll likely start from #5 and reorganize things a bit.
Sorry about that! Forgot that PR existed after I set my config to use that branch. So 2 years later (😬) I've addressed the feedback, rebased and pushed up the change. The priority ordering of which tool to use is a great shout. I've not looked at that at all, just got my PR to a point where it's hopefully ok to merge for you to use as a starting point for that. Happy to add anything else you think might be useful to it if you think it needs some config options etc.
Thanks, @thaffenden :+1:. I've merged the PR, so I think @jaja360 should be able to use the current HEAD with id3v2
. I'll put some time into that option ordering and fill in some missing stuff -- I'm surprised I didn't have docs, for instance.
Unfortunately, I'm going to have a hard time testing, because it seems that the id3v2
and id3tool
command-lines I can install on Arch Linux have different interfaces than whatever both of you are using :/. id3v2 -R
tells me there's no such flag:
% id3v2 -R test.mp3
id3v2: invalid option -- 'R'
Usage: id3v2 [OPTION]... [FILE]...
Adds/Modifies/Removes/Views id3v2 tags, modifies/converts/lists id3v1 tags
-h, --help Display this help and exit
-f, --list-frames Display all possible frames for id3v2
-L, --list-genres Lists all id3v1 genres
-v, --version Display version information and exit
-l, --list Lists the tag(s) on the file(s)
-d, --delete-v2 Deletes id3v2 tags
-s, --delete-v1 Deletes id3v1 tags
-D, --delete-all Deletes both id3v1 and id3v2 tags
-C, --convert Converts id3v1 tag to id3v2
-1, --id3v1-only Writes only id3v1 tag
-2, --id3v2-only Writes only id3v2 tag
-r, --remove-frame "FRAMEID" Removes the specified id3v2 frame
-a, --artist "ARTIST" Set the artist information
-A, --album "ALBUM" Set the album title information
-t, --song "SONG" Set the song title information
-c, --comment "DESCRIPTION":"COMMENT":"LANGUAGE"
Set the comment information (both
description and language optional)
-g, --genre num Set the genre number
-y, --year num Set the year
-T, --track num/num Set the track number/(optional) total tracks
You can set the value for any id3v2 frame by using '--' and then frame id
For example:
id3v2 --TIT3 "Monkey!" file.mp3
would set the "Subtitle/Description" frame to "Monkey!".
And id3tool doesn't seem to even have an interface for reading:
% id3tool --help
id3tool version 1.2a
Copyright (C) 1999-2005, Christopher Collins
id3tool comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. For details refer to the
file "COPYING" included with this program.
usage:
id3tool [<options>] <filename>
-t, --set-title=WORD Sets the title to WORD
-a, --set-album=WORD Sets the album to WORD
-r, --set-artist=WORD Sets the artist to WORD
-y, --set-year=YEAR Sets the year to YEAR [4 digits]
-n, --set-note=WORD Sets the note to WORD
-g, --set-genre=INT Sets the genre code to INT
-G, --set-genre-word=WORD Sets the genre to WORD
-c, --set-track=INT Sets the track number to INT
-l, --genre-list Shows the Genre's and their codes
-v, --version Displays the version
-h, --help Displays this message
Report bugs to Chris Collins <ccollins@pcug.org.au>
@thaffenden, @jaja360, could you help me out by letting me know how installed these commands. Maybe they're Mac/BSD-specific? Maybe it's literally different tools with the same name?
I'm this close to just writing something from scratch with rust-id3 and shipping binaries for windows, linux and mac. But it would be clumsy, to put it mildly.
@AndrewRadev id3tool
should output the tag data to stdout if you just pass the file name with no arguments e.g.:
I'm on Ubuntu cant remeber where I installed the version of id3v2
though, but the help text I get is the same as yours with the extra R
flag:
Is the version from the AUR an older one or something?
For id3v2, the version seems to be the same:
extra/id3lib 3.8.3-18
Library for reading, writing, and manipulating ID3v1 and ID3v2 tags
community/id3v2 0.1.12-6
Utility to edit id3v2 tags
It's so weird. It's not even in AUR, it's in the "extra" repository. Help and version outputs seem exactly the same, without the -R
flag. I can't help but wonder if one of these is a fork that hasn't bumped the version. I'll look into it a bit more later, try to figure out the history of what's actually published in the repos. I'd use the -l
flag, but its output is actually kind of weird.
id3tool should output the tag data to stdout if you just pass the file name with no arguments e.g.:
Huh, so it does. I could swear I tried it and it didn't work, but seems like I got mixed up somehow. Well, at least that's not an issue.
@jaja360, @thaffenden I've shuffled around some code, added a few basic tests and that one variable I mentioned, g:id3_mp3_backends
, which is a list of tools in the order to try them in.
I've also created this tool, which should (hopefully) work best, because it reads and writes JSON instead of trying to parse potentially messy output and deal with version mismatches and package availability: https://github.com/AndrewRadev/id3-json
In the installation instructions, I've linked to executables to download. Ideally, I'd like to make the Vim plugin look for this tool not only externally, but also in a local directory, so somebody could choose not to install the tool globally.
If either of you have the time and energy, I'd appreciate trying this out and reporting any bugs you find. As long as I haven't messed something up, in the long term this should be the most reliable method of reading and writing id3 tags.
The plugin works great with flac files on my computer, but it does not seem to work for mp3 files. I obtain the
There was an error executing the
id3command
message.I see in the code that
id3
is called with the-q
flag, but I don't see that flag supported in my id3 implementation (id3 v1.1.2), so I suppose this is the problem.Is there a way to make this plugin compatible with id3 v1.1.2 ? Else, I suppose the merge request #5 would bypass the problem by supporting id3tool and id3v2. Is there something missing before we can accept the merge ?