FIX:(#503) inclusion of 1/4 issues, FIX:(#505) Versioning now removed from filenames in filechecker, FIX:(#504) Enable_RSS would reset to enabled on every update/Also added additional checking, IMP: KAT integration buildup

This commit is contained in:
evilhero 2013-08-07 02:27:12 -04:00
parent a7fd194099
commit 176de5b92a
7 changed files with 95 additions and 38 deletions

View File

@ -85,7 +85,7 @@
%elif comic['ComicPublisher'] == 'ShadowLine':
<img src="interfaces/default/images/publisherlogos/logo-shadowline.png" align="right" alt="Shadowline" height="75" width="100"/>
%elif comic['ComicPublisher'] == 'Archie Comics':
<img src="interfaces/default/images/publisherlogos/logo-archiecomics.jpg" align="right" alt="Archie" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-archiecomics.jpg" align="right" alt="Archie" height="75" width="75"/>
%elif comic['ComicPublisher'] == 'Oni Press':
<img src="interfaces/default/images/publisherlogos/logo-onipress.png" align="right" alt="Oni Press" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Tokyopop':

View File

@ -227,7 +227,7 @@ BIGGIE_PUB = 55
ENABLE_META = 0
CMTAGGER_PATH = None
ENABLE_RSS = 1
ENABLE_RSS = 0
RSS_CHECKINTERVAL = 20
RSS_LASTRUN = None

View File

@ -67,7 +67,7 @@ def listFiles(dir,watchcomic,AlternateSearch=None):
#subname = os.path.join(basedir, item)
subname = item
#versioning - remove it
subsplit = subname.split()
subsplit = subname.split('_')
volrem = None
for subit in subsplit:
#print ("subit:" + str(subit))
@ -90,9 +90,10 @@ def listFiles(dir,watchcomic,AlternateSearch=None):
volrem = subit
#remove the brackets..
subname = re.findall('[^()]+', subname)
logger.fdebug("subname no brackets: " + str(subname[0]))
subname = re.sub('\_', ' ', subname[0])
subnm = re.findall('[^()]+', subname)
subname = subnm[0]
logger.fdebug("subname no brackets: " + str(subname))
subname = re.sub('\_', ' ', subname)
nonocount = 0
charpos = 0
detneg = "no"

View File

@ -639,6 +639,12 @@ def issuedigits(issnum):
elif u'\xbd' in issnum:
issnum = .5
int_issnum = int(issnum) * 1000
elif u'\xbc' in issnum:
issnum = .25
int_issnum = int(issnum) * 1000
elif u'\xbe' in issnum:
issnum = .75
int_issnum = int(issnum) * 1000
elif '.' in issnum or ',' in issnum:
logger.fdebug("decimal detected.")
if ',' in issnum: issnum = re.sub(',','.', issnum)

View File

@ -602,6 +602,12 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
elif u'\xbd' in issnum:
issnum = .5
int_issnum = int(issnum) * 1000
elif u'\xbc' in issnum:
issnum = .25
int_issnum = int(issnum) * 1000
elif u'\xbe' in issnum:
issnum = .75
int_issnum = int(issnum) * 1000
elif '.' in issnum or ',' in issnum:
if ',' in issnum: issnum = re.sub(',','.', issnum)
issst = str(issnum).find('.')

View File

@ -56,16 +56,23 @@ def tehMain():
logger.fdebug("[RSS] Watchlist Check complete.")
return
def torrents(pickfeed=None):
def torrents(pickfeed=None,seriesname=None,issue=None):
if pickfeed is None:
pickfeed = 1
#else:
# print "pickfeed is " + str(pickfeed)
passkey = mylar.CBT_PASSKEY
srchterm = None
if seriesname:
srchterm = re.sub(' ', '%20', seriesname)
if issue:
srchterm += ' ' + str(issue)
if pickfeed == "1": # comicbt rss feed based on followlist
feed = "http://comicbt.com/rss.php?action=browse&passkey=" + str(passkey) + "&type=dl"
elif pickfeed == "2": # kat.ph search
feed = "http://kat.ph/usearch/" + str(seriesname) + "%20category%3Acomics%20seeds%3A1/?rss=1"
elif pickfeed == "2" and srchterm is not None: # kat.ph search
feed = "http://kat.ph/usearch/" + str(srchterm) + "%20category%3Acomics%20seeds%3A1/?rss=1"
elif pickfeed == "3": # kat.ph rss feed
feed = "http://kat.ph/usearch/category%3Acomics%20seeds%3A1/?rss=1"
elif pickfeed == "4": #comicbt follow link
@ -90,9 +97,11 @@ def torrents(pickfeed=None):
feeddata = []
myDB = db.DBConnection()
torthekat = []
katinfo = {}
for entry in feedme['entries']:
if pickfeed == "2" or pickfeed == "3":
if pickfeed == "3":
tmpsz = feedme.entries[i].enclosures[0]
feeddata.append({
'Site': 'KAT',
@ -102,10 +111,20 @@ def torrents(pickfeed=None):
'Size': tmpsz['length']
})
#print ("Site: KAT")
#print ("Title: " + str(feeddata[i]['Title']))
#print ("Link: " + str(feeddata[i]['Link']))
#print ("pubdate: " + str(feeddata[i]['Pubdate']))
elif pickfeed == "2":
tmpsz = feedme.entries[i].enclosures[0]
torthekat.append({
'title': feedme.entries[i].title,
'link': tmpsz['url'],
'pubdate': feedme.entries[i].updated,
'site': 'KAT',
'length': tmpsz['length']
})
print ("Site: KAT")
print ("Title: " + str(feedme.entries[i].title))
print ("Link: " + str(tmpsz['url']))
print ("pubdate: " + str(feedme.entries[i].updated))
print ("size: " + str(tmpsz['length']))
elif pickfeed == "1" or pickfeed == "4":
# tmpsz = feedme.entries[i].enclosures[0]
@ -122,7 +141,11 @@ def torrents(pickfeed=None):
#print ("pubdate: " + str(feeddata[i]['Pubdate']))
i+=1
logger.fdebug("there were " + str(i) + " results..")
rssdbupdate(feeddata,i,'torrent')
if not seriesname:
rssdbupdate(feeddata,i,'torrent')
else:
katinfo['entries'] = torthekat
return katinfo
return
def nzbs(provider=None):

View File

@ -67,7 +67,9 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
torprovider.append('cbt')
torp+=1
#print torprovider[0]
elif mylar.ENABLE_KAT:
torprovider.append('kat')
torp+=1
##nzb provider selection##
##'dognzb' or 'nzb.su' or 'experimental'
nzbprovider = []
@ -132,35 +134,47 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
if torprovider[torpr] == 'cbt':
# ComicBT
torprov = 'ComicBT'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, torprov, torpr, IssDateFix, IssueID, UseFuzzy, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, ComicID=ComicID)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None and AlternateSearch != "None":
chkthealt = AlternateSearch.split('##')
if chkthealt == 0:
AS_Alternate = AlternateSearch
loopit = len(chkthealt)
for calt in chkthealt:
AS_Alternate = re.sub('##','',calt)
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AS_Alternate) + " " + str(ComicYear))
findit = NZB_SEARCH(AS_Alternate, IssueNumber, ComicYear, SeriesYear, torprov, torp, IssDateFix, IssueID, UseFuzzy, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, ComicID=ComicID)
if findit == 'yes':
break
elif torprovider[torpr] == 'kat':
torprov = 'KAT'
torpr-=1
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, torprov, torpr, IssDateFix, IssueID, UseFuzzy, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, ComicID=ComicID)
if findit == 'yes':
logger.fdebug("findit = found!")
break
else:
if AlternateSearch is not None and AlternateSearch != "None":
chkthealt = AlternateSearch.split('##')
if chkthealt == 0:
AS_Alternate = AlternateSearch
loopit = len(chkthealt)
for calt in chkthealt:
AS_Alternate = re.sub('##','',calt)
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AS_Alternate) + " " + str(ComicYear))
findit = NZB_SEARCH(AS_Alternate, IssueNumber, ComicYear, SeriesYear, torprov, torp, IssDateFix, IssueID, UseFuzzy, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, ComicID=ComicID)
if findit == 'yes':
break
torpr-=1
if findit == 'yes': return findit, torprov
searchcnt = 0
nzbprov = None
if rsscheck:
searchcnt = 1 # rss-only
else:
searchcnt = 2 # rss first, then api on non-matches
i = 1
if rsscheck:
if mylar.ENABLE_RSS:
searchcnt = 1 # rss-only
else:
searchcnt = 0 # if it's not enabled, don't even bother.
else:
if mylar.ENABLE_RSS:
searchcnt = 2 # rss first, then api on non-matches
else:
searchcnt = 2 #set the searchcnt to 2 (api)
i = 2 #start the counter at api, so it will exit without running RSS
nzbsrchproviders = nzbpr
while ( i <= searchcnt ):
@ -477,7 +491,12 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
bb = rsscheck.torrentdbsearch(cmname,isssearch,ComicID)
rss = "yes"
if bb is not None: logger.fdebug("results: " + str(bb))
elif nzbprov == 'KAT':
cmname = re.sub("%20", " ", str(comsrc))
logger.fdebug("Sending request to [KAT] for " + str(cmname) + " : " + str(isssearch))
bb = rsscheck.torrents(pickfeed='2',seriesname=cmname,issue=isssearch)
rss = "no"
if bb is not None: logger.fdebug("results: " + str(bb))
elif nzbprov != 'experimental':
if nzbprov == 'dognzb':
findurl = "http://dognzb.cr/api?t=search&q=" + str(comsearch) + "&o=xml&cat=7030"
@ -557,6 +576,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#Experimental already has size constraints done.
if nzbprov == 'ComicBT':
comsize_b = 0 #CBT rss doesn't have sizes
elif nzbprov == 'KAT':
comsize_b = entry['length']
else:
tmpsz = entry.enclosures[0]
comsize_b = tmpsz['length']