Plugin to put & artist in the title

Hey :slight_smile:

(I’m french so i will do my best to speak well english ;))

I am not very good at computing and even less at coding. I’m using MusicBrainz Picard since a long time now, and I love it, it’s very useful.
The only problem is that I would heave preferred if the “feat.” and the “&” are in the title rather than in the name of the artist.
Then, i discovered the plugins, i was happy, there was a plugin to put the feat. in the title, but it unfortunately doesn’t exist for the “&”, so i tried to change the codage of the plugin, but i’m really bad at coding so I modified some things at random… And I knew it but it didn’t worked.
So, can anybody help me to create a plugin for that or does anybody have already create it.
The plugin that I used was “Feat. Artists in Titles” on this link https://picard.musicbrainz.org/plugins/
And some precision: I would like that the artist who is with a “&” become enter bracket with a “feat.” for exemple: Michael Jackson & Rihanna becomes in the title: Name of the song (Feat. Rihanna).

I hope that I have made it clear :slight_smile:

Thank a lot

Can anybody help me ? :blush:

I have made some modifications to the original plugin, so that you can specify a list of Words (feat., with, & etc.) which should be used as split.

I also made a check so it only splits if there is more than one ArtistID assigned to the track/album to avoid it splitting https://musicbrainz.org/artist/05088a61-5588-4892-82e6-337e57096a43.

It should be possibly to modify my modification to always replace the spilt Words with an & in the brackets.

I will post my version of the plugin when I come home.

1 Like

This is the modified version af “Feat. artist in title”-plugin.

You can specify a list of words you want to split on and it only do the split if there is more than one artistid.

PLUGIN_NAME = 'Feat. Artists & More in Titles'
PLUGIN_AUTHOR = 'Lukas Lalinsky, Michael Wiencek, Bryan Toth, Brian Altenburg'
PLUGIN_DESCRIPTION = 'Move "feat.", "with" etc. from artist names to album and track titles. Match is case insensitive.'
PLUGIN_VERSION = "0.4"
PLUGIN_API_VERSIONS = ["0.9.0", "0.10", "0.15", "0.16", "2.0", "2.1", "2.2"]

from picard.metadata import register_album_metadata_processor, register_track_metadata_processor
import re

list = ['feat.', 'with']

def move_album_featartists(album, metadata, release):
    if metadata["musicbrainz_albumartistid"].count(";") > 0:
        for item in list:
            _item_re = re.compile(r"([\s\S]+) "+item+" ([\s\S]+)", re.IGNORECASE)
            match = _item_re.match(metadata["albumartist"])
            if match:
                metadata["albumartist"] = match.group(1)
                metadata["album"] += " ("+item+" %s)" % match.group(2)

def move_track_featartists(album, metadata, release, track):
    if metadata["musicbrainz_artistid"].count(";") > 0:
        #album.tagger.log.error("BRS")
        for item in list:
            _item_re = re.compile(r"([\s\S]+) "+item+" ([\s\S]+)", re.IGNORECASE)
            match = _item_re.match(metadata["artist"])
            if match:
                metadata["artist"] = match.group(1)
                metadata["title"] += " ("+item+" %s)" % match.group(2)

register_album_metadata_processor(move_album_featartists)
register_track_metadata_processor(move_track_featartists)

If you want it to always be “feat.” instead of “&” or “with” or whatever you specified in the list-variable, you should change the following line:

metadata["title"] += " ("+item+" %s)" % match.group(2)

to

metadata["title"] += " (feat. %s)" % match.group(2)
2 Likes

Hi :slight_smile:
Sorry , i didn’t see that you answered to me.
Thank you very much for taking time to resolve my wish ! :smiley:
I would never have been able to make what you made :open_mouth:
But unfortunately, it did not work, when I add the plugin on MusicBrainz, nothing happens, nothing is added in the list of plugins.
Did you tried it with your computer ? I tried to change things, but I didn’t succeed. Maybe I did a mistake when I created the file, so for the file that I made you can download it here and maybe i have done a mistake:
https://mega.nz/#!EwtwGJYD!WjxlRDlABafFK9IzRtnQNHlG8-v_0-N49_bwVDdoiVQ
Thank you very much again :stuck_out_tongue:

The formatting in the original post by @Gitrian was broken. I took the freedom to edit the post and fix the code formatting, so now you should be able to copy and paste it properly :slight_smile:

2 Likes

Thank you very muuuch !
Everything’s working :slight_smile:
Thank you to Gitrian for making the plugin and thank you to outsidecontext for correcting problems :smiley:
It works exactly like I wanted
I put a download link here, I don’t know if it will help anyone, but maybe it will be easier like this :wink:
https://mega.nz/#!J1VARagI!9pKS7sXiXjrDNoc-gW6tPA2E1ITdK8QBb7xg9p_cFmA

And I have a last questionn it has not relevance but, it’s something I would like too, I don’t know if we have to create a plugin to do that, because it’s only a little thing:
When an artist is called by his first name and surname (exemple: Michael Jackson), the album artist sort order and the artist order is “surname, first name” (exemple: Jackson, Michael), but I would prefer if the first name was before the surname, is there any way to change it ? If someone know can he told me ? But if it’s too complicated I will create a new topic :wink:

Thank you again for the other problem you two :wink:

See this thread.

And yeah, in general please start a new topic when you have a new question. It helps other people with the same question find the answer :slight_smile:

Ok ! :smiley: Next time I will create a new topic :wink:
Thank you for the link, I didn’t find it when I searched… and it work, thank you :slight_smile:

I really like this, good work all :heart_eyes:

1 Like

Hi team, thanks for taking the time to post your code, this place is awesome!!

I’m wanting to achieve the same thing as the original poster however when I tried to copy the code into the scripting area of MusicBrain but getting “Unexpected character ‘s’ at position 41, line 15.”

Any help is apprecieated as I’d love to get this working soon :slight_smile:

FYI - using Mac OSX 10.1.3 with version 1.4.1

The code is a plugin and not a tagger script. You have to put the code into a file with the .py extension, e.g. artistintitle.py, and put that file in Picard’s plugin folder. If everything went fine you will see the plugin in Picard’s options where you can enable it.

1 Like

Hello!
I found this very useful. I have only one problem in renaming the ones with ‘&’. If the artists are two it works fine. If the artists are more than two they come with ‘,’ Here’s an example:
Beyoncé, Missy Elliott, MC Lyte & Free - Fighting Temptation becomes
Beyoncé, Missy Elliott, MC Lyte - Fighting Temptations (Feat. Free)
Is there any chance to have
Beyoncé - Fighting Temptations (Feat. Missy Elliott, MC Lyte & Free)?
Thank you

1 Like

Does this work anymore? I’m running v2.2.1 now and cant even get it to show up in the list of plugins once i’ve added the .py to the plugins folder

Basically same answer as in Categorizing lossless music could work.

On a quick glance I don’t see anything that should prevent this plugin from working after this change. Just try it. If there is an error take a look at the Error/Debug log and post the errors here.

1 Like

Ok went into the options panel->Open Plugin Folder

Tried both a .py and .zip in C:\Users\XXX\AppData\Local\MusicBrainz\Picard\plugins clicking on Install Plugin. Neither does anything. No response after clicking ok, doesnt appear in the list, clicked reload to no effect and restarted picard to no effect. Code is exactly as above pasted into notepad and saved as .py and then zipped.

I recall having problems installing last.fm.ng around 8 months ago getting the same nil response on anything

Ok i tried putting the .py in my D:\Downloads folder and installing from there. Now i get an error in Picard:

An error occured while loading the plugin ‘Feat. Artists & More in Titles’:

Plugin ‘Feat. Artists & More in Titles’ from ‘C:\Users\Karl\AppData\Local\MusicBrainz\Picard\plugins\Feat. Artists & More in Titles.py’ is not compatible with this version of Picard.

followed by

The plugin ‘Feat. Artists & More in Titles’ is not compatible with this version of Picard.

Guess its dead :frowning:

It should still work, but you need to extend the PLUGIN_API_VERSIONS like this:

["0.9.0", "0.10", "0.15", "0.16", "2.0", "2.1", "2.2"]

See also the discussion for Categorizing lossless music - #6 by outsidecontext

Sorry, I was not quite clear about this in my first post. Since you had basically the same question as in the other thread at around the same time I for some reason assumed you had also put in the question on the other thread.

2 Likes

Yes!! It works again. Thanks again @outsidecontext im getting tonnes of help on this forum :smiley:
My Picard settings are looking like a work of art now

3 Likes

Sorry to dig this up again but it looks like the plugin has stopped working again.
I updated the PLUGIN_API_VERSIONS to current i.e.:
PLUGIN_API_VERSIONS = [“0.9.0”, “0.10”, “0.15”, “0.16”, “2.0”, “2.1”, “2.2”, “2.6.4”]

2.6.4 being the version im on…

Installed the updated .py and nothing. It appears in the plugin list, is activated but doesn’t do anything

Any ideas anyone?