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:
Adrian Sampson 2014-04-13 17:43:43 -07:00
parent 8945e4fe75
commit fb37be44db
9 changed files with 18 additions and 21 deletions

View file

@ -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))

View file

@ -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)
def commands(self):
# Manual album art fetching. # Manual album art fetching.
def commands(self):
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,