2010-09-21 12:53:13 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
PLUGIN_NAME = 'Bonus Disc'
|
|
|
|
PLUGIN_AUTHOR = 'Jan van Thiel'
|
|
|
|
PLUGIN_DESCRIPTION = '''Based on a script by Lukas Lalinsky.<br/>
|
|
|
|
<br/>
|
|
|
|
Moves bonus disc and bonus disc titles from album titles to separate tags. For example:<br/>
|
|
|
|
<em>"Sleeping With Ghosts (bonus disc: Covers)"</em>
|
|
|
|
<ul>
|
|
|
|
<li>album = <em>"Sleeping With Ghosts"</em></li>
|
|
|
|
<li>bonusdisc = <em>"bonus"</em></li>
|
|
|
|
<li>bonusdisctitle = <em>"Covers"</em></li>
|
|
|
|
</ul>'''
|
|
|
|
PLUGIN_VERSION = "0.1"
|
2011-07-25 12:17:02 +02:00
|
|
|
PLUGIN_API_VERSIONS = ["0.9.0", "0.10", "0.15"]
|
2010-09-21 12:53:13 +02:00
|
|
|
|
|
|
|
from picard.metadata import register_album_metadata_processor
|
|
|
|
import re
|
|
|
|
|
|
|
|
_bonusdisc_re = re.compile(r"\s+\(bonus disc(?::\s+([^)]+))?\)")
|
|
|
|
|
|
|
|
def remove_bonusdiscs(tagger, metadata, release):
|
|
|
|
matches = _bonusdisc_re.search(metadata["album"])
|
|
|
|
if matches:
|
|
|
|
metadata["bonusdisc"] = "bonus"
|
|
|
|
if matches.group(1):
|
|
|
|
metadata["bonusdisctitle"] = matches.group(1)
|
|
|
|
metadata["album"] = _bonusdisc_re.sub('', metadata["album"])
|
|
|
|
|
|
|
|
register_album_metadata_processor(remove_bonusdiscs)
|