diff --git a/data/css/style.css b/data/css/style.css index 9ff6003cb..17dec5e31 100755 --- a/data/css/style.css +++ b/data/css/style.css @@ -185,11 +185,11 @@ INPUT[type="radio"] } INPUT[type="checkbox"] { - vertical-align: bottom; + vertical-align: center; } .ie7 INPUT[type="checkbox"] { - vertical-align: baseline; + vertical-align: center; } .ie6 INPUT { @@ -849,7 +849,7 @@ TABLE#book_table } TABLE#book_table TH#select { - vertical-align: middle; + vertical-align: middle; text-align: center; width: 10px } diff --git a/data/interfaces/bookstrap/author.html b/data/interfaces/bookstrap/author.html index 0c513f514..2e9591519 100644 --- a/data/interfaces/bookstrap/author.html +++ b/data/interfaces/bookstrap/author.html @@ -128,10 +128,16 @@

${author[

 

+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'hidden' + %> - + @@ -176,7 +182,21 @@

${author[ return 'Cover';} }, { targets: [2], class: "hidden" }, { targets: [5], 'render': function(data, type, row) { - return 'Rating';} } + return 'Rating';} }, + { targets: [7], 'render': function(data, type, row) { + var btn = data + if ( btn == 'Open' ) { + btn = 'Open'} + else if ( btn == 'Wanted' ) { + btn = '

Wanted

Search

'} + else if ( btn == 'Snatched' ) { + btn = 'Snatched'} + else if ( btn == 'Have' ) { + btn = 'Have'} + else { + btn = '' + row[7] + ''} + return btn;} } ], "oLanguage": { "sLengthMenu":"_MENU_ rows per page", @@ -192,6 +212,11 @@

${author[ "aLengthMenu": [[5, 10, 15, 25, 50, 100, -1], [5, 10, 15, 25, 50, 100, "All"]], "iDisplayLength": ${lazylibrarian.CONFIG['DISPLAYLENGTH']}, "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } $('td', nRow).eq(1).addClass('text-center'); $('td', nRow).eq(5).addClass('text-center'); $('td', nRow).eq(6).addClass('text-center'); diff --git a/data/interfaces/bookstrap/books.html b/data/interfaces/bookstrap/books.html index abbf7dffd..f132f574d 100644 --- a/data/interfaces/bookstrap/books.html +++ b/data/interfaces/bookstrap/books.html @@ -50,10 +50,16 @@

${title}

 

Title Series
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'hidden' + %> - + @@ -103,7 +109,21 @@

${title}

{ targets: [2], 'render': function(data, type, row) { return '
' + data + '';} }, { targets: [5], 'render': function(data, type, row) { - return 'Rating';} } + return 'Rating';} }, + { targets: [7], 'render': function(data, type, row) { + var btn = data + if ( btn == 'Open' ) { + btn = 'Open'} + else if ( btn == 'Wanted' ) { + btn = '

Wanted

Search

'} + else if ( btn == 'Snatched' ) { + btn = 'Snatched'} + else if ( btn == 'Have' ) { + btn = 'Have'} + else { + btn = '' + row[7] + ''} + return btn;} } ], "oLanguage": { "sLengthMenu":"_MENU_ rows per page", @@ -120,6 +140,11 @@

${title}

"sAjaxSource": 'getBooks?source=Books&booklang=${booklang}', "bFilter": true, "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } $('td', nRow).eq(5).addClass('text-center'); $('td', nRow).eq(6).addClass('text-center'); $('td', nRow).eq(7).addClass('text-center'); diff --git a/data/interfaces/bookstrap/config.html b/data/interfaces/bookstrap/config.html index f8c435d84..95e82d9ff 100644 --- a/data/interfaces/bookstrap/config.html +++ b/data/interfaces/bookstrap/config.html @@ -72,7 +72,7 @@

${title}

%> + Enable https access to lazylibrarian
@@ -176,6 +176,61 @@

${title}

Appearance +
+ <% + if lazylibrarian.CONFIG['AUTHOR_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + +
+
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + +
+
+ <% + if lazylibrarian.CONFIG['MAG_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + +
+
+ <% + if lazylibrarian.CONFIG['SERIES_TAB'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + +
+
+ <% + if lazylibrarian.CONFIG['MAG_TAB'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + +
Author Title Series
+ <% + if lazylibrarian.CONFIG['AUTHOR_IMG'] == True: + hidden = '' + else: + hidden = 'hidden' + %> - + @@ -54,7 +60,7 @@

${title}

grade = 'X' %> - + diff --git a/data/interfaces/bookstrap/logs.html b/data/interfaces/bookstrap/logs.html index 537551221..fb140833e 100644 --- a/data/interfaces/bookstrap/logs.html +++ b/data/interfaces/bookstrap/logs.html @@ -18,7 +18,7 @@ <%def name="body()">

${title}

Refresh rate: - diff --git a/data/interfaces/bookstrap/managebooks.html b/data/interfaces/bookstrap/managebooks.html index 65f19a191..fecb8dbd1 100644 --- a/data/interfaces/bookstrap/managebooks.html +++ b/data/interfaces/bookstrap/managebooks.html @@ -36,10 +36,16 @@

${title}

ImageImage Author Latest Book Released
CoverCover ${author['AuthorName']} ${author['LastBook']} ${author['LastDate']}
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'hidden' + %> - + @@ -86,7 +92,7 @@

${title}

{ targets: [2], 'render': function(data, type, row) { return '' + data + '';} }, { targets: [5], 'render': function(data, type, row) { - return 'Rating';} } + return 'Rating';} } ], "oLanguage": { "sLengthMenu":"_MENU_ rows per page", @@ -102,6 +108,11 @@

${title}

"sAjaxSource": 'getBooks?whichStatus=${whichStatus}&source=Manage', "bFilter": true, "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } $('td', nRow).eq(0).addClass('text-center'); $('td', nRow).eq(1).addClass('text-center'); $('td', nRow).eq(5).addClass('text-center'); diff --git a/data/interfaces/default/author.html b/data/interfaces/default/author.html index fd8cba94d..3c87c9d33 100644 --- a/data/interfaces/default/author.html +++ b/data/interfaces/default/author.html @@ -108,9 +108,15 @@

Author Title Series
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'class="hidden"' + %> - + @@ -160,11 +166,26 @@ null, { "sType": "natural" }, { "fnRender": function ( oObj ) { - return 'Rating' + return 'Rating' } }, null, - null + { "fnRender": function ( oObj ) { + var btn = oObj.aData[7] + if ( btn == 'Open' ) { + btn = 'Open'} + else if ( btn == 'Wanted' ) { + btn = 'WantedSearch'} + else if ( btn == 'Snatched' ) { + btn = 'Snatched'} + else if ( btn == 'Have' ) { + btn = 'Have'} + else { + btn = '' + oObj.aData[7] + ''} + return btn + } + } ], "order": [[ 6, 'desc']], "oLanguage": { @@ -186,6 +207,11 @@ $('td', nRow).eq(2).addClass('hidden'); $('td', nRow).eq(6).addClass('center'); $('td', nRow).eq(7).addClass('center'); + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } var w = window.innerWidth; if ( w < 1024 ) { // hide stars,date on medium devices diff --git a/data/interfaces/default/books.html b/data/interfaces/default/books.html index 1c0808b04..4e601d3ed 100644 --- a/data/interfaces/default/books.html +++ b/data/interfaces/default/books.html @@ -42,10 +42,16 @@

  ${title}



CoverCover Title Series
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'class="hidden"' + %> - + @@ -105,11 +111,26 @@

  ${title}

null, null, { "fnRender": function ( oObj ) { - return 'Rating' + return 'Rating' } }, null, - null + { "fnRender": function ( oObj ) { + var btn = oObj.aData[7] + if ( btn == 'Open' ) { + btn = 'Open'} + else if ( btn == 'Wanted' ) { + btn = 'WantedSearch'} + else if ( btn == 'Snatched' ) { + btn = 'Snatched'} + else if ( btn == 'Have' ) { + btn = 'Have'} + else { + btn = '' + oObj.aData[7] + ''} + return btn + } + } ], "oLanguage": { "sLengthMenu":"Show _MENU_ books per page", @@ -126,9 +147,16 @@

  ${title}

"bFilter": true, "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { $(nRow).addClass("gradeZ"); + $('td', nRow).eq(0).addClass('center'); + $('td', nRow).eq(1).addClass('center'); $('td', nRow).eq(5).addClass('center'); $('td', nRow).eq(6).addClass('center'); $('td', nRow).eq(7).addClass('center'); + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } var w = window.innerWidth; if ( w < 1024 ) { // hide stars,date on medium devices diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index c43df3d0f..6a0b661b5 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -60,7 +60,7 @@

  ${title}

%>
- +

@@ -133,6 +133,52 @@

  ${title}


Current API key: ${lazylibrarian.CONFIG['API_KEY']}
+
Appearance
+ <% + if lazylibrarian.CONFIG['AUTHOR_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + + +
+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + + +
+ <% + if lazylibrarian.CONFIG['MAG_IMG'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + + +
+ <% + if lazylibrarian.CONFIG['SERIES_TAB'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + + +
+ <% + if lazylibrarian.CONFIG['MAG_TAB'] == True: + checked = 'checked="checked"' + else: + checked = '' + %> + + +
Interface:
CoverCover Author Title Series
+ <% + if lazylibrarian.CONFIG['AUTHOR_IMG'] == True: + hidden = '' + else: + hidden = 'class="hidden"' + %> - + @@ -55,7 +61,7 @@

  ${title}

%> - + diff --git a/data/interfaces/default/magazines.html b/data/interfaces/default/magazines.html index 5f7078def..1649a0765 100644 --- a/data/interfaces/default/magazines.html +++ b/data/interfaces/default/magazines.html @@ -37,7 +37,7 @@

  ${title}

-
ImageImage Author Latest Book Released
CoverCover ${author['AuthorName']} ${author['LastBook']}
+
diff --git a/data/interfaces/default/managebooks.html b/data/interfaces/default/managebooks.html index 040335c0c..10623e07e 100644 --- a/data/interfaces/default/managebooks.html +++ b/data/interfaces/default/managebooks.html @@ -32,10 +32,16 @@

  ${title}



+ <% + if lazylibrarian.CONFIG['BOOK_IMG'] == True: + hidden = '' + else: + hidden = 'class="hidden"' + %> - + @@ -80,13 +86,13 @@

  ${title}


} }, { "fnRender": function ( oObj ) { - return '' + oObj.aData[2] + '' + return '' + oObj.aData[2] + '' } }, null, null, { "fnRender": function ( oObj ) { - return 'Rating' + return 'Rating' } }, null @@ -109,6 +115,11 @@

  ${title}


$('td', nRow).eq(0).addClass('center'); $('td', nRow).eq(5).addClass('center'); $('td', nRow).eq(6).addClass('center'); + var show = ${lazylibrarian.CONFIG['BOOK_IMG']}; + if ( show != '1' ) + { + $('td', nRow).eq(1).addClass('hidden'); + } var w = window.innerWidth; if ( w < 1024 ) { // hide stars,date on medium devices diff --git a/data/interfaces/default/members.html b/data/interfaces/default/members.html index 7fd942e95..e1dd6e809 100644 --- a/data/interfaces/default/members.html +++ b/data/interfaces/default/members.html @@ -56,7 +56,7 @@

  ${series['AuthorName']} : ${title}

%for result in members: - + %if multi == "True": diff --git a/lazylibrarian/__init__.py b/lazylibrarian/__init__.py index 2c2af3763..d005eeaab 100644 --- a/lazylibrarian/__init__.py +++ b/lazylibrarian/__init__.py @@ -27,7 +27,7 @@ import cherrypy from lazylibrarian import logger, postprocess, searchnzb, searchtorrents, searchrss, \ - librarysync, versioncheck, database, searchmag, magazinescan, bookwork + librarysync, versioncheck, database, searchmag, magazinescan, bookwork, importer from lazylibrarian.cache import fetchURL from lazylibrarian.common import restartJobs from lazylibrarian.formatter import getList, bookSeries, plural, unaccented @@ -104,6 +104,8 @@ # Not all are accessible from the web ui # Any undefined on startup will be set to the default value # Any _NOT_ in the web ui will remain unchanged on config save +CONFIG_NONWEB = ['LOGFILES', 'LOGSIZE', 'NAME_POSTFIX', 'GIT_REPO', 'GIT_USER', 'GIT_BRANCH', 'LATEST_VERSION', + 'CURRENT_VERSION', 'COMMITS_BEHIND', 'INSTALL_TYPE', 'DIR_PERM', 'FILE_PERM'] CONFIG_DEFINITIONS = { # Name Type Section Default 'LOGDIR': ('str', 'General', ''), @@ -128,6 +130,11 @@ 'HTTPS_KEY': ('str', 'General', ''), 'BOOKSTRAP_THEME': ('str', 'General', 'slate'), 'MAG_SINGLE': ('bool', 'General', 1), + 'AUTHOR_IMG': ('bool', 'General', 1), + 'BOOK_IMG': ('bool', 'General', 1), + 'MAG_IMG': ('bool', 'General', 1), + 'SERIES_TAB': ('bool', 'General', 1), + 'MAG_TAB': ('bool', 'General', 1), 'LAUNCH_BROWSER': ('bool', 'General', 1), 'API_ENABLED': ('bool', 'General', 0), 'API_KEY': ('str', 'General', ''), @@ -370,7 +377,8 @@ def initialize(): global FULL_PATH, PROG_DIR, ARGS, DAEMON, SIGNAL, PIDFILE, DATADIR, CONFIGFILE, SYS_ENCODING, LOGLEVEL, \ CONFIG, CFG, DBFILE, COMMIT_LIST, SCHED, INIT_LOCK, __INITIALIZED__, started, LOGLIST, LOGFULL, \ UPDATE_MSG, CURRENT_TAB, CACHE_HIT, CACHE_MISS, LAST_LIBRARYTHING, LAST_GOODREADS, SHOW_SERIES, \ - SHOW_MAGS, CACHEDIR, BOOKSTRAP_THEMELIST, MONTHNAMES, CONFIG_DEFINITIONS, isbn_979_dict, isbn_978_dict + SHOW_MAGS, CACHEDIR, BOOKSTRAP_THEMELIST, MONTHNAMES, CONFIG_DEFINITIONS, isbn_979_dict, isbn_978_dict, \ + CONFIG_NONWEB with INIT_LOCK: @@ -450,7 +458,7 @@ def initialize(): def config_read(reloaded=False): - global CONFIG, CONFIG_DEFINITIONS, NEWZNAB_PROV, TORZNAB_PROV, RSS_PROV, SHOW_SERIES, SHOW_MAGS + global CONFIG, CONFIG_DEFINITIONS, CONFIG_NONWEB, NEWZNAB_PROV, TORZNAB_PROV, RSS_PROV, SHOW_SERIES, SHOW_MAGS # legacy name conversions, separate out host/port for provider in ['NZBGet', 'UTORRENT', 'QBITTORRENT', 'TRANSMISSION']: @@ -656,7 +664,12 @@ def config_write(): SHOW_SERIES = len(series_list) if CONFIG['ADD_SERIES']: SHOW_SERIES = 1 + if not CONFIG['SERIES_TAB']: + SHOW_SERIES = 0 + SHOW_MAGS = len(CONFIG['MAG_DEST_FOLDER']) + if not CONFIG['MAG_TAB']: + SHOW_MAGS = 0 msg = None try: @@ -996,7 +1009,7 @@ def launch_browser(host, port, root): logger.error('Could not launch browser: %s' % str(e)) def start(): - global __INITIALIZED__, started + global __INITIALIZED__, started, SHOW_SERIES, SHOW_MAGS if __INITIALIZED__: # Crons and scheduled jobs started here diff --git a/lazylibrarian/bencode.py b/lazylibrarian/bencode.py index cdf40f1c6..eeb7eb216 100644 --- a/lazylibrarian/bencode.py +++ b/lazylibrarian/bencode.py @@ -28,7 +28,7 @@ def stringlength(string, index = 0): try: colon = string.find(":", index) # Find the colon, ending the number. except ValueError: - raise BencodeError("Decode", "Malformed expression", data) + raise BencodeError("Decode", "Malformed expression", string) # Return a list of the number characters. num = [a for a in string[index:colon] if a.isdigit() ] diff --git a/lazylibrarian/cache.py b/lazylibrarian/cache.py index bf1ea93d5..871762a21 100644 --- a/lazylibrarian/cache.py +++ b/lazylibrarian/cache.py @@ -130,18 +130,20 @@ def get_cached_request(url, useCache=True, cache="XML"): if cache == "JSON": try: source = json.load(open(hashfilename)) - except Exception as e: + except Exception: logger.warn(u"Error decoding json from %s" % hashfilename) - logger.debug(u"%s : %s" % (e, result)) return None, False elif cache == "XML": with open(hashfilename, "r") as cachefile: result = cachefile.read() - try: - source = ElementTree.fromstring(result) - except Exception as e: - logger.warn(u"Error parsing xml from %s" % hashfilename) - logger.debug(u"%s : %s" % (e, result)) + if result and result.startswith('= 4.5: - starimg = '5-stars.png' - else: - starimg = '0-stars.png' + bookrate = int(round(float(row[3]))) + if bookrate > 5: + bookrate = 5 if row[10] and len(row[10]) > 4: # is there a workpage link worklink = 'LibraryThing' @@ -708,37 +694,8 @@ def getBooks(self, iDisplayStart=0, iDisplayLength=100, iSortCol_0=0, sSortDir_0 title = row[2] title = title + '
' + sitelink + ' ' + worklink + ' ' + editpage - # for each Row use a separate list - l = [row[6], row[0], row[1], title, row[12], starimg, row[4]] - # Do not show status column in MANAGE page as we are only showing one status - if not kwargs['source'] == "Manage": - if lazylibrarian.CONFIG['HTTP_LOOK'] == 'bookstrap': - if row[5] == 'Open': - btn = '%s' % row[5] - elif row[5] == 'Wanted': - btn = '

%s' % row[5] - btn += '

CoverCover Author Title Series
Cover ${result['BookName']}