mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 13:02:47 +01:00
merge Bitdemon-master
- minor style changes - synchronize with documentation
This commit is contained in:
commit
9b75db8326
2 changed files with 14 additions and 7 deletions
|
|
@ -396,12 +396,15 @@ class LyricsPlugin(BeetsPlugin):
|
|||
cmd.parser.add_option('-p', '--print', dest='printlyr',
|
||||
action='store_true', default=False,
|
||||
help='print lyrics to console')
|
||||
cmd.parser.add_option('-f', '--force', dest='force_refetch',
|
||||
action='store_true', default=False,
|
||||
help='forces the plugin to redownload lyrics')
|
||||
def func(lib, opts, args):
|
||||
# The "write to files" option corresponds to the
|
||||
# import_write config value.
|
||||
write = config['import']['write'].get(bool)
|
||||
for item in lib.items(ui.decargs(args)):
|
||||
self.fetch_item_lyrics(lib, logging.INFO, item, write)
|
||||
self.fetch_item_lyrics(lib, logging.INFO, item, write, opts.force_refetch)
|
||||
if opts.printlyr and item.lyrics:
|
||||
ui.print_(item.lyrics)
|
||||
cmd.func = func
|
||||
|
|
@ -411,9 +414,9 @@ class LyricsPlugin(BeetsPlugin):
|
|||
def imported(self, session, task):
|
||||
if self.config['auto']:
|
||||
for item in task.imported_items():
|
||||
self.fetch_item_lyrics(session.lib, logging.DEBUG, item, False)
|
||||
self.fetch_item_lyrics(session.lib, logging.DEBUG, item, False, False)
|
||||
|
||||
def fetch_item_lyrics(self, lib, loglevel, item, write):
|
||||
def fetch_item_lyrics(self, lib, loglevel, item, write, force):
|
||||
"""Fetch and store lyrics for a single item. If ``write``, then the
|
||||
lyrics will also be written to the file itself. The ``loglevel``
|
||||
parameter controls the visibility of the function's status log
|
||||
|
|
@ -422,10 +425,11 @@ class LyricsPlugin(BeetsPlugin):
|
|||
fallback = self.config['fallback'].get()
|
||||
|
||||
# Skip if the item already has lyrics.
|
||||
if item.lyrics:
|
||||
log.log(loglevel, u'lyrics already present: %s - %s' %
|
||||
(item.artist, item.title))
|
||||
return
|
||||
if not force:
|
||||
if item.lyrics:
|
||||
log.log(loglevel, u'lyrics already present: %s - %s' %
|
||||
(item.artist, item.title))
|
||||
return
|
||||
|
||||
# Fetch lyrics.
|
||||
lyrics = self.get_lyrics(item.artist, item.title)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ embedded into files' metadata.
|
|||
The ``-p`` option to the ``lyrics`` command makes it print lyrics out to the
|
||||
console so you can view the fetched (or previously-stored) lyrics.
|
||||
|
||||
The ``-f`` option to the ``lyrics`` command forces it to fetch previously
|
||||
downloaded lyrics.
|
||||
|
||||
|
||||
Configuring
|
||||
-----------
|
||||
|
|
|
|||
Loading…
Reference in a new issue