AndrewRadev / id3.vim

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

Mac #4

Closed Hipomenes closed 1 year ago

Hipomenes commented 5 years ago

How would you modify the plugin to work with another id3 reader, such as id3tool?

d

AndrewRadev commented 5 years ago

Currently, there's no "easy" way of changing the command-line tool, like just changing a setting. It's not impossible, just something that would require some work in the code. There's two functions that would have to be changed:

https://github.com/AndrewRadev/id3.vim/blob/c2adcabdf773b1093347e48358e4ce456e51dd61/autoload/id3.vim#L1 https://github.com/AndrewRadev/id3.vim/blob/c2adcabdf773b1093347e48358e4ce456e51dd61/autoload/id3.vim#L83

I could get this working by changing their contents to something like:

if s:CheckCommand('id3')
  call s:ReadMp3Id3(a:filename)
elseif s:CheckCommand('id3tool')
  call s:ReadMp3Id3Tool(a:filename)
else
  echoerr "No suitable command-line tool found. Install one of: id3, id3tool"
endif

The s:CheckCommand function would probably work like this:

call system('which '.a:command)
if v:shell_error == 0
  return 1
else
  return 0
endif

And then the question would be implementing the s:ReadMp3Id3Tool function, and the s:UpdateMp3Id3Tool one to invoke the id3tool with the right flags and parse their output. This is the part that would take more time, but it would probably look similar to the existing method, just not similar enough that it'd be a direct copy-paste.

If you would like to try implementing it yourself, I'd love to get a PR along those lines -- even if it's incomplete, I could give you directions and advice. Otherwise, I can install id3tool (I'm guessing it's this? http://nekohako.xware.cx/id3tool/) and do it myself, but no guarantees on when I'd be able to do it.

AndrewRadev commented 1 year ago

Right now, the plugin should work with id3tool... but I actually wouldn't recommend it. It seems like id3tool only works on v1 tags, which should be quite rare. It also seems (at least on my setup) to cut off the contents to a certain character limit :/.

If you go through the documentation, I'm recommending you use a custom tool I made for it. I'd recommend you try it out, but I don't know what you're looking for.

Either way, I think the original question has been answered, so I'll go ahead and close this issue. If you have any follow-ups, please reopen or open a new one.