acb834
PLUGIN_NAME = 'Feat. Artists in Titles'
acb834
PLUGIN_AUTHOR = 'Lukas Lalinsky, Michael Wiencek'
acb834
PLUGIN_DESCRIPTION = 'Move "feat." from artist names to album and track titles.'
acb834
PLUGIN_VERSION = "0.1"
acb834
PLUGIN_API_VERSIONS = ["0.9.0", "0.10", "0.15"]
acb834
acb834
from picard.metadata import register_album_metadata_processor, register_track_metadata_processor
acb834
import re
acb834
acb834
def move_album_featartists(tagger, metadata, release):
acb834
    match = re.match(r"([\s\S]+) feat.([\s\S]+)", metadata["albumartist"])
acb834
    if match:
acb834
        metadata["albumartist"] = match.group(1)
acb834
        metadata["album"] += " (feat.%s)" % match.group(2)
acb834
acb834
def move_track_featartists(tagger, metadata, release, track):
acb834
    match = re.match(r"([\s\S]+) feat.([\s\S]+)", metadata["artist"])
acb834
    if match:
acb834
        metadata["artist"] = match.group(1)
acb834
        metadata["title"] += " (feat.%s)" % match.group(2)
acb834
acb834
register_album_metadata_processor(move_album_featartists)
acb834
register_track_metadata_processor(move_track_featartists)