Plugin development: get file from track

Tags: #<Tag:0x00007f756744ae88> #<Tag:0x00007f756744adc0> #<Tag:0x00007f756744acf8> #<Tag:0x00007f756744ac30>

I’m trying to learn the Picard plugin API by writing a plugin that reads a file in the same directory as an mp3 file, reads data from it, and adds that to the track’s metadata.

I’m stuck on the first step: “find a file in the same directory as the MP3 file being tagged”. I can’t seem to get the path to the file being tagged. If I had that, I could just dirname it and look for my data file.

It looks as though I need to

def track_local_file(tagger, metadata, release, track):

But once track_local_file is called, none of the arguments seem to have a file or directory path.
Any tips? Thanks,

The best suggestion is to take a plugin that is already doing something like you want and see what that does. See the source in github and look at bpm, moodbars, replaygain etc.

What you probably need to do is call:
This should then call the following with the file you are processing:
def _add_file_to_queue(self, file):


Thanks! I was wondering whether I might need to use some other plugin type, but I didn’t know which one.

Also see discussion over at Get files from objects

See my hack documented at Get files from objects

1 Like