mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
restore some comments from #684
I wanted to leave a few of these as comments -- they serve more as separators than as internal documentation.
This commit is contained in:
parent
8945e4fe75
commit
fb37be44db
9 changed files with 18 additions and 21 deletions
|
|
@ -108,9 +108,9 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
||||||
return [embed_cmd, extract_cmd, clear_cmd]
|
return [embed_cmd, extract_cmd, clear_cmd]
|
||||||
|
|
||||||
|
|
||||||
|
# 'embedart' command with --file argument.
|
||||||
|
|
||||||
def embed(lib, imagepath, query):
|
def embed(lib, imagepath, query):
|
||||||
"""'embedart' command with --file argument.
|
|
||||||
"""
|
|
||||||
albums = lib.albums(query)
|
albums = lib.albums(query)
|
||||||
for i_album in albums:
|
for i_album in albums:
|
||||||
album = i_album
|
album = i_album
|
||||||
|
|
@ -126,9 +126,9 @@ def embed(lib, imagepath, query):
|
||||||
config['embedart']['maxwidth'].get(int))
|
config['embedart']['maxwidth'].get(int))
|
||||||
|
|
||||||
|
|
||||||
|
# 'embedart' command without explicit file.
|
||||||
|
|
||||||
def embed_current(lib, query):
|
def embed_current(lib, query):
|
||||||
"""'embedart' command without explicit file.
|
|
||||||
"""
|
|
||||||
albums = lib.albums(query)
|
albums = lib.albums(query)
|
||||||
for album in albums:
|
for album in albums:
|
||||||
if not album.artpath:
|
if not album.artpath:
|
||||||
|
|
@ -142,9 +142,9 @@ def embed_current(lib, query):
|
||||||
config['embedart']['maxwidth'].get(int))
|
config['embedart']['maxwidth'].get(int))
|
||||||
|
|
||||||
|
|
||||||
|
# 'extractart' command.
|
||||||
|
|
||||||
def extract(lib, outpath, query):
|
def extract(lib, outpath, query):
|
||||||
"""'extractart' command.
|
|
||||||
"""
|
|
||||||
item = lib.items(query).get()
|
item = lib.items(query).get()
|
||||||
if not item:
|
if not item:
|
||||||
log.error('No item matches query.')
|
log.error('No item matches query.')
|
||||||
|
|
@ -178,9 +178,9 @@ def extract(lib, outpath, query):
|
||||||
f.write(art)
|
f.write(art)
|
||||||
|
|
||||||
|
|
||||||
|
# 'clearart' command.
|
||||||
|
|
||||||
def clear(lib, query):
|
def clear(lib, query):
|
||||||
"""'clearart' command.
|
|
||||||
"""
|
|
||||||
log.info('Clearing album art from items:')
|
log.info('Clearing album art from items:')
|
||||||
for item in lib.items(query):
|
for item in lib.items(query):
|
||||||
log.info(u'%s - %s' % (item.artist, item.title))
|
log.info(u'%s - %s' % (item.artist, item.title))
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,9 @@ class FetchArtPlugin(BeetsPlugin):
|
||||||
self.import_stages = [self.fetch_art]
|
self.import_stages = [self.fetch_art]
|
||||||
self.register_listener('import_task_files', self.assign_art)
|
self.register_listener('import_task_files', self.assign_art)
|
||||||
|
|
||||||
|
# Asynchronous; after music is added to the library.
|
||||||
def fetch_art(self, session, task):
|
def fetch_art(self, session, task):
|
||||||
"""Find art for the album being imported."""
|
"""Find art for the album being imported."""
|
||||||
# Asynchronous; after music is added to the library.
|
|
||||||
|
|
||||||
if task.is_album: # Only fetch art for full albums.
|
if task.is_album: # Only fetch art for full albums.
|
||||||
if task.choice_flag == importer.action.ASIS:
|
if task.choice_flag == importer.action.ASIS:
|
||||||
# For as-is imports, don't search Web sources for art.
|
# For as-is imports, don't search Web sources for art.
|
||||||
|
|
@ -285,10 +284,9 @@ class FetchArtPlugin(BeetsPlugin):
|
||||||
if path:
|
if path:
|
||||||
self.art_paths[task] = path
|
self.art_paths[task] = path
|
||||||
|
|
||||||
|
# Synchronous; after music files are put in place.
|
||||||
def assign_art(self, session, task):
|
def assign_art(self, session, task):
|
||||||
"""Place the discovered art in the filesystem."""
|
"""Place the discovered art in the filesystem."""
|
||||||
# Synchronous; after music files are put in place.
|
|
||||||
|
|
||||||
if task in self.art_paths:
|
if task in self.art_paths:
|
||||||
path = self.art_paths.pop(task)
|
path = self.art_paths.pop(task)
|
||||||
|
|
||||||
|
|
@ -300,9 +298,8 @@ class FetchArtPlugin(BeetsPlugin):
|
||||||
if src_removed:
|
if src_removed:
|
||||||
task.prune(path)
|
task.prune(path)
|
||||||
|
|
||||||
|
# Manual album art fetching.
|
||||||
def commands(self):
|
def commands(self):
|
||||||
# Manual album art fetching.
|
|
||||||
|
|
||||||
cmd = ui.Subcommand('fetchart', help='download album art')
|
cmd = ui.Subcommand('fetchart', help='download album art')
|
||||||
cmd.parser.add_option('-f', '--force', dest='force',
|
cmd.parser.add_option('-f', '--force', dest='force',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
|
|
|
||||||
|
|
@ -122,4 +122,4 @@ class InlinePlugin(BeetsPlugin):
|
||||||
log.debug(u'inline: adding album field %s' % key)
|
log.debug(u'inline: adding album field %s' % key)
|
||||||
func = compile_inline(view.get(unicode), True)
|
func = compile_inline(view.get(unicode), True)
|
||||||
if func is not None:
|
if func is not None:
|
||||||
self.album_template_fields[key] = func
|
self.album_template_fields[key] = func
|
||||||
|
|
|
||||||
|
|
@ -69,4 +69,4 @@ class KeyFinderPlugin(BeetsPlugin):
|
||||||
log.debug('added computed initial key {0} for {1}'
|
log.debug('added computed initial key {0} for {1}'
|
||||||
.format(key, util.displayable_path(item.path)))
|
.format(key, util.displayable_path(item.path)))
|
||||||
item.try_write()
|
item.try_write()
|
||||||
item.store()
|
item.store()
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,4 @@ class MusicBrainzCollectionPlugin(BeetsPlugin):
|
||||||
)
|
)
|
||||||
|
|
||||||
def commands(self):
|
def commands(self):
|
||||||
return [update_mb_collection_cmd]
|
return [update_mb_collection_cmd]
|
||||||
|
|
|
||||||
|
|
@ -151,4 +151,4 @@ class MBSyncPlugin(BeetsPlugin):
|
||||||
default=config['import']['write'], dest='write',
|
default=config['import']['write'], dest='write',
|
||||||
help="don't write updated metadata to files")
|
help="don't write updated metadata to files")
|
||||||
cmd.func = mbsync_func
|
cmd.func = mbsync_func
|
||||||
return [cmd]
|
return [cmd]
|
||||||
|
|
|
||||||
|
|
@ -348,4 +348,4 @@ class MPDStatsPlugin(plugins.BeetsPlugin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
cmd.func = func
|
cmd.func = func
|
||||||
return [cmd]
|
return [cmd]
|
||||||
|
|
|
||||||
|
|
@ -102,4 +102,4 @@ class ThePlugin(BeetsPlugin):
|
||||||
self._log.debug(u'[the] \"{0}\" -> \"{1}\"'.format(text, r))
|
self._log.debug(u'[the] \"{0}\" -> \"{1}\"'.format(text, r))
|
||||||
return r
|
return r
|
||||||
else:
|
else:
|
||||||
return u''
|
return u''
|
||||||
|
|
|
||||||
|
|
@ -89,4 +89,4 @@ class ZeroPlugin(BeetsPlugin):
|
||||||
|
|
||||||
if self.match_patterns(value, patterns):
|
if self.match_patterns(value, patterns):
|
||||||
log.debug(u'[zero] {0}: {1} -> None'.format(field, value))
|
log.debug(u'[zero] {0}: {1} -> None'.format(field, value))
|
||||||
setattr(item, field, None)
|
setattr(item, field, None)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue