"""The track number as an int.""" try: return int(self.metadata["tracknumber"]) except BaseException: return 0 @property def discnumber(self): """The disc number as an int.""" try: return int(self.metadata["discnumber"]) except BaseException: return 0 _file_post_addition_to_track_processors = PluginFunctions(label='file_post_addition_to_track_processors') _file_post_removal_from_track_processors = PluginFunctions(label='file_post_removal_from_track_processors') _file_post_save_processors = PluginFunctions(label='file_post_save_processors') def register_file_post_addition_to_track_processor(function, priority=PluginPriority.NORMAL): """Registers a file-added-to-track processor. Args: function: function to call after file addition, it will be passed the track and file objects priority: optional, PluginPriority.NORMAL by default Returns: None """ _file_post_addition_to_track_processors.register(function.__module__, function, priority)
return self.__write('__delitem__', name) def __iter__(self): return self.__read('__iter__') def __len__(self): return self.__read('__len__') def __contains__(self, name): return self.__read('__contains__', name) def __repr__(self): return self.__read('__repr__') _album_metadata_processors = PluginFunctions(label='album_metadata_processors') _track_metadata_processors = PluginFunctions(label='track_metadata_processors') def register_album_metadata_processor(function, priority=PluginPriority.NORMAL): """Registers new album-level metadata processor.""" _album_metadata_processors.register(function.__module__, function, priority) def register_track_metadata_processor(function, priority=PluginPriority.NORMAL): """Registers new track-level metadata processor.""" _track_metadata_processors.register(function.__module__, function, priority) def run_album_metadata_processors(album_object, metadata, release): _album_metadata_processors.run(album_object, metadata, release)
def strip_whitespace(self): """Strip leading/trailing whitespace. >>> m = Metadata() >>> m["foo"] = " bar " >>> m["foo"] " bar " >>> m.strip_whitespace() >>> m["foo"] "bar" """ self.apply_func(lambda s: s.strip()) _album_metadata_processors = PluginFunctions() _track_metadata_processors = PluginFunctions() def register_album_metadata_processor(function, priority=PluginPriority.NORMAL): """Registers new album-level metadata processor.""" _album_metadata_processors.register(function.__module__, function, priority) def register_track_metadata_processor(function, priority=PluginPriority.NORMAL): """Registers new track-level metadata processor.""" _track_metadata_processors.register(function.__module__, function, priority) def run_album_metadata_processors(album_object, metadata, release): _album_metadata_processors.run(album_object, metadata, release)
for file in track.linked_files: track.update_file_metadata(file) self.enable_update_metadata_images(True) super().update(update_tracks) def _finalize_loading(self, error): self.update() def can_refresh(self): return False def can_browser_lookup(self): return False _album_post_removal_processors = PluginFunctions(label='album_post_removal_processors') def register_album_post_removal_processor(function, priority=PluginPriority.NORMAL): """Registers an album-removed processor. Args: function: function to call after album removal, it will be passed the album object priority: optional, PluginPriority.NORMAL by default Returns: None """ _album_post_removal_processors.register(function.__module__, function, priority) def run_album_post_removal_processors(album_object): _album_post_removal_processors.run(album_object)