Skip to content

Commit

Permalink
Allow disable author and book images
Browse files Browse the repository at this point in the history
  • Loading branch information
philborman committed May 9, 2017
1 parent 749e4b1 commit 58a0ada
Show file tree
Hide file tree
Showing 22 changed files with 159 additions and 36 deletions.
13 changes: 12 additions & 1 deletion data/interfaces/bookstrap/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,16 @@ <h1><a href="${author['AuthorLink']}" target="_blank" rel="noreferrer">${author[
<p>&nbsp;</p>
<div class="table-responsive">
<table class="display table table-striped table-hover table-bordered" id="book_table">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'hidden'
%>
<thead>
<tr>
<th class="select no-sort"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th class="bookart text-center no-sort hidden-xs">Cover</th>
<th class="bookart text-center no-sort hidden-xs ${hidden}">Cover</th>
<th class="authorname hidden">Author</th>
<th class="bookname">Title</th>
<th class="series">Series</th>
Expand Down Expand Up @@ -206,6 +212,11 @@ <h1><a href="${author['AuthorLink']}" target="_blank" rel="noreferrer">${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');
Expand Down
13 changes: 12 additions & 1 deletion data/interfaces/bookstrap/books.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ <h1>${title}</h1>
<p>&nbsp;</p>
<div class="table-responsive">
<table class="display table table-striped table-hover table-bordered" id="book_table">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'hidden'
%>
<thead>
<tr>
<th class="select no-sort"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th class="bookart text-center no-sort hidden-xs">Cover</th>
<th class="bookart text-center no-sort hidden-xs ${hidden}">Cover</th>
<th class="authorname">Author</th>
<th class="bookname">Title</th>
<th class="series">Series</th>
Expand Down Expand Up @@ -134,6 +140,11 @@ <h1>${title}</h1>
"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');
Expand Down
22 changes: 22 additions & 0 deletions data/interfaces/bookstrap/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,28 @@ <h1>${title}</h1>
</fieldset>
<fieldset>
<legend>Appearance</legend>
<div class="checkbox">
<%
if lazylibrarian.CONFIG['AUTHOR_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<label for="author_img" class="control-label">
<input type="checkbox" id="author_img" name="author_img" value="1" ${checked} />
Show Author Images</label>
</div>
<div class="checkbox">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<label for="book_img" class="control-label">
<input type="checkbox" id="book_img" name="book_img" value="1" ${checked} />
Show Book Images</label>
</div>
<div class="form-group">
<label for="http_look">Interface:</label>
<select id="http_look" name="http_look" class="form-control">
Expand Down
10 changes: 8 additions & 2 deletions data/interfaces/bookstrap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@
<h1>${title}</h1>
<div class="table-responsive">
<table class="display table table-striped table-hover table-bordered" id="author_table">
<%
if lazylibrarian.CONFIG['AUTHOR_IMG'] == True:
hidden = ''
else:
hidden = 'hidden'
%>
<thead>
<tr>
<th class="authorimg no-sort col-xs-1">Image</th>
<th class="authorimg no-sort col-xs-1 ${hidden}">Image</th>
<th class="authorname col-xs-3">Author</th>
<th class="bookname col-xs-4">Latest Book</th>
<th class="date col-xs-1 text-center">Released</th>
Expand Down Expand Up @@ -54,7 +60,7 @@ <h1>${title}</h1>
grade = 'X'
%>
<tr>
<td class="name text-center"><a href="${author['AuthorImg']}" target="_blank" rel="noreferrer"><img src="${author['AuthorImg']}" alt="Cover" class="bookcover-sm"></a></td>
<td class="name text-center ${hidden}"><a href="${author['AuthorImg']}" target="_blank" rel="noreferrer"><img src="${author['AuthorImg']}" alt="Cover" class="bookcover-sm"></a></td>
<td class="name"><a href="authorPage?AuthorID=${author['AuthorID']|u}">${author['AuthorName']}</a></td>
<td class="bookname"><span title="${author['LastBook']}"></span><a href="${author['LastLink']}" target="_blank" rel="noreferrer">${author['LastBook']}</a></td>
<td class="date text-center">${author['LastDate']}</td>
Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/bookstrap/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<%def name="body()">
<h1>${title}</h1>
<div align="center">Refresh rate:
<select id="refreshrate" onchange="setRefresh()">
<select id="refreshrate" class="button btn btn-sm btn-primary" onchange="setRefresh()">
<option value="0" selected="selected">No Refresh</option>
<option value="5">5 Seconds</option>
<option value="15">15 Seconds</option>
Expand Down
13 changes: 12 additions & 1 deletion data/interfaces/bookstrap/managebooks.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ <h1>${title}</h1>
<input type="hidden" name="redirect" value="manage">
<div class="table-responsive">
<table class="display table table-striped table-hover table-bordered" id="book_table">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'hidden'
%>
<thead>
<tr>
<th class="select text-center no-sort"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th class="bookart text-center no-sort hidden-xs">Cover</th>
<th class="bookart text-center no-sort hidden-xs ${hidden}">Cover</th>
<th class="authorname">Author</th>
<th class="bookname">Title</th>
<th class="series">Series</th>
Expand Down Expand Up @@ -102,6 +108,11 @@ <h1>${title}</h1>
"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');
Expand Down
13 changes: 12 additions & 1 deletion data/interfaces/default/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@
</p>
<table class="display" id="book_table">
<thead>
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'class="hidden"'
%>
<tr>
<th id="select"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th id="bookart">Cover</th>
<th id="bookart" ${hidden}>Cover</th>
<th id="authorname" class="hidden">Title</th>
<th id="bookname">Title</th>
<th id="series">Series</th>
Expand Down Expand Up @@ -201,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
Expand Down
13 changes: 12 additions & 1 deletion data/interfaces/default/books.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ <h1>&nbsp;&nbsp;${title}</h1>
<br><br>
</p>
<table class="display" id="book_table" style="width:100%;">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'class="hidden"'
%>
<thead>
<tr>
<th id="select"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th id="bookart">Cover</th>
<th id="bookart" ${hidden}>Cover</th>
<th id="authorname">Author</th>
<th id="bookname">Title</th>
<th id="series">Series</th>
Expand Down Expand Up @@ -146,6 +152,11 @@ <h1>&nbsp;&nbsp;${title}</h1>
$('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
Expand Down
19 changes: 19 additions & 0 deletions data/interfaces/default/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,25 @@ <h1>&nbsp;&nbsp;${title}</h1>
<br><small>Current API key: <strong>${lazylibrarian.CONFIG['API_KEY']}</strong></small>
</div>
</fieldset>
<h5>Appearance</h5>
<%
if lazylibrarian.CONFIG['AUTHOR_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<input type="checkbox" name="author_img" value=1 ${checked} />
<label> Show Author Images</label>
<br>
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
checked = 'checked="checked"'
else:
checked = ''
%>
<input type="checkbox" name="book_img" value=1 ${checked} />
<label> Show Book Images</label>
<br>
<h5>Interface: <select name="http_look" style="float:right;"></h5>
%for http_look in config['http_look_list']:
<%
Expand Down
10 changes: 8 additions & 2 deletions data/interfaces/default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@
<BR><BR>
<h1>&nbsp;&nbsp;${title}</h1>
<table class="display" id="author_table">
<%
if lazylibrarian.CONFIG['AUTHOR_IMG'] == True:
hidden = ''
else:
hidden = 'class="hidden"'
%>
<thead>
<tr>
<th id="status">Image</th>
<th id="status" ${hidden}>Image</th>
<th id="authorname">Author</th>
<th id="bookname">Latest Book</th>
<th id="date">Released</th>
Expand Down Expand Up @@ -55,7 +61,7 @@ <h1>&nbsp;&nbsp;${title}</h1>

%>
<tr class="gradeZ">
<td id="status"><a href="${author['AuthorImg']}" target="_blank" rel="noreferrer"><img src="${author['AuthorImg']}" width="60" alt="Cover" class="bookcover-sm"></a></td>
<td id="status" ${hidden}><a href="${author['AuthorImg']}" target="_blank" rel="noreferrer"><img src="${author['AuthorImg']}" width="60" alt="Cover" class="bookcover-sm"></a></td>
<td id=authorname><a href="authorPage?AuthorID=${author['AuthorID']|u}">${author['AuthorName']}</a></td>

<td id="bookname"><span title="${author['LastBook']}"></span><a href="${author['LastLink']}" target="_blank" rel="noreferrer">${author['LastBook']}</a></td>
Expand Down
13 changes: 12 additions & 1 deletion data/interfaces/default/managebooks.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ <h1>&nbsp;&nbsp;${title}</h1><br>
<br>
<form action="markBooks" method="get"><input type="hidden" name="redirect" value="manage">
<table class="display" id="book_table">
<%
if lazylibrarian.CONFIG['BOOK_IMG'] == True:
hidden = ''
else:
hidden = 'class="hidden"'
%>
<thead>
<tr>
<th id="select" class="center"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th id="bookart">Cover</th>
<th id="bookart" ${hidden}>Cover</th>
<th id="authorname">Author</th>
<th id="bookname">Title</th>
<th id="series">Series</th>
Expand Down Expand Up @@ -109,6 +115,11 @@ <h1>&nbsp;&nbsp;${title}</h1><br>
$('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
Expand Down
13 changes: 9 additions & 4 deletions lazylibrarian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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', ''),
Expand All @@ -128,6 +130,8 @@
'HTTPS_KEY': ('str', 'General', ''),
'BOOKSTRAP_THEME': ('str', 'General', 'slate'),
'MAG_SINGLE': ('bool', 'General', 1),
'AUTHOR_IMG': ('bool', 'General', 1),
'BOOK_IMG': ('bool', 'General', 1),
'LAUNCH_BROWSER': ('bool', 'General', 1),
'API_ENABLED': ('bool', 'General', 0),
'API_KEY': ('str', 'General', ''),
Expand Down Expand Up @@ -370,7 +374,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:

Expand Down Expand Up @@ -450,7 +455,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']:
Expand Down Expand Up @@ -996,7 +1001,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
Expand Down
2 changes: 1 addition & 1 deletion lazylibrarian/bencode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() ]
Expand Down
Loading

0 comments on commit 58a0ada

Please sign in to comment.