FiX: error on startup involving git-removed, FIX:Error on weekly check (thnx ClayM), FIX: Nzbx.co would error on no results, FIX: duplicate issues appearing in comic list, IMP:Fuzzy year logic now in Series tab, probably other small stuff...

This commit is contained in:
evilhero 2013-01-13 10:59:46 -05:00
parent 1b34db1f5c
commit 05e6cef5ca
10 changed files with 237 additions and 111 deletions

View File

@ -133,7 +133,22 @@
<div>
<label><big>Alternate Search Names :</big><norm>${comic['AlternateSearch']}</norm></label>
</div>
<%
if comic['UseFuzzy'] == "0" or comic['UseFuzzy'] is None:
fuzzy = "None"
fuzzy_year = "0"
elif comic['UseFuzzy'] == "1":
fuzzy = "Remove Year"
fuzzy_year = "1"
elif comic['UseFuzzy'] == "2":
fuzzy = "Fuzzy Year"
fuzzy_year = "2"
%>
<div>
<label><big>Fuzzy Year logic : </big><norm>${fuzzy} </norm></label>
</div>
</fieldset>
</td>
@ -165,6 +180,7 @@
<form action="comic_config" method="GET">
<input type="hidden" name="ComicID" value=${comic['ComicID']}>
<br/><br/><br/>
<fieldset>
<div>
<label>Directory Location</label>
@ -174,12 +190,14 @@
<div>
<label>Alternate Search Names</label>
<input type="text" name="alt_search" value="${comic['AlternateSearch']}" size="60"><br/>
<div class="row"><small>Alternate comic names to be searched in case naming is different</small>
<small>(ie. Hack/Slash = hack-slash)</small></div>
<div class="row"><small>Alternate comic names to be searched in case naming is different (ie. Hack/Slash = hack-slash)</small></div>
</div>
<label>Year Options</label>
<div class="row radio left clearfix">
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="fuzzy_year" value="0" /><label>Keep the Year as is<small>Default</small></label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="fuzzy_year" value="1" /><label>Year Removal<small>Remove issue publication year from searches (dangerous)</small></label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="fuzzy_year" value="2" /><label>Fuzzy the Year<small>Increase & Decrease the issue publication year by one</small></label>
</div>
<div>
<input type="submit" value="Update"/>
</div>
</fieldset>

View File

@ -51,7 +51,7 @@
<td>
<fieldset>
<legend>Branch history</legend>
<label>${config['branch_history']}</label>
<label>This would be a nice place to see revision history...</label>
</fieldset>
</td>
</tr>
@ -154,14 +154,22 @@
<label>SABnzbd Category:</label>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20">
</div>
<div class="row radio left clearfix">
<label>SABNzbd Priority:</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="sab_priority" value="1" ${config['sab_priority_1']} /><label>default Priority</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="sab_priority" value="2" ${config['sab_priority_2']} /><label>Low Priority</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="sab_priority" value="3" ${config['sab_priority_3']} /><label>Normal Priority</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="sab_priority" value="4" ${config['sab_priority_4']} /><label>High Priority</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="sab_priority" value="5" ${config['sab_priority_5']} /><label>Paused</label>
</div>
<div class="row">
<label>SAB Priority</label>
<select name="sab_priority">
%for prio in ['Default', 'Low', 'Normal', 'High', 'Paused']:
<%
if config['sab_priority'] == prio:
outputselect = 'selected'
else:
outputselect = ''
%>
<option value=${prio} ${outputselect}>${prio}</option>
%endfor
</select>
</div>
</fieldset>
</td>
@ -211,7 +219,7 @@
<fieldset>
<legend>DOGNZB</legend>
<div class="row checkbox">
<input id="usedognzb" type="checkbox" onclick="initConfigCheckbox($(this));" name="dognzb" value="1" ${config['use_dognzb']} /><label>Use DOGnzb</label>
<input id="usedognzb" type="checkbox" onclick="initConfigCheckbox($(this));" name="dognzb" value="1" ${config['use_dognzb']} /><label>Use DOGnzb</label>
</div>
<div class="config">
<div class="row">
@ -312,8 +320,30 @@
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="preferred_quality" value="2" ${config['pref_qual_2']} /><label>cbz</label>
<input type="radio" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="preferred_quality" value="0" ${config['pref_qual_0']} /><label>Whichever - just get it</label>
</div>
</fieldset>
<fieldset>
<legend>Restrictions (not working yet)</legend>
<div class="row checkbox left">
<input id="use_minsize" type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" onclick="initConfigCheckbox($(this));" name="use_minsize" value="1" ${config['use_minsize']} /><label>Minimum File size<small>(MB)</small></label>
</div>
<div class="config">
<div class="row">
<input type="text" name="minsize" value="${config['minsize']}" size="6">
</div>
</div>
</div>
</fieldset>
<fieldset>
<div class="row checkbox left">
<input id="use_maxsize" type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" onclick="initConfigCheckbox($(this));" name="use_maxsize" value="1" ${config['use_maxsize']} /><label>Maximum File size<small>(MB)</small></label>
</div>
<div class="config">
<div class="row">
<input type="text" name="maxsize" value="${config['maxsize']}" size="6">
</div>
</div>
</fieldset>
</td>
<td>
<fieldset>
@ -506,6 +536,8 @@
initConfigCheckbox("#useexperimental");
initConfigCheckbox("#useraw");
initConfigCheckbox("#replace_spaces");
initConfigCheckbox("#use_minsize");
initConfigCheckbox("#use_maxsize");
initConfigCheckbox("#zero_level");
}
$(document).ready(function() {

View File

@ -141,6 +141,7 @@ class PostProcessor(object):
#replace spaces
nzbname = re.sub(' ', '.', str(nzbname))
nzbname = re.sub('[\,\:]', '', str(nzbname))
self._log("nzbname: " + str(nzbname), logger.DEBUG)

View File

@ -104,7 +104,10 @@ REPLACE_SPACES = False
REPLACE_CHAR = None
ZERO_LEVEL = False
ZERO_LEVEL_N = None
USE_MINSIZE = False
MINSIZE = None
USE_MAXSIZE = False
MAXSIZE = None
AUTOWANT_UPCOMING = True
AUTOWANT_ALL = False
COMIC_COVER_LOCAL = False
@ -205,12 +208,12 @@ def initialize():
NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, NZBX,\
NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS,\
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, \
COMIC_LOCATION, QUAL_ALTVERS, QUAL_SCANNER, QUAL_TYPE, QUAL_QUALITY, ENABLE_EXTRA_SCRIPTS, EXTRA_SCRIPTS
if __INITIALIZED__:
return False
# Make sure all the config sections exist
CheckSection('General')
CheckSection('SABnzbd')
@ -228,6 +231,7 @@ def initialize():
if HTTP_PORT < 21 or HTTP_PORT > 65535:
HTTP_PORT = 8090
# CONFIG_VERSION = check_setting_str(CFG, 'General', 'config_version', '')
HTTP_HOST = check_setting_str(CFG, 'General', 'http_host', '0.0.0.0')
HTTP_USERNAME = check_setting_str(CFG, 'General', 'http_username', '')
HTTP_PASSWORD = check_setting_str(CFG, 'General', 'http_password', '')
@ -263,6 +267,10 @@ def initialize():
REPLACE_CHAR = check_setting_str(CFG, 'General', 'replace_char', '')
ZERO_LEVEL = bool(check_setting_int(CFG, 'General', 'zero_level', 0))
ZERO_LEVEL_N = check_setting_str(CFG, 'General', 'zero_level_n', '')
USE_MINSIZE = bool(check_setting_int(CFG, 'General', 'use_minsize', 0))
MINSIZE = check_setting_str(CFG, 'General', 'minsize', '')
USE_MAXSIZE = bool(check_setting_int(CFG, 'General', 'use_maxsize', 0))
MAXSIZE = check_setting_str(CFG, 'General', 'maxsize', '')
ENABLE_EXTRA_SCRIPTS = bool(check_setting_int(CFG, 'General', 'enable_extra_scripts', 0))
EXTRA_SCRIPTS = check_setting_str(CFG, 'General', 'extra_scripts', '')
@ -272,7 +280,7 @@ def initialize():
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', '')
SAB_PRIORITY = check_setting_int(CFG, 'SABnzbd', 'sab_priority', 0)
SAB_PRIORITY = check_setting_str(CFG, 'SABnzbd', 'sab_priority', '')
NZBSU = bool(check_setting_int(CFG, 'NZBsu', 'nzbsu', 0))
NZBSU_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '')
@ -336,31 +344,31 @@ def initialize():
CONFIG_VERSION = '2'
if 'http://' not in SAB_HOST[:7] and 'https://' not in SAB_HOST[:8]:
if 'http://' not in SAB_HOST[:7] and 'https://' not in SAB_HOST[:8]:
SAB_HOST = 'http://' + SAB_HOST
#print ("SAB_HOST:" + SAB_HOST)
#print ("SAB_HOST:" + SAB_HOST)
if not LOG_DIR:
LOG_DIR = os.path.join(DATA_DIR, 'logs')
if not os.path.exists(LOG_DIR):
try:
os.makedirs(LOG_DIR)
except OSError:
if VERBOSE:
print 'Unable to create the log directory. Logging to screen only.'
# Start the logger, silence console logging if we need to
logger.mylar_log.initLogger(verbose=VERBOSE)
# Put the cache dir in the data dir for now
CACHE_DIR = os.path.join(DATA_DIR, 'cache')
if not os.path.exists(CACHE_DIR):
try:
os.makedirs(CACHE_DIR)
os.makedirs(CACHE_DIR)
except OSError:
logger.error('Could not create cache dir. Check permissions of datadir: ' + DATA_DIR)
# Sanity check for search interval. Set it to at least 6 hours
if SEARCH_INTERVAL < 360:
logger.info("Search interval too low. Resetting to 6 hour minimum")
@ -373,11 +381,11 @@ def initialize():
dbcheck()
except Exception, e:
logger.error("Can't connect to the database: %s" % e)
# Get the currently installed version - returns None, 'win32' or the git hash
# Also sets INSTALL_TYPE variable to 'win', 'git' or 'source'
CURRENT_VERSION = versioncheck.getVersion()
# Check for new versions
if CHECK_GITHUB_ON_STARTUP:
try:
@ -389,7 +397,7 @@ def initialize():
__INITIALIZED__ = True
return True
def daemonize():
if threading.activeCount() != 1:
@ -453,6 +461,8 @@ def config_write():
new_config = ConfigObj()
new_config.filename = CONFIG_FILE
print ("falalal")
new_config['General'] = {}
new_config['General']['config_version'] = CONFIG_VERSION
new_config['General']['http_port'] = HTTP_PORT
@ -491,6 +501,11 @@ def config_write():
new_config['General']['replace_char'] = REPLACE_CHAR
new_config['General']['zero_level'] = int(ZERO_LEVEL)
new_config['General']['zero_level_n'] = ZERO_LEVEL_N
new_config['General']['use_minsize'] = int(USE_MINSIZE)
new_config['General']['minsize'] = MINSIZE
new_config['General']['use_maxsize'] = int(USE_MAXSIZE)
new_config['General']['maxsize'] = MAXSIZE
new_config['General']['enable_extra_scripts'] = int(ENABLE_EXTRA_SCRIPTS)
new_config['General']['extra_scripts'] = EXTRA_SCRIPTS
@ -537,7 +552,6 @@ def config_write():
new_config['Raw']['raw_groups'] = RAW_GROUPS
new_config.write()
def start():
@ -577,7 +591,7 @@ def dbcheck():
conn=sqlite3.connect(DB_FILE)
c=conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS comics (ComicID TEXT UNIQUE, ComicName TEXT, ComicSortName TEXT, ComicYear TEXT, DateAdded TEXT, Status TEXT, IncludeExtras INTEGER, Have INTEGER, Total INTEGER, ComicImage TEXT, ComicPublisher TEXT, ComicLocation TEXT, ComicPublished TEXT, LatestIssue TEXT, LatestDate TEXT, Description TEXT, QUALalt_vers TEXT, QUALtype TEXT, QUALscanner TEXT, QUALquality TEXT, LastUpdated TEXT, AlternateSearch TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS comics (ComicID TEXT UNIQUE, ComicName TEXT, ComicSortName TEXT, ComicYear TEXT, DateAdded TEXT, Status TEXT, IncludeExtras INTEGER, Have INTEGER, Total INTEGER, ComicImage TEXT, ComicPublisher TEXT, ComicLocation TEXT, ComicPublished TEXT, LatestIssue TEXT, LatestDate TEXT, Description TEXT, QUALalt_vers TEXT, QUALtype TEXT, QUALscanner TEXT, QUALquality TEXT, LastUpdated TEXT, AlternateSearch TEXT, UseFuzzy TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS issues (IssueID TEXT, ComicName TEXT, IssueName TEXT, Issue_Number TEXT, DateAdded TEXT, Status TEXT, Type TEXT, ComicID, ArtworkURL Text, ReleaseDate TEXT, Location TEXT, IssueDate TEXT, Int_IssueNumber INT, ComicSize TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS snatched (IssueID TEXT, ComicName TEXT, Issue_Number TEXT, Size INTEGER, DateAdded TEXT, Status TEXT, FolderName TEXT, ComicID TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS upcoming (ComicName TEXT, IssueNumber TEXT, ComicID TEXT, IssueID TEXT, IssueDate TEXT, Status TEXT)')
@ -625,6 +639,11 @@ def dbcheck():
except sqlite3.OperationalError:
c.execute('ALTER TABLE issues ADD COLUMN ComicSize TEXT')
try:
c.execute('SELECT UseFuzzy from comics')
except sqlite3.OperationalError:
c.execute('ALTER TABLE comics ADD COLUMN UseFuzzy TEXT')
#let's delete errant comics that are stranded (ie. None)
c.execute("DELETE from COMICS WHERE ComicName='None'")
logger.info(u"Ensuring DB integrity - Removing all Erroneous Comics (ie. named None)")

View File

@ -91,8 +91,7 @@ def findComic(name, mode, issue):
pubnames = publishers[0].getElementsByTagName('name')
if len(pubnames) >0:
xmlpub = pubnames[0].firstChild.wholeText
# if (result.getElementsByTagName('name')[0].childNodes[0].nodeValue) is None:
if (result.getElementsByTagName('image')[0].childNodes[0].nodeValue) is None:
if (result.getElementsByTagName('name')[0].childNodes[0].nodeValue) is None:
xmlimage = result.getElementsByTagName('super_url')[0].firstChild.wholeText
else:
xmlimage = "cache/blankcover.jpg"

View File

@ -260,22 +260,26 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
if isslen > 0:
isschk = ParseIssue[:isslen]
isschk2 = str(isschk) + isschk_decval
#logger.fdebug("isschk: " + str(isschk) + " ...isschk2: " + str(isschk2))
if 'a' in isschk or 'b' in isschk or 'c' in isschk:
isschk2 = ParseIssue[:isslen-1] + isschk_decval
#altcount == 2
ParseIssue = str(isschk2)
#print ("Alt.cover found = " + str(isschk2))
#logger.fdebug("Alt.cover found = " + str(isschk2))
if str(PI) == str(isschk2):
#logger.fdebug("matched on PI: " + str(PI) + " .. and isschk2: " + str(isschk2))
if altcount == 0:
#this handles the first occurance.. print ("Fist occurance detected - " + str(isschk))
#logger.fdebug("first occurance - marking and continuing..." + str(isschk2))
#this handles the first occurance..
ParseIssue = str(isschk2)
PI = str(isschk2)
altcount = 1
else:
#print ("Using only first record for issue - ignoring further alternate matches")
#logger.fdebug("Using only first record for issue - ignoring further alternate matches")
ParseIssue = "this is wrong"
altcount+=1
else:
#logger.fdebug("issues didn't match.")
altcount = 1
ParseIssue = str(isschk) + isschk_decval
else:
@ -285,6 +289,7 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
#print ("no alt.cover detected for - " + str(ParseIssue))
altcount = 1
if (altcount == 1):
#logger.fdebug("adding issue to db : " + str(ParseIssue))
# in order to get the compare right, let's decimialize the string to '.00'.
gcdinfo['ComicIssue'] = ParseIssue
#print "Issue: " + str(ParseIssue)
@ -306,21 +311,29 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
ParseDate = ParseDate.replace(' ','')
gcdinfo['ComicDate'] = ParseDate
#^^ will retrieve date #
if ComicID[:1] == "G":
gcdchoice.append({
'GCDid': ComicID,
'IssueID': resultID,
'GCDIssue': gcdinfo['ComicIssue'],
'GCDDate': gcdinfo['ComicDate']
})
gcount+=1
if not any(d.get('GCDIssue', None) == str(gcdinfo['ComicIssue']) for d in gcdchoice):
#logger.fdebug("adding: " + str(gcdinfo['ComicIssue']))
if ComicID[:1] == "G":
gcdchoice.append({
'GCDid': ComicID,
'IssueID': resultID,
'GCDIssue': gcdinfo['ComicIssue'],
'GCDDate': gcdinfo['ComicDate']
})
gcount+=1
else:
gcdchoice.append({
'GCDid': ComicID,
'GCDIssue': gcdinfo['ComicIssue'],
'GCDDate': gcdinfo['ComicDate']
})
gcdinfo['gcdchoice'] = gcdchoice
else:
gcdchoice.append({
'GCDid': ComicID,
'GCDIssue': gcdinfo['ComicIssue'],
'GCDDate': gcdinfo['ComicDate']
})
gcdinfo['gcdchoice'] = gcdchoice
pass
#logger.fdebug("Duplicate issue detected in DB - ignoring subsequent issue # " + str(gcdinfo['ComicIssue']))
PI = ParseIssue
#else:
# -- this needs a rework --

View File

@ -1,6 +1,6 @@
import lib.simplejson as json
import mylar
from mylar import logger
from mylar import logger, helpers
import urllib2
@ -13,21 +13,22 @@ def searchit(cm):
#stringsearch = str(cm) + "%20" + str(issue) + "%20" + str(year)
searchURL = 'https://nzbx.co/api/search?cat=7030&q=' + str(cm)
logger.info(u'Parsing results from <a href="%s">nzbx.co</a>' % searchURL)
logger.fdebug(u'Parsing results from <a href="%s">nzbx.co</a>' % searchURL)
try:
data = urllib2.urlopen(searchURL, timeout=20).read()
except urllib2.URLError, e:
logger.warn('Error fetching data from nzbx.co: %s' % str(e))
logger.fdebug('Error fetching data from nzbx.co: %s' % str(e))
data = False
return "no results"
if data:
d = json.loads(data)
if not len(d):
logger.info(u"No results found from nzbx.co.")
pass
logger.info(u"No results found from nzbx.co")
return "no results"
else:
for item in d:
@ -41,7 +42,7 @@ def searchit(cm):
'link': str(url)
})
#resultlist.append((title, size, url, provider))
logger.info('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
logger.fdebug('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
except Exception, e:
logger.error(u"An unknown error occurred trying to parse the feed: %s" % e)

View File

@ -36,7 +36,7 @@ from xml.dom.minidom import parseString
import urllib2
from datetime import datetime
def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueID, AlternateSearch=None):
def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueID, AlternateSearch=None, UseFuzzy=None):
if ComicYear == None: ComicYear = '2013'
else: ComicYear = str(ComicYear)[:4]
##nzb provider selection##
@ -114,14 +114,14 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
nzbprov = 'newznab'
for newznab_host in newznab_hosts:
logger.fdebug("using newznab_host: " + str(newznab_host))
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy, newznab_host)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None:
if AlternateSearch is not None and AlternateSearch is not "None":
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy, newznab_host)
if findit == 'yes':
break
nzbpr-=1
@ -129,14 +129,14 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
elif nzbprovider[nzbpr] == 'experimental':
#this is for experimental
nzbprov = 'experimental'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None:
if AlternateSearch is not None and AlternateSearch is not "None":
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
break
@ -145,14 +145,14 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
elif nzbprovider[nzbpr] == 'nzbx':
# this is for nzbx.co
nzbprov = 'nzbx'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None:
if AlternateSearch is not None and AlternateSearch is not "None":
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
break
@ -161,14 +161,14 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
elif nzbprovider[nzbpr] == 'nzb.su':
# this is for nzb.su
nzbprov = 'nzb.su'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None:
if AlternateSearch is not None and AlternateSearch is not "None":
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
break
@ -179,15 +179,15 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
elif nzbprovider[nzbpr] == 'dognzb':
# this is for dognzb.com
nzbprov = 'dognzb'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None:
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
if AlternateSearch is not None and AlternateSearch is not "None":
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy)
if findit == 'yes':
break
@ -199,7 +199,7 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
if findit == 'yes': return findit
return findit
def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host=None):
def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, UseFuzzy, newznab_host=None):
if nzbprov == 'nzb.su':
apikey = mylar.NZBSU_APIKEY
@ -222,15 +222,18 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
elif mylar.PREFERRED_QUALITY == 2: filetype = ".cbz"
if mylar.SAB_PRIORITY:
if mylar.SAB_PRIORITY == 1: sabpriority = "-100"
elif mylar.SAB_PRIORITY == 2: sabpriority = "-1"
elif mylar.SAB_PRIORITY == 3: sabpriority = "0"
elif mylar.SAB_PRIORITY == 4: sabpriority = "1"
elif mylar.SAB_PRIORITY == 5: sabpriority = "-2"
if mylar.SAB_PRIORITY == "Default": sabpriority = "-100"
elif mylar.SAB_PRIORITY == "Low": sabpriority = "-1"
elif mylar.SAB_PRIORITY == "Normal": sabpriority = "0"
elif mylar.SAB_PRIORITY == "High": sabpriority = "1"
elif mylar.SAB_PRIORITY == "Paused": sabpriority = "-2"
else:
#if sab priority isn't selected, default to Normal (0)
sabpriority = "0"
#UseFuzzy == 0: Normal
#UseFuzzy == 1: Remove Year
#UseFuzzy == 2: Fuzzy Year
# figure out what was missed via rss feeds and do a manual search via api
#tsc = int(tot-1)
findcomic = []
@ -387,22 +390,37 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
if cnt == 0:
comic_andiss = m[cnt]
logger.fdebug("Comic: " + str(comic_andiss))
if m[cnt][:-2] == '19' or m[cnt][:-2] == '20':
logger.fdebug("year detected: " + str(m[cnt]))
result_comyear = m[cnt]
if str(comyear) in result_comyear:
logger.fdebug(str(comyear) + " - right years match baby!")
yearmatch = "true"
else:
logger.fdebug(str(comyear) + " - not right - years do not match")
yearmatch = "false"
if UseFuzzy == "0" or UseFuzzy == "2":
if m[cnt][:-2] == '19' or m[cnt][:-2] == '20':
logger.fdebug("year detected: " + str(m[cnt]))
result_comyear = m[cnt]
if str(comyear) in result_comyear:
logger.fdebug(str(comyear) + " - right years match baby!")
yearmatch = "true"
else:
logger.fdebug(str(comyear) + " - not right - years do not match")
yearmatch = "false"
if UseFuzzy == "2":
#Fuzzy the year +1 and -1
ComUp = int(ComicYear) + 1
ComDwn = int(ComicYear) - 1
if str(ComUp) in result_comyear or str(ComDwn) in result_comyear:
logger.fdebug("Fuzzy Logic'd the Year and got a match with a year of " + str(result_comyear))
yearmatch = "true"
else:
logger.fdebug(str(comyear) + "Fuzzy logic'd the Year and year still didn't match.")
#let's do this hear and save a few extra loops ;)
#fix for issue dates between Nov-Dec/Jan
if IssDateFix == "yes":
ComicYearFix = int(ComicYear) + 1
if str(ComicYearFix) in result_comyear:
logger.fdebug("further analysis reveals this was published inbetween Nov-Jan, incrementing year to " + str(ComicYearFix) + " has resulted in a match!")
yearmatch = "true"
if IssDateFix == "yes" and UseFuzzy is not "2":
ComicYearFix = int(ComicYear) + 1
if str(ComicYearFix) in result_comyear:
logger.fdebug("further analysis reveals this was published inbetween Nov-Jan, incrementing year to " + str(ComicYearFix) + " has resulted in a match!")
yearmatch = "true"
else:
logger.fdebug(str(comyear) + " - not the right year.")
elif UseFuzzy == "1": yearmatch = "true"
if 'digital' in m[cnt] and len(m[cnt]) == 7:
logger.fdebug("digital edition detected")
@ -608,7 +626,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#let's change all space to decimals for simplicity
nzbname = re.sub(" ", ".", str(entry['title']))
nzbname = re.sub('[\,\:]', '', str(nzbname))
extensions = ('.cbr', '.cbz')
if nzbname.lower().endswith(extensions):
@ -700,13 +718,14 @@ def searchforissue(issueid=None, new=False):
SeriesYear = comic['ComicYear']
AlternateSearch = comic['AlternateSearch']
IssueDate = result['IssueDate']
UseFuzzy = comic['UseFuzzy']
if result['IssueDate'] == None:
ComicYear = comic['ComicYear']
else:
ComicYear = str(result['IssueDate'])[:4]
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB or mylar.NZBX) and (mylar.SAB_HOST):
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(ComicYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch)
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(ComicYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch, UseFuzzy)
if foundNZB == "yes":
#print ("found!")
updater.foundsearch(result['ComicID'], result['IssueID'])
@ -720,6 +739,7 @@ def searchforissue(issueid=None, new=False):
SeriesYear = comic['ComicYear']
AlternateSearch = comic['AlternateSearch']
IssueDate = result['IssueDate']
UseFuzzy = comic['UseFuzzy']
if result['IssueDate'] == None:
IssueYear = comic['ComicYear']
else:
@ -727,7 +747,7 @@ def searchforissue(issueid=None, new=False):
foundNZB = "none"
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB or mylar.NZBX) and (mylar.SAB_HOST):
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(IssueYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch)
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(IssueYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch, UseFuzzy)
if foundNZB == "yes":
#print ("found!")
updater.foundsearch(ComicID=result['ComicID'], IssueID=result['IssueID'])
@ -744,12 +764,13 @@ def searchIssueIDList(issuelist):
foundNZB = "none"
SeriesYear = comic['ComicYear']
AlternateSearch = comic['AlternateSearch']
UseFuzzy = comic['UseFuzzy']
if issue['IssueDate'] == None:
ComicYear = comic['ComicYear']
else:
ComicYear = str(issue['IssueDate'])[:4]
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB or mylar.NZBX) and (mylar.SAB_HOST):
foundNZB = search_init(comic['ComicName'], issue['Issue_Number'], str(ComicYear), comic['ComicYear'], issue['IssueDate'], issue['IssueID'], AlternateSearch)
foundNZB = search_init(comic['ComicName'], issue['Issue_Number'], str(ComicYear), comic['ComicYear'], issue['IssueDate'], issue['IssueID'], AlternateSearch, UseFuzzy)
if foundNZB == "yes":
#print ("found!")
updater.foundsearch(ComicID=issue['ComicID'], IssueID=issue['IssueID'])

View File

@ -68,7 +68,8 @@ class WebInterface(object):
if comic is None:
raise cherrypy.HTTPRedirect("home")
comicConfig = {
"comiclocation" : mylar.COMIC_LOCATION
"comiclocation" : mylar.COMIC_LOCATION,
"use_fuzzy" : comic['UseFuzzy']
}
return serve_template(templatename="artistredone.html", title=comic['ComicName'], comic=comic, issues=issues, comicConfig=comicConfig)
artistPage.exposed = True
@ -108,6 +109,9 @@ class WebInterface(object):
if CV_EXcomicid is None: # pass #
gcdinfo=parseit.GCDScraper(comicname, comicyear, comicissues, comicid)
if gcdinfo == "No Match":
#when it no matches, the image will always be blank...let's fix it.
cvdata = mylar.cv.getComic(comicid,'comic')
comicimage = cvdata['ComicImage']
updater.no_searchresults(comicid)
nomatch = "true"
logger.info(u"I couldn't find an exact match for " + str(comicname) + " (" + str(comicyear) + ") - gathering data for Error-Checking screen (this could take a minute)..." )
@ -525,7 +529,8 @@ class WebInterface(object):
interface_dir = os.path.join(mylar.PROG_DIR, 'data/interfaces/')
interface_list = [ name for name in os.listdir(interface_dir) if os.path.isdir(os.path.join(interface_dir, name)) ]
branch_history, err = mylar.versioncheck.runGit("log --oneline --pretty=format:'%h - %ar - %s' -n 4")
# branch_history, err = mylar.versioncheck.runGit("log --oneline --pretty=format:'%h - %ar - %s' -n 4")
# br_hist = branch_history.replace("\n", "<br />\n")
config = {
"http_host" : mylar.HTTP_HOST,
@ -542,11 +547,7 @@ class WebInterface(object):
"sab_api" : mylar.SAB_APIKEY,
"sab_pass" : mylar.SAB_PASSWORD,
"sab_cat" : mylar.SAB_CATEGORY,
"sab_priority_1" : helpers.radio(mylar.SAB_PRIORITY, 1),
"sab_priority_2" : helpers.radio(mylar.SAB_PRIORITY, 2),
"sab_priority_3" : helpers.radio(mylar.SAB_PRIORITY, 3),
"sab_priority_4" : helpers.radio(mylar.SAB_PRIORITY, 4),
"sab_priority_5" : helpers.radio(mylar.SAB_PRIORITY, 5),
"sab_priority" : mylar.SAB_PRIORITY,
"use_blackhole" : helpers.checked(mylar.BLACKHOLE),
"blackhole_dir" : mylar.BLACKHOLE_DIR,
"usenet_retention" : mylar.USENET_RETENTION,
@ -564,6 +565,10 @@ class WebInterface(object):
"destination_dir" : mylar.DESTINATION_DIR,
"replace_spaces" : helpers.checked(mylar.REPLACE_SPACES),
"replace_char" : mylar.REPLACE_CHAR,
"use_minsize" : mylar.USE_MINSIZE,
"minsize" : mylar.MINSIZE,
"use_maxsize" : mylar.USE_MAXSIZE,
"maxsize" : mylar.MAXSIZE,
"interface_list" : interface_list,
"autowant_all" : helpers.checked(mylar.AUTOWANT_ALL),
"autowant_upcoming" : helpers.checked(mylar.AUTOWANT_UPCOMING),
@ -588,8 +593,8 @@ class WebInterface(object):
"data_dir" : mylar.DATA_DIR,
"prog_dir" : mylar.PROG_DIR,
"cache_dir" : mylar.CACHE_DIR,
"config_file" : mylar.CONFIG_FILE,
"branch_history" : re.sub('[\n]', '</br>', branch_history)
"config_file" : mylar.CONFIG_FILE
# "branch_history" : br_hist
}
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True
@ -606,8 +611,19 @@ class WebInterface(object):
error_change.exposed = True
def comic_config(self, com_location, alt_search, ComicID):
def comic_config(self, com_location, alt_search, fuzzy_year, ComicID):
myDB = db.DBConnection()
print ("fuzzy:" + fuzzy_year)
if fuzzy_year == '0': fuzzy_string = "None"
elif fuzzy_year == '1': fuzzy_string = "Remove Year"
elif fuzzy_year == '2': fuzzy_string = "Fuzzy Year"
# "pref_qual_0" : helpers.radio(mylar.PREFERRED_QUALITY, 0),
# "pref_qual_1" : helpers.radio(mylar.PREFERRED_QUALITY, 1),
# "pref_qual_3" : helpers.radio(mylar.PREFERRED_QUALITY, 3),
# "pref_qual_2" : helpers.radio(mylar.PREFERRED_QUALITY, 2),
#--- this is for multipe search terms............
#--- works, just need to redo search.py to accomodate multiple search terms
# ffs_alt = []
@ -637,7 +653,8 @@ class WebInterface(object):
controlValueDict = {'ComicID': ComicID}
newValues = {"ComicLocation": com_location,
"AlternateSearch": str(asearch) }
"AlternateSearch": str(asearch),
"UseFuzzy": fuzzy_year }
#"QUALalt_vers": qual_altvers,
#"QUALScanner": qual_scanner,
#"QUALtype": qual_type,
@ -660,11 +677,11 @@ class WebInterface(object):
comic_config.exposed = True
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8090, http_password=None, launch_browser=0, logverbose=0, download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None,
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, sab_priority=0, log_dir=None, blackhole=0, blackhole_dir=None,
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, sab_priority=None, log_dir=None, blackhole=0, blackhole_dir=None,
usenet_retention=None, nzbsu=0, nzbsu_apikey=None, dognzb=0, dognzb_apikey=None, nzbx=0, newznab=0, newznab_host=None, newznab_apikey=None, newznab_enabled=0,
raw=0, raw_provider=None, raw_username=None, raw_password=None, raw_groups=None, experimental=0,
preferred_quality=0, move_files=0, rename_files=0, folder_format=None, file_format=None, enable_extra_scripts=0, extra_scripts=None,
destination_dir=None, replace_spaces=0, replace_char=None, autowant_all=0, autowant_upcoming=0, comic_cover_local=0, zero_level=0, zero_level_n=None, interface=None, **kwargs):
destination_dir=None, replace_spaces=0, replace_char=None, use_minsize=0, minsize=None, use_maxsize=0, maxsize=None, autowant_all=0, autowant_upcoming=0, comic_cover_local=0, zero_level=0, zero_level_n=None, interface=None, **kwargs):
mylar.HTTP_HOST = http_host
mylar.HTTP_PORT = http_port
mylar.HTTP_USERNAME = http_username
@ -705,6 +722,10 @@ class WebInterface(object):
mylar.REPLACE_CHAR = replace_char
mylar.ZERO_LEVEL = zero_level
mylar.ZERO_LEVEL_N = zero_level_n
mylar.USE_MINSIZE = use_minsize
mylar.MINSIZE = minsize
mylar.USE_MAXSIZE = use_maxsize
mylar.MAXSIZE = maxsize
mylar.FOLDER_FORMAT = folder_format
mylar.FILE_FORMAT = file_format
mylar.DESTINATION_DIR = destination_dir

View File

@ -419,6 +419,7 @@ def pullitcheck(comic1off_name=None,comic1off_id=None):
comicnm = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', '', str(comicnm))
watchcomic = re.sub(r'\s', '', watchcomic)
comicnm = re.sub(r'\s', '', comicnm)
modcomicnm = ''
logger.fdebug("Revised_Watch: " + str(watchcomic))
logger.fdebug("ComicNM: " + str(comicnm))
if 'THE' in str(watchcomic):