def __init__(self, config): config.add({ 'command': u"", 'noclip': True, }) self.command = config["command"].get(unicode) if self.command: # Explicit executable path. if not os.path.isfile(self.command): raise FatalReplayGainError( 'replaygain command does not exist: {0}'.format( self.command)) else: # Check whether the program is in $PATH. for cmd in ('mp3gain', 'aacgain'): try: call([cmd, '-v']) self.command = cmd except OSError: pass if not self.command: raise FatalReplayGainError( 'no replaygain command found: install mp3gain or aacgain') self.noclip = config['noclip'].get(bool) target_level = config['targetlevel'].as_number() self.gain_offset = int(target_level - 89)
def __init__(self, config): config.add({ 'command': u"", 'noclip': True, }) self.command = config["command"].get(unicode) if self.command: # Explicit executable path. if not os.path.isfile(self.command): raise FatalReplayGainError( 'replaygain command does not exist: {0}'.format( self.command ) ) else: # Check whether the program is in $PATH. for cmd in ('mp3gain', 'aacgain'): try: call([cmd, '-v']) self.command = cmd except OSError: pass if not self.command: raise FatalReplayGainError( 'no replaygain command found: install mp3gain or aacgain' ) self.noclip = config['noclip'].get(bool) target_level = config['targetlevel'].as_number() self.gain_offset = int(target_level - 89)
def __init__(self): super(SavedFormatsPlugin, self).__init__() config.add({ "item_formats": {}, "album_formats": {}, }) self.cache = defaultdict(lambda: defaultdict(dict)) self.register_listener("database_change", self.database_change) self.register_listener("item_removed", self.item_removed) self.set_template_fields()
def __init__(self): super(InlinePlugin, self).__init__() config.add({ 'pathfields': {}, }) # Add field expressions. for key, view in config['pathfields'].items(): log.debug(u'adding template field %s' % key) func = compile_inline(view.get(unicode)) if func is not None: self.template_fields[key] = func
def __init__(self): super(InlinePlugin, self).__init__() config.add({"pathfields": {}, "item_fields": {}, "album_fields": {}}) # Legacy name. # Item fields. for key, view in itertools.chain(config["item_fields"].items(), config["pathfields"].items()): self._log.debug(u"adding item field {0}", key) func = self.compile_inline(view.as_str(), False) if func is not None: self.template_fields[key] = func # Album fields. for key, view in config["album_fields"].items(): self._log.debug(u"adding album field {0}", key) func = self.compile_inline(view.as_str(), True) if func is not None: self.album_template_fields[key] = func
def __init__(self): super(SavedQueriesPlugin, self).__init__() self.config.add({ 'add_fields': True, }) config.add({ 'item_queries': {}, 'album_queries': {}, }) self.item_query_objects = FactoryDict(self.parse_item_query) self.album_query_objects = FactoryDict(self.parse_album_query) class ItemSavedQuery(SavedQuery): queries = self.item_query_objects class AlbumSavedQuery(SavedQuery): queries = self.album_query_objects self._log.debug('adding named item query `query`') self.item_queries = {'query': ItemSavedQuery} self._log.debug('adding named album query `album_query`') self.album_queries = {'album_query': AlbumSavedQuery} if self.config['add_fields'].get(): self.item_types = {} self.template_fields = {} for name in config['item_queries'].keys(): self._log.debug('adding item field {}', name) self.item_types[name] = types.BOOLEAN self.template_fields[ name] = lambda item, name=name: self.item_query_objects[ name].match(item) self.album_types = {} self.album_template_fields = {} for name in config['album_queries'].keys(): self._log.debug('adding album field {}', name) self.album_types[name] = types.BOOLEAN self.album_template_fields[ name] = lambda album, name=name: self.album_query_objects[ name].match(album)
def __init__(self, config, log): super(Bs1770gainBackend, self).__init__(config, log) config.add({ 'chunk_at': 5000, 'method': 'replaygain', }) self.chunk_at = config['chunk_at'].as_number() self.method = b'--' + bytes(config['method'].get(unicode)) cmd = b'bs1770gain' try: call([cmd, self.method]) self.command = cmd except OSError: raise FatalReplayGainError( 'Is bs1770gain installed? Is your method in config correct?') if not self.command: raise FatalReplayGainError( 'no replaygain command found: install bs1770gain')
def __init__(self, config, log): super(Bs1770gainBackend, self).__init__(config, log) config.add({ 'chunk_at': 5000, 'method': 'replaygain', }) self.chunk_at = config['chunk_at'].as_number() self.method = b'--' + bytes(config['method'].get(unicode)) cmd = b'bs1770gain' try: call([cmd, self.method]) self.command = cmd except OSError: raise FatalReplayGainError( 'Is bs1770gain installed? Is your method in config correct?' ) if not self.command: raise FatalReplayGainError( 'no replaygain command found: install bs1770gain' )
def __init__(self): super(InlinePlugin, self).__init__() config.add({ 'pathfields': {}, # Legacy name. 'item_fields': {}, 'album_fields': {}, }) # Item fields. for key, view in itertools.chain(config['item_fields'].items(), config['pathfields'].items()): self._log.debug(u'adding item field {0}', key) func = self.compile_inline(view.as_str(), False) if func is not None: self.template_fields[key] = func # Album fields. for key, view in config['album_fields'].items(): self._log.debug(u'adding album field {0}', key) func = self.compile_inline(view.as_str(), True) if func is not None: self.album_template_fields[key] = func
def __init__(self): super(InlinePlugin, self).__init__() config.add({ 'pathfields': {}, # Legacy name. 'item_fields': {}, 'album_fields': {}, }) # Item fields. for key, view in itertools.chain(config['item_fields'].items(), config['pathfields'].items()): self._log.debug(u'adding item field {0}', key) func = self.compile_inline(view.get(unicode), False) if func is not None: self.template_fields[key] = func # Album fields. for key, view in config['album_fields'].items(): self._log.debug(u'adding album field {0}', key) func = self.compile_inline(view.get(unicode), True) if func is not None: self.album_template_fields[key] = func