AndrewRadev / id3.vim

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

Enabled removing tags. #3

Closed alanxoc3 closed 7 years ago

alanxoc3 commented 7 years ago

I just added the -d option to ID3 for updating the mp3 files. 'cause I needed to delete tags. Thanks for the plugin, and this is my first pull request :).

ID3 Documentation:

-d, --delete
       do not re-use existing tag data. If no new  tag  information  is
       specified  in  conjunction  with  this option, all selected tags
       will be removed.
AndrewRadev commented 7 years ago

Thanks for the pull request :). I appreciate you taking the time to look into my project and propose the change.

Unfortunately, it seems like adding this flag deletes any other tags that the plugin doesn't update directly. For instance, if there's an embedded image. You can test it by running id3 -v <song-name> on a song that has album art in it, there's an APIC tag that, if you add the -d flag ends up deleted.

I pushed a commit to master that should enable you to delete tags and also should preserve extra tags. Could you check it out and let me know if it works for you?

alanxoc3 commented 7 years ago

Yeah that worked, thanks. Vimscript is pretty confusing.

There is one more thing that I would change...

Changing this line in autoload/id3.vim:

let format_string  = '%'.join(['t', 'a', 'l', 'n', 'y', 'g', 'c'], '\n%')

to

let format_string  = '%'.join(['_t', '_a', '_l', '_n', '_y', '_g', '_c'], '\n%')

I didn't want underscores converting to spaces in the different labels and the ID3 man page said putting an underscore before each modifier would preserve the underscores. But there may be an easier way to do that.

AndrewRadev commented 7 years ago

Huh, I wasn't aware of that. Good catch :). I'm okay with merging it, but could you remove the -d flag, then? Maybe just revert f1f2e21e42836b84b109cde40bd52498a3cf3fd4, since we discovered a different way to fix the issue?

alanxoc3 commented 7 years ago

Okay, I did it. Thanks man.

AndrewRadev commented 7 years ago

Thanks for your work :).