"lyrics -p" prints out lyrics

This commit is contained in:
Adrian Sampson 2012-01-19 12:43:29 -08:00
parent 248a433d1d
commit a58253b79c
2 changed files with 8 additions and 0 deletions

View file

@ -157,6 +157,9 @@ AUTOFETCH = True
class LyricsPlugin(BeetsPlugin):
def commands(self):
cmd = ui.Subcommand('lyrics', help='fetch song lyrics')
cmd.parser.add_option('-p', '--print', dest='printlyr',
action='store_true', default=False,
help='print lyrics to console')
def func(lib, config, opts, args):
# The "write to files" option corresponds to the
# import_write config value.
@ -164,6 +167,8 @@ class LyricsPlugin(BeetsPlugin):
commands.DEFAULT_IMPORT_WRITE, bool)
for item in lib.items(ui.decargs(args)):
fetch_item_lyrics(lib, logging.INFO, item, write)
if opts.printlyr and item.lyrics:
ui.print_(item.lyrics)
cmd.func = func
return [cmd]

View file

@ -30,6 +30,9 @@ by that band, and ``beet lyrics`` will get lyrics for my entire library. The
lyrics will be added to the beets database and, if ``import_write`` is on,
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.
Configuring
-----------