My google-fu skills keep bring me to the old forums and I see no topics here regarding development. I am trying to write a plug-in that will delete all non-standard tags. My Python skills are weak - enough to be dangerous - but I am unsure if I am on the right path.
The following has been edited multiple times and I assume I have a Python error - which is why I cannot see my plug-in after install to enable - I have referred to the bundled plug-ins to see what I can learn. The following is the code so far;
PLUGIN_NAME = u'Cleanup Bad Tags'
PLUGIN_AUTHOR = u'Matthew A Snell'
PLUGIN_DESCRIPTION = '''Remove all non-standard tags. Keep standard tags inc musicbrainz_*, acouticid_*, musicip_* or _* '''
PLUGIN_VERSION = '0.1'
PLUGIN_API_VERSIONS = ["0.9.0", "0.10", "0.15", "0.16"]
from picard.metadata import register_album_metadata_processor, register_track_metadata_processor
_KEEPTAGS = [album, albumartist, albumartistsort, albumsort, arranger,
artist, artistsort, asin, barcode, bpm, catalognumber,
comment, compilation, composer, composersort, conductor,
copyright, date, discnumber, discsubtitle, djmixer,
encodedby, encodersettings, engineer, gapless, genre,
grouping, isrc, label, language, license, lyricist,
lyrics, media, mixer, mood, originaldate, originalyear,
performer, podcast, podcasturl, producer, releasecountry,
releasestatus, releasetype, remixer, script, show,
showsort, subtitle, title, titlesort, totaldiscs,
totaltracks, tracknumber, website, work, writer]
def strip_bad_tags(tagger, metadata):
for key, values in metadata.rawitems():
mainkey, subkey = key.split(':', 1)
if (key not in _KEEPTAGS:
if not key.startswith("musicbrainz_"):
if not key.startswith("acouticid_"):
if not key.startswith("musicip_"):
if not key == "~"):
def CleanupBadTagsAlbumProcessor(tagger, metadata, release):
def CleanupBadTagsTrackProcessor(tagger, metadata, track, release):
I have tried installing the plugin manually (in user plug-in directory) and through the Picard Install Plug-in interface.
I have checked the Initialization block for the plug-in multiple times and see no error. I have tried parsing metadata.keys() vs metadata.rawitems() plus other code changes to see if I can figure this out.
I assume it doesn't show because I have bad Python code, incorrect initialization in the plug-in header or not using the registration call correctly. I have tried doing the _KEEPTAGS list with & without quotes - keep thinking the bad code is there.
I have successfully made a variation of featartistsintitle.py plug-in which installs, is listed as a plug-in and works as expected.
Appreciate any input or guidance (or code improvements). Thanks.