Skip to content

Commit

Permalink
Merge pull request #881 from philborman/master
Browse files Browse the repository at this point in the history
Fix for #880, libgen additional options
  • Loading branch information
philborman authored Jun 21, 2017
2 parents 754a793 + 9dcd516 commit 5648538
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 335 deletions.
6 changes: 6 additions & 0 deletions data/interfaces/bookstrap/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,12 @@ <h1>${title}</h1>
<span class="input-group-addon">%</span>
</div>
</div>
<div class="form-group">
<label for="dload_ratio">Maximum Search Pages:</label>
<div class="input-group">
<input type="text" id="max_pages" name="max_pages" value="${lazylibrarian.CONFIG['MAX_PAGES']}" class="form-control" placeholder="Maximum search pages">
</div>
</div>
</fieldset>
<fieldset>
<div class="form-group">
Expand Down
4 changes: 4 additions & 0 deletions data/interfaces/default/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ <h3>Miscellaneous</h3>
<label>Download Match Ratio:</label>
<input type="text" id="dload_ratio" name="dload_ratio" value="${lazylibrarian.CONFIG['DLOAD_RATIO']}" size="8"> (percent)
</div>
<div>
<label>Max search pages:</label>
<input type="text" id="max_pages" name="max_pages" value="${lazylibrarian.CONFIG['MAX_PAGES']}" size="8">
</div>
<label>git program:</label>
<input type="text" placeholder="git program" id="git_program" name="git_program" value="${lazylibrarian.CONFIG['GIT_PROGRAM']}" size="26">
<BR>
Expand Down
2 changes: 1 addition & 1 deletion lazylibrarian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
CONFIG_GIT = ['GIT_REPO', 'GIT_USER', 'GIT_BRANCH', 'LATEST_VERSION', 'GIT_UPDATED', 'CURRENT_VERSION',
'COMMITS_BEHIND', 'INSTALL_TYPE']
CONFIG_NONWEB = ['LOGFILES', 'LOGSIZE', 'NAME_POSTFIX', 'DIR_PERM', 'FILE_PERM', 'BLOCKLIST_TIMER',
'WALL_COLUMNS', 'MAX_PAGES']
'WALL_COLUMNS']
CONFIG_NONDEFAULT = ['BOOKSTRAP_THEME', 'AUDIOBOOK_TYPE', 'AUDIO_DIR', 'AUDIO_TAB', 'REJECT_AUDIO',
'REJECT_MAXAUDIO', 'REJECT_MINAUDIO', 'NEWAUDIO_STATUS', 'TOGGLES', 'AUDIO_TAB']
CONFIG_DEFINITIONS = {
Expand Down
1 change: 1 addition & 0 deletions lazylibrarian/resultlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def findBestResult(resultlist, book, searchtype, source):
prefix = 'tor_'

logger.debug('Searching %s %s results for best %s match' % (len(resultlist), source, auxinfo))

matches = []
for res in resultlist:
resultTitle = unaccented_str(replace_all(res[prefix + 'title'], dictrepl)).strip()
Expand Down
19 changes: 15 additions & 4 deletions lazylibrarian/searchbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ def search_book(books=None, library=None):
modelist.remove('rss')
break

if nproviders:
if resultlist:
match = findBestResult(resultlist, book, searchtype, mode)
else:
match = None

# if you can't find the book, try author/title without any "(extended details, series etc)"
if not goodEnough(match) and '(' in book['bookName']:
Expand All @@ -164,22 +166,31 @@ def search_book(books=None, library=None):
elif mode == 'rss':
resultlist = rss_resultlist

match = findBestResult(resultlist, book, searchtype, mode)
if resultlist:
match = findBestResult(resultlist, book, searchtype, mode)
else:
match = None

# if you can't find the book under "books", you might find under general search
# general search is the same as booksearch for torrents and rss, no need to check again
if not goodEnough(match):
searchtype = 'general'
if mode == 'nzb':
resultlist, nproviders = IterateOverNewzNabSites(book, searchtype)
match = findBestResult(resultlist, book, searchtype, mode)
if resultlist:
match = findBestResult(resultlist, book, searchtype, mode)
else:
match = None

# if still not found, try general search again without any "(extended details, series etc)"
if not goodEnough(match) and '(' in book['searchterm']:
searchtype = 'shortgeneral'
if mode == 'nzb':
resultlist, nproviders = IterateOverNewzNabSites(book, searchtype)
match = findBestResult(resultlist, book, searchtype, mode)
if resultlist:
match = findBestResult(resultlist, book, searchtype, mode)
else:
match = None

if not goodEnough(match):
logger.info("%s Searches for %s %s returned no results." %
Expand Down
Loading

0 comments on commit 5648538

Please sign in to comment.