mirror of
https://github.com/evilhero/mylar
synced 2025-03-10 22:12:49 +00:00
FIX:(#613) filechecker will now account for - in series and in issues more accurately, FIX:(#621) host_newznab_fix error, FIX:(#620) Changed dognzb RSS url as per request, FIX:(#619) Will log details to log file if sucessfully added series using 'addbyid' command, IMP: Removed unnecessary logging lines during filechecking, FIX: (#616) Fixed ID retrieval for KAT (for do-not-download usage), IMP: Increased month-lap to include March publication dates (some issues have dates of Mar-2014, but are being posted as 2013)
This commit is contained in:
parent
125d92dc3a
commit
ce5576dd0d
7 changed files with 107 additions and 71 deletions
|
@ -145,59 +145,70 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None,sarc=None):
|
|||
charpos = 0
|
||||
detneg = "no"
|
||||
leavehyphen = False
|
||||
for nono in not_these:
|
||||
if nono in subname:
|
||||
subcnt = subname.count(nono)
|
||||
charpos = indices(subname,nono) # will return a list of char positions in subname
|
||||
#print "charpos: " + str(charpos)
|
||||
if nono == '-':
|
||||
i=0
|
||||
while (i < len(charpos)):
|
||||
for i,j in enumerate(charpos):
|
||||
#print i,j
|
||||
if subname[j+1:j+2].isdigit():
|
||||
logger.fdebug('possible negative issue detected.')
|
||||
nonocount = nonocount + subcnt - 1
|
||||
detneg = "yes"
|
||||
elif '-' in watchcomic and i < len(watchcomic):
|
||||
logger.fdebug('- appears in series title.')
|
||||
leavehyphen = True
|
||||
i+=1
|
||||
if detneg == "no" or leavehyphen == False:
|
||||
subname = re.sub(str(nono), ' ', subname)
|
||||
nonocount = nonocount + subcnt
|
||||
should_restart = True
|
||||
while should_restart:
|
||||
should_restart = False
|
||||
for nono in not_these:
|
||||
if nono in subname:
|
||||
subcnt = subname.count(nono)
|
||||
charpos = indices(subname,nono) # will return a list of char positions in subname
|
||||
#print "charpos: " + str(charpos)
|
||||
if nono == '-':
|
||||
i=0
|
||||
while (i < len(charpos)):
|
||||
for i,j in enumerate(charpos):
|
||||
if j+2 > len(subname):
|
||||
sublimit = subname[j+1:]
|
||||
else:
|
||||
sublimit = subname[j+1:j+2]
|
||||
if sublimit.isdigit():
|
||||
logger.fdebug('possible negative issue detected.')
|
||||
nonocount = nonocount + subcnt - 1
|
||||
detneg = "yes"
|
||||
elif '-' in watchcomic and i < len(watchcomic):
|
||||
logger.fdebug('- appears in series title.')
|
||||
logger.fdebug('up to - :' + subname[:j+1].replace('-', ' '))
|
||||
logger.fdebug('after - :' + subname[j+1:])
|
||||
subname = subname[:j+1].replace('-', ' ') + subname[j+1:]
|
||||
logger.fdebug('new subname is : ' + str(subname))
|
||||
should_restart = True
|
||||
leavehyphen = True
|
||||
i+=1
|
||||
if detneg == "no" or leavehyphen == False:
|
||||
subname = re.sub(str(nono), ' ', subname)
|
||||
nonocount = nonocount + subcnt
|
||||
#logger.fdebug(str(nono) + " detected " + str(subcnt) + " times.")
|
||||
# segment '.' having a . by itself will denote the entire string which we don't want
|
||||
elif nono == '.':
|
||||
x = 0
|
||||
fndit = 0
|
||||
dcspace = 0
|
||||
while x < subcnt:
|
||||
fndit = subname.find(nono, fndit)
|
||||
if subname[fndit-1:fndit].isdigit() and subname[fndit+1:fndit+2].isdigit():
|
||||
logger.fdebug('decimal issue detected.')
|
||||
dcspace+=1
|
||||
x+=1
|
||||
if dcspace == 1:
|
||||
nonocount = nonocount + subcnt + dcspace
|
||||
elif nono == '.':
|
||||
x = 0
|
||||
fndit = 0
|
||||
dcspace = 0
|
||||
while x < subcnt:
|
||||
fndit = subname.find(nono, fndit)
|
||||
if subname[fndit-1:fndit].isdigit() and subname[fndit+1:fndit+2].isdigit():
|
||||
logger.fdebug('decimal issue detected.')
|
||||
dcspace+=1
|
||||
x+=1
|
||||
if dcspace == 1:
|
||||
nonocount = nonocount + subcnt + dcspace
|
||||
else:
|
||||
subname = re.sub('\.', ' ', subname)
|
||||
nonocount = nonocount + subcnt - 1 #(remove the extension from the length)
|
||||
else:
|
||||
subname = re.sub('\.', ' ', subname)
|
||||
nonocount = nonocount + subcnt - 1 #(remove the extension from the length)
|
||||
else:
|
||||
#this is new - if it's a symbol seperated by a space on each side it drags in an extra char.
|
||||
x = 0
|
||||
fndit = 0
|
||||
blspc = 0
|
||||
while x < subcnt:
|
||||
fndit = subname.find(nono, fndit)
|
||||
#print ("space before check: " + str(subname[fndit-1:fndit]))
|
||||
#print ("space after check: " + str(subname[fndit+1:fndit+2]))
|
||||
if subname[fndit-1:fndit] == ' ' and subname[fndit+1:fndit+2] == ' ':
|
||||
logger.fdebug('blankspace detected before and after ' + str(nono))
|
||||
blspc+=1
|
||||
x+=1
|
||||
subname = re.sub(str(nono), ' ', subname)
|
||||
nonocount = nonocount + subcnt + blspc
|
||||
#this is new - if it's a symbol seperated by a space on each side it drags in an extra char.
|
||||
x = 0
|
||||
fndit = 0
|
||||
blspc = 0
|
||||
while x < subcnt:
|
||||
fndit = subname.find(nono, fndit)
|
||||
#print ("space before check: " + str(subname[fndit-1:fndit]))
|
||||
#print ("space after check: " + str(subname[fndit+1:fndit+2]))
|
||||
if subname[fndit-1:fndit] == ' ' and subname[fndit+1:fndit+2] == ' ':
|
||||
logger.fdebug('blankspace detected before and after ' + str(nono))
|
||||
blspc+=1
|
||||
x+=1
|
||||
subname = re.sub(str(nono), ' ', subname)
|
||||
nonocount = nonocount + subcnt + blspc
|
||||
#subname = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\+\'\?\@]',' ', subname)
|
||||
|
||||
modwatchcomic = re.sub('[\_\#\,\/\:\;\.\!\$\%\'\?\@\-]', ' ', u_watchcomic)
|
||||
|
@ -391,6 +402,18 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None,sarc=None):
|
|||
if a4dec.isdigit() and b4dec.isdigit():
|
||||
logger.fdebug('DECIMAL ISSUE DETECTED')
|
||||
digitsvalid = "true"
|
||||
else:
|
||||
try:
|
||||
x = float(justthedigits)
|
||||
#validity check
|
||||
if x < 0:
|
||||
logger.info("I've encountered a negative issue #: " + str(justthedigits) + ". Trying to accomodate.")
|
||||
digitsvalid = "true"
|
||||
else: raise ValueError
|
||||
except ValueError, e:
|
||||
logger.info('Cannot determine issue number from given issue #: ' + str(justthedigits))
|
||||
|
||||
|
||||
# else:
|
||||
# logger.fdebug('NO DECIMALS DETECTED')
|
||||
# digitsvalid = "false"
|
||||
|
|
|
@ -665,7 +665,7 @@ def cleanhtml(raw_html):
|
|||
def issuedigits(issnum):
|
||||
import db, logger
|
||||
#print "issnum : " + str(issnum)
|
||||
if issnum.isdigit():
|
||||
if str(issnum).isdigit():
|
||||
int_issnum = int( issnum ) * 1000
|
||||
else:
|
||||
if 'au' in issnum.lower() and issnum[:1].isdigit():
|
||||
|
|
|
@ -868,6 +868,8 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None,c
|
|||
else:
|
||||
logger.info('Already have the latest issue : #' + str(latestiss))
|
||||
|
||||
if calledfrom == 'addbyid':
|
||||
return comic['ComicName'], SeriesYear
|
||||
|
||||
def GCDimport(gcomicid, pullupd=None,imported=None,ogcname=None):
|
||||
# this is for importing via GCD only and not using CV.
|
||||
|
|
|
@ -271,7 +271,7 @@ def nzbs(provider=None):
|
|||
elif nzbprovider[nzbpr] == 'dognzb':
|
||||
if mylar.DOGNZB_UID is None:
|
||||
mylar.DOGNZB_UID = '1'
|
||||
feed = 'http://dognzb.cr/rss?t=7030&dl=1&i=' + mylar.DOGNZB_UID + '&r=' + mylar.DOGNZB_APIKEY
|
||||
feed = 'https://dognzb.cr/rss.cfm?r=' + mylar.DOGNZB_APIKEY + '&t=7030'
|
||||
feedme = feedparser.parse(feed)
|
||||
site = nzbprovider[nzbpr]
|
||||
ft+=1
|
||||
|
|
|
@ -39,7 +39,7 @@ import urllib2
|
|||
from datetime import datetime
|
||||
|
||||
def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueID, AlternateSearch=None, UseFuzzy=None, ComicVersion=None, SARC=None, IssueArcID=None, mode=None, rsscheck=None, ComicID=None):
|
||||
if ComicYear == None: ComicYear = '2013'
|
||||
if ComicYear == None: ComicYear = '2014'
|
||||
else: ComicYear = str(ComicYear)[:4]
|
||||
|
||||
if mode == 'want_ann':
|
||||
|
@ -134,9 +134,9 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
|
||||
# end provider order sequencing
|
||||
|
||||
#fix for issue dates between Nov-Dec/Jan
|
||||
#fix for issue dates between Nov-Dec/(Jan-Feb-Mar)
|
||||
IssDt = str(IssueDate)[5:7]
|
||||
if IssDt == "12" or IssDt == "11" or IssDt == "01" or IssDt == "02":
|
||||
if IssDt == "12" or IssDt == "11" or IssDt == "01" or IssDt == "02" or IssDt == "03":
|
||||
IssDateFix = IssDt
|
||||
else:
|
||||
IssDateFix = "no"
|
||||
|
@ -628,15 +628,19 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
|
||||
#bypass for local newznabs
|
||||
#remove the protocol string (http/https)
|
||||
if host_newznab_fix.startswith('http'):
|
||||
hnc = host_newznab_fix.replace('http://', '')
|
||||
elif host_newznab_fix.startswith('https'):
|
||||
hnc = host_newznab_fix.replace('https://', '')
|
||||
else:
|
||||
hnc = host_newznab_fix
|
||||
if nzbprov == 'newznab' and (hnc[:3] == '10.' or hnc[:4] == '172.' or hnc[:4] == '192.' or hnc.startswith('localhost')):
|
||||
pass
|
||||
else:
|
||||
localbypass = False
|
||||
if nzbprov == 'newznab':
|
||||
if host_newznab_fix.startswith('http'):
|
||||
hnc = host_newznab_fix.replace('http://', '')
|
||||
elif host_newznab_fix.startswith('https'):
|
||||
hnc = host_newznab_fix.replace('https://', '')
|
||||
else:
|
||||
hnc = host_newznab_fix
|
||||
|
||||
if hnc[:3] == '10.' or hnc[:4] == '172.' or hnc[:4] == '192.' or hnc.startswith('localhost'):
|
||||
localbypass = True
|
||||
|
||||
if localbypass == False:
|
||||
logger.info("pausing for " + str(pause_the_search) + " seconds before continuing to avoid hammering")
|
||||
time.sleep(pause_the_search)
|
||||
|
||||
|
@ -833,7 +837,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
#let's do this here and save a few extra loops ;)
|
||||
#fix for issue dates between Nov-Dec/Jan
|
||||
if IssDateFix != "no" and UseFuzzy is not "2":
|
||||
if IssDateFix == "01" or IssDateFix == "02": ComicYearFix = int(ComicYear) - 1
|
||||
if IssDateFix == "01" or IssDateFix == "02" or IssDateFix == "03": ComicYearFix = int(ComicYear) - 1
|
||||
else: 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!")
|
||||
|
@ -1128,7 +1132,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
elif nzbprov == 'KAT':
|
||||
url_parts = urlparse.urlparse(entry['link'])
|
||||
path_parts = url_parts[2].rpartition('/')
|
||||
nzbtempid = pathparts[2]
|
||||
nzbtempid = path_parts[2]
|
||||
nzbid = re.sub('.torrent', '', nzbtempid).rstrip()
|
||||
elif nzbprov == 'nzb.su':
|
||||
pass
|
||||
|
|
|
@ -755,7 +755,7 @@ def forceRescan(ComicID,archive=None):
|
|||
else:
|
||||
for chk in chkthis:
|
||||
old_status = chk['Status']
|
||||
logger.fdebug('old_status:' + str(old_status))
|
||||
#logger.fdebug('old_status:' + str(old_status))
|
||||
if old_status == "Skipped":
|
||||
if mylar.AUTOWANT_ALL:
|
||||
issStatus = "Wanted"
|
||||
|
@ -774,7 +774,7 @@ def forceRescan(ComicID,archive=None):
|
|||
else:
|
||||
issStatus = "Skipped"
|
||||
|
||||
logger.fdebug("new status: " + str(issStatus))
|
||||
#logger.fdebug("new status: " + str(issStatus))
|
||||
|
||||
update_iss.append({"IssueID": chk['IssueID'],
|
||||
"Status": issStatus})
|
||||
|
|
|
@ -279,7 +279,11 @@ class WebInterface(object):
|
|||
mismatch = "no"
|
||||
logger.info('Attempting to add directly by ComicVineID: ' + str(comicid))
|
||||
if comicid.startswith('4050-'): comicid = re.sub('4050-','', comicid)
|
||||
importer.addComictoDB(comicid,mismatch)
|
||||
comicname, year = importer.addComictoDB(comicid,mismatch)
|
||||
if comicname is None:
|
||||
logger.error('There was an error during the add, check the mylar.log file for futher details.')
|
||||
else:
|
||||
logger.info('Sucessfully added ' + comicname + ' (' + str(year) + ') to your watchlist')
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
addbyid.exposed = True
|
||||
|
||||
|
@ -1904,10 +1908,13 @@ class WebInterface(object):
|
|||
implog = implog + "adding..." + str(result['ComicYear']) + "\n"
|
||||
yearRANGE.append(result['ComicYear'])
|
||||
yearTOP = str(result['ComicYear'])
|
||||
if int(getiss) > int(minISSUE):
|
||||
getiss_num = helpers.issuedigits(getiss)
|
||||
miniss_num = helpers.issuedigits(minISSUE)
|
||||
startiss_num = helpers.issuedigits(startISSUE)
|
||||
if int(getiss_num) > int(miniss_num):
|
||||
implog = implog + "issue now set to : " + str(getiss) + " ... it was : " + str(minISSUE) + "\n"
|
||||
minISSUE = str(getiss)
|
||||
if int(getiss) < int(startISSUE):
|
||||
if int(getiss_num) < int(startiss_num):
|
||||
implog = implog + "issue now set to : " + str(getiss) + " ... it was : " + str(startISSUE) + "\n"
|
||||
startISSUE = str(getiss)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue