diff --git a/man/booblyrics.1 b/man/booblyrics.1 new file mode 100644 index 00000000..0dd8174a --- /dev/null +++ b/man/booblyrics.1 @@ -0,0 +1,224 @@ +.TH BOOBLYRICS 1 "08 March 2013" "booblyrics 0\&.f" +.SH NAME +booblyrics \- search and display song lyrics +.SH SYNOPSIS +.B booblyrics +[\-dqv] [\-b \fIbackends\fR] [\-cnfs] [\fIcommand\fR [\fIarguments\fR..]] +.br +.B booblyrics +[\-\-help] [\-\-version] + +.SH DESCRIPTION +.LP + +Console application allowing to search for song lyrics on various websites. + +.SS Supported websites: +* seeklyrics (SeekLyrics lyrics website) +.br +.SH BOOBLYRICS COMMANDS +.TP +\fBget\fR \fIID\fR +.br +Display lyrics of the song. +.TP +\fBsearch\fR [\fIPATTERN\fR] +.br +Search lyrics. +.SH WEBOOB COMMANDS +.TP +\fBbackends\fR [\fIACTION\fR] [\fIBACKEND_NAME\fR]... +.br +Select used backends. +.br + +.br +ACTION is one of the following (default: list): +.br +* enable enable given backends +.br +* disable disable given backends +.br +* only enable given backends and disable the others +.br +* list list backends +.br +* add add a backend +.br +* register register a new account on a website +.br +* edit edit a backend +.br +* remove remove a backend +.br +* list\-modules list modules +.TP +\fBcd\fR [\fIPATH\fR] +.br +Follow a path. +.br +".." is a special case and goes up one directory. +.br +"" is a special case and goes home. +.TP +\fBcondition\fR [\fIEXPRESSION\fR | off] +.br +If an argument is given, set the condition expression used to filter the results. +.br +If the "off" value is given, conditional filtering is disabled. +.br + +.br +If no argument is given, print the current condition expression. +.TP +\fBcount\fR [\fINUMBER\fR | off] +.br +If an argument is given, set the maximum number of results fetched. +.br +NUMBER must be at least 1. +.br +"off" value disables counting, and allows infinite searches. +.br + +.br +If no argument is given, print the current count value. +.TP +\fBformatter\fR [list | \fIFORMATTER\fR [\fICOMMAND\fR] | option \fIOPTION_NAME\fR [on | off]] +.br +If a FORMATTER is given, set the formatter to use. +.br +You can add a COMMAND to apply the formatter change only to +.br +a given command. +.br + +.br +If the argument is "list", print the available formatters. +.br + +.br +If the argument is "option", set the formatter options. +.br +Valid options are: header, keys. +.br +If on/off value is given, set the value of the option. +.br +If not, print the current value for the option. +.br + +.br +If no argument is given, print the current formatter. +.TP +\fBinspect\fR \fIBACKEND_NAME\fR +.br +Display the HTML string of the current page of the specified backend's browser. +.br + +.br +If webkit_mechanize_browser Python module is installed, HTML is displayed in a WebKit GUI. +.TP +\fBlogging\fR [\fILEVEL\fR] +.br +Set logging level. +.br + +.br +Availables: debug, info, warning, error. +.br +* quiet is an alias for error +.br +* default is an alias for warning +.TP +\fBls\fR [\-d] [\fIPATH\fR] +.br +List objects in current path. +.br +If an argument is given, list the specified path. +.TP +\fBquit\fR +.br +Quit the application. +.TP +\fBselect\fR [\fIFIELD_NAME\fR]... | "$direct" | "$full" +.br +If an argument is given, set the selected fields. +.br +$direct selects all fields loaded in one http request. +.br +$full selects all fields using as much http requests as necessary. +.br + +.br +If no argument is given, print the currently selected fields. + +.SH OPTIONS +.TP +\fB\-\-version\fR +show program's version number and exit +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.TP +\fB\-b BACKENDS\fR, \fB\-\-backends=BACKENDS\fR +what backend(s) to enable (comma separated) +.TP +\fB\-e EXCLUDE_BACKENDS\fR, \fB\-\-exclude\-backends=EXCLUDE_BACKENDS\fR +what backend(s) to exclude (comma separated) +.TP +\fB\-I\fR, \fB\-\-insecure\fR +do not validate SSL + +.SH LOGGING OPTIONS +.TP +\fB\-d\fR, \fB\-\-debug\fR +display debug messages +.TP +\fB\-q\fR, \fB\-\-quiet\fR +display only error messages +.TP +\fB\-v\fR, \fB\-\-verbose\fR +display info messages +.TP +\fB\-\-logging\-file=LOGGING_FILE\fR +file to save logs +.TP +\fB\-a\fR, \fB\-\-save\-responses\fR +save every response + +.SH RESULTS OPTIONS +.TP +\fB\-c CONDITION\fR, \fB\-\-condition=CONDITION\fR +filter result items to display given a boolean expression +.TP +\fB\-n COUNT\fR, \fB\-\-count=COUNT\fR +get a maximum number of results (all backends merged) +.TP +\fB\-s SELECT\fR, \fB\-\-select=SELECT\fR +select result item keys to display (comma separated) + +.SH FORMATTING OPTIONS +.TP +\fB\-f FORMATTER\fR, \fB\-\-formatter=FORMATTER\fR +select output formatter (csv, htmltable, multiline, simple, table, torrent_info, +torrent_list, webkit) +.TP +\fB\-\-no\-header\fR +do not display header +.TP +\fB\-\-no\-keys\fR +do not display item keys +.TP +\fB\-O OUTFILE\fR, \fB\-\-outfile=OUTFILE\fR +file to export result + +.SH COPYRIGHT +Copyright(C) 2010-2012 Romain Bignon +.LP +For full COPYRIGHT see COPYING file with weboob package. +.LP +.RE +.SH FILES +"~/.config/weboob/backends" + +.SH SEE ALSO +Home page: http://weboob.org/applications/weboorrents diff --git a/modules/seeklyrics/backend.py b/modules/seeklyrics/backend.py index d632c82c..58f200a1 100644 --- a/modules/seeklyrics/backend.py +++ b/modules/seeklyrics/backend.py @@ -43,4 +43,4 @@ class SeeklyricsBackend(BaseBackend, ICapLyrics): return self.browser.get_lyrics(id) def iter_lyrics(self, pattern): - return self.browser.iter_lyrics(quote_plus(pattern.encode('utf-8'))) + return self.browser.iter_lyrics(quote_plus(pattern.encode('iso-8859-1'))) diff --git a/modules/seeklyrics/test.py b/modules/seeklyrics/test.py index b40946e0..d54f1e36 100644 --- a/modules/seeklyrics/test.py +++ b/modules/seeklyrics/test.py @@ -23,7 +23,7 @@ from weboob.capabilities.base import NotLoaded class SeeklyricsTest(BackendTest): BACKEND = 'seeklyrics' - def test_search(self): + def test_search_n_get(self): l_lyrics = list(self.backend.iter_lyrics('Complainte')) for songlyrics in l_lyrics: assert songlyrics.id diff --git a/weboob/applications/booblyrics/booblyrics.py b/weboob/applications/booblyrics/booblyrics.py index b92f5d32..e8f14df2 100644 --- a/weboob/applications/booblyrics/booblyrics.py +++ b/weboob/applications/booblyrics/booblyrics.py @@ -27,10 +27,10 @@ from weboob.capabilities.base import NotAvailable,NotLoaded from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter -__all__ = ['Booblyrics'] +__all__ = ['Booblyrics','LyricsGetFormatter','LyricsListFormatter'] -class LyricsInfoFormatter(IFormatter): +class LyricsGetFormatter(IFormatter): MANDATORY_FIELDS = ('id', 'title', 'artist', 'content') def format_obj(self, obj, alias): @@ -64,22 +64,22 @@ class Booblyrics(ReplApplication): SHORT_DESCRIPTION = "search and display song lyrics" CAPS = ICapLyrics EXTRA_FORMATTERS = {'lyrics_list': LyricsListFormatter, - 'lyrics_info': LyricsInfoFormatter, + 'lyrics_get': LyricsGetFormatter, } COMMANDS_FORMATTERS = {'search': 'lyrics_list', - 'info': 'lyrics_info', + 'get': 'lyrics_get', } - def complete_info(self, text, line, *ignored): + def complete_get(self, text, line, *ignored): args = line.split(' ') if len(args) == 2: return self._complete_object() - def do_info(self, id): + def do_get(self, id): """ - info ID + get ID - Get information about song lyrics. + Display lyrics of the song. """ # TODO restore get_object line and handle fillobj