def __init__(self): super(CustomWrite, self).__init__() self.register_listener('write', self.loaded) self.register_listener('import_task_apply', self.choice) field = mediafile.MediaField( mediafile.MP3DescStorageStyle(u'customwrite'), mediafile.StorageStyle(u'customwrite')) self.add_media_field('customwrite', field)
def __init__(self): super(RecordingDatePlugin, self).__init__() for recording_field in (u'recording_year', u'recording_month', u'recording_day', u'recording_disambiguation'): field = mediafile.MediaField( mediafile.MP3DescStorageStyle(recording_field), mediafile.MP4StorageStyle( '----:com.apple.iTunes:{}'.format(recording_field)), mediafile.StorageStyle(recording_field)) self.add_media_field(recording_field, field)
def __init__(self): super(DiscogsData, self).__init__() self.item_types = {'performer': types.STRING} self.discogs_client = discogs_client.Client( 'github.com/SimonPersson/beets-plugins/0.1', user_token=self.config['token'].get()) self.separator = self.config['separator'].get() self.register_listener('album_imported', self.album_imported) try: self.add_media_field( 'performer', mediafile.MediaField(mediafile.StorageStyle('PERFORMER'))) except Exception: pass discogs_extra_init.func = self.all_album_init
def __init__(self): super(VTAlbumArtist, self).__init__() self.albumartist = None self.should_set = False self.register_listener('import_task_choice', self._import_after_apply) self.register_listener('write', self._before_write) field = mediafile.MediaField( mediafile.MP3DescStorageStyle(u'VT Album Artist'), mediafile.MP4StorageStyle(u'----:com.apple.iTunes:VT Album Artist'), mediafile.ASFStorageStyle(u'VT/Album Artist'), mediafile.StorageStyle(u'VT_ALBUMARTIST') ) self.add_media_field('vt_albumartist', field)
def __init__(self): super(DiscogsPlugin, self).__init__() self.config.add({ 'apikey': 'rAzVUQYRaoFjeBjyWuWZ', 'apisecret': 'plxtUTqoCzwxZpqdPysCwGuBSmZNdZVy', 'tokenfile': 'discogs_token.json', 'source_weight': 0.5, 'user_token': '', }) self.config['apikey'].redact = True self.config['apisecret'].redact = True self.config['user_token'].redact = True self.discogs_client = None self.register_listener('import_begin', self.setup) for style in [u'styleone', u'styletwo', u'stylethree']: field = mediafile.MediaField(mediafile.MP3DescStorageStyle(style), mediafile.StorageStyle(style)) self.add_media_field(style, field)
import os import six import shutil import unittest from test import _common from beets.library import Item from beets import mediafile from beets.plugins import BeetsPlugin from beets.util import bytestring_path field_extension = mediafile.MediaField( mediafile.MP3DescStorageStyle(u'customtag'), mediafile.MP4StorageStyle('----:com.apple.iTunes:customtag'), mediafile.StorageStyle('customtag'), mediafile.ASFStorageStyle('customtag'), ) class ExtendedFieldTestMixin(_common.TestCase): def _mediafile_fixture(self, name, extension='mp3'): name = bytestring_path(name + '.' + extension) src = os.path.join(_common.RSRC, name) target = os.path.join(self.temp_dir, name) shutil.copy(src, target) return mediafile.MediaFile(target) def test_extended_field_write(self): plugin = BeetsPlugin() plugin.add_media_field('customtag', field_extension)
def __init__(self): super(EventPlugin, self).__init__() event = mediafile.MediaField(mediafile.MP3DescStorageStyle(u'EVENT'), mediafile.StorageStyle('EVENT')) self.add_media_field('event', event)