From a58253b79c4c357978f1bed4cea1405092e43ef4 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 19 Jan 2012 12:43:29 -0800 Subject: [PATCH] "lyrics -p" prints out lyrics --- beetsplug/lyrics.py | 5 +++++ docs/plugins/lyrics.rst | 3 +++ 2 files changed, 8 insertions(+) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index c8e4e1e7b..3be569bed 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -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] diff --git a/docs/plugins/lyrics.rst b/docs/plugins/lyrics.rst index 70a521c98..417729fb1 100644 --- a/docs/plugins/lyrics.rst +++ b/docs/plugins/lyrics.rst @@ -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 -----------