1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-25 17:16:51 +00:00

FIX:(#886) when sending nzb link to SABnzbd, would incorrectly take the first apikey entry as the nzbkey, when it was the provider apikey, IMP:(#840) Snatch notification fix for Boxcar2, IMP: Publisher and series volume improvement when parsing search results.

This commit is contained in:
evilhero 2014-11-19 15:50:49 -05:00
parent 395ca8b75c
commit b8a478a93b
2 changed files with 41 additions and 33 deletions

View file

@ -254,7 +254,7 @@ class BOXCAR:
logger.fdebug(module + ' Boxcar2 notification successful.') logger.fdebug(module + ' Boxcar2 notification successful.')
return True return True
def notify(self, prline=None, prline2=None, sent_to=None, snatched_nzb=None, force=False, module=None): def notify(self, prline=None, prline2=None, sent_to=None, snatched_nzb=None, force=False, module=None, snline=None):
""" """
Sends a boxcar notification based on the provided info or SB config Sends a boxcar notification based on the provided info or SB config
@ -272,7 +272,7 @@ class BOXCAR:
# if no username was given then use the one from the config # if no username was given then use the one from the config
if snatched_nzb: if snatched_nzb:
title = "Mylar. Sucessfully Snatched!" title = snline
message = "Mylar has snatched: " + snatched_nzb + " and has sent it to " + sent_to message = "Mylar has snatched: " + snatched_nzb + " and has sent it to " + sent_to
else: else:
title = prline title = prline

View file

@ -775,6 +775,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
pub_removed = None pub_removed = None
while (cnt < lenm): while (cnt < lenm):
#print 'm[cnt]: ' + str(m[cnt])
if m[cnt] is None: break if m[cnt] is None: break
if m[cnt] == ' ': if m[cnt] == ' ':
pass pass
@ -826,26 +827,26 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
logger.fdebug(str(comyear) + " - not the right year.") logger.fdebug(str(comyear) + " - not the right year.")
elif UseFuzzy == "1": yearmatch = "true" elif UseFuzzy == "1": yearmatch = "true"
if Publisher is not None:
if Publisher.lower() in m[cnt].lower() and cnt >= 1: if Publisher.lower() in m[cnt].lower() and cnt >= 1:
#if the Publisher is given within the title or filename even (for some reason, some people #if the Publisher is given within the title or filename even (for some reason, some people
#have this to distinguish different titles), let's remove it entirely. #have this to distinguish different titles), let's remove it entirely.
logger.fdebug('Publisher detected within title : ' + str(m[cnt])) logger.fdebug('Publisher detected within title : ' + str(m[cnt]))
logger.fdebug('cnt is : ' + str(cnt) + ' --- Publisher is: ' + Publisher) logger.fdebug('cnt is : ' + str(cnt) + ' --- Publisher is: ' + Publisher)
pub_removed = m[cnt] pub_removed = m[cnt]
#-strip publisher if exists here- #-strip publisher if exists here-
logger.fdebug('removing publisher from title') logger.fdebug('removing publisher from title')
cleantitle_pubremoved = re.sub(pub_removed, '', cleantitle) cleantitle_pubremoved = re.sub(pub_removed, '', cleantitle)
logger.fdebug('pubremoved : ' + str(cleantitle_pubremoved)) logger.fdebug('pubremoved : ' + str(cleantitle_pubremoved))
cleantitle_pubremoved = re.sub('\(\)', '', cleantitle_pubremoved) #remove empty brackets cleantitle_pubremoved = re.sub('\(\)', '', cleantitle_pubremoved) #remove empty brackets
cleantitle_pubremoved = re.sub('\s+', ' ', cleantitle_pubremoved) #remove spaces > 1 cleantitle_pubremoved = re.sub('\s+', ' ', cleantitle_pubremoved) #remove spaces > 1
logger.fdebug('blank brackets removed: ' + str(cleantitle_pubremoved)) logger.fdebug('blank brackets removed: ' + str(cleantitle_pubremoved))
#reset the values to initial without the publisher in the title #reset the values to initial without the publisher in the title
m = re.findall('[^()]+', cleantitle_pubremoved) m = re.findall('[^()]+', cleantitle_pubremoved)
lenm = len(m) lenm = len(m)
cnt = 0 cnt = 0
yearmatch = "false" yearmatch = "false"
continue continue
if 'digital' in m[cnt] and len(m[cnt]) == 7: if 'digital' in m[cnt] and len(m[cnt]) == 7:
logger.fdebug("digital edition detected") logger.fdebug("digital edition detected")
pass pass
@ -860,7 +861,6 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
logger.fdebug("Scanner detected: " + str(m[cnt])) logger.fdebug("Scanner detected: " + str(m[cnt]))
result_comscanner = m[cnt] result_comscanner = m[cnt]
cnt+=1 cnt+=1
if yearmatch == "false": continue if yearmatch == "false": continue
splitit = [] splitit = []
@ -1174,7 +1174,12 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
#print comic_iss_b4 #print comic_iss_b4
#print comic_iss_b4[4:] #print comic_iss_b4[4:]
#splitit = comic_iss_b4[4:].split(None) #splitit = comic_iss_b4[4:].split(None)
cissb4this = re.sub("\\bthe\\b", "", comic_iss_b4) if cvers == "true":
use_this = cissb4vers
else:
use_this = comic_iss_b4
logger.fdebug('Use_This is : ' + str(use_this))
cissb4this = re.sub("\\bthe\\b", "", use_this) #comic_iss_b4)
splitit = cissb4this.split(None) splitit = cissb4this.split(None)
splitst = splitst - 1 #remove 'the' from start splitst = splitst - 1 #remove 'the' from start
logger.fdebug("comic is now : " + str(splitit))#str(comic_iss[4:])) logger.fdebug("comic is now : " + str(splitit))#str(comic_iss[4:]))
@ -1749,12 +1754,16 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
elif mylar.USE_SABNZBD: elif mylar.USE_SABNZBD:
# let's build the send-to-SAB string now: # let's build the send-to-SAB string now:
tmpapi = str(mylar.SAB_HOST)
logger.fdebug("send-to-SAB host string: " + str(tmpapi))
# changed to just work with direct links now... # changed to just work with direct links now...
SABtype = "/api?mode=addurl&name=" tmpapi = str(mylar.SAB_HOST) + "/api?apikey=" + str(mylar.SAB_APIKEY)
logger.fdebug("send-to-SAB host &api initiation string : " + str(helpers.apiremove(tmpapi,'&')))
fileURL = str(linkapi) fileURL = str(linkapi)
SABtype = "&mode=addurl&name="
tmpapi = tmpapi + str(SABtype) tmpapi = tmpapi + str(SABtype)
logger.fdebug("...selecting API type: " + str(tmpapi)) logger.fdebug("...selecting API type: " + str(tmpapi))
tmpapi = tmpapi + str(fileURL) tmpapi = tmpapi + str(fileURL)
@ -1775,8 +1784,6 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
tmpapi = tmpapi + "&script=ComicRN.py" tmpapi = tmpapi + "&script=ComicRN.py"
logger.fdebug("...attaching rename script: " + str(helpers.apiremove(tmpapi,'&'))) logger.fdebug("...attaching rename script: " + str(helpers.apiremove(tmpapi,'&')))
#final build of send-to-SAB #final build of send-to-SAB
tmpapi = tmpapi + "&apikey=" + str(mylar.SAB_APIKEY)
logger.fdebug("Completed send-to-SAB link: " + str(helpers.apiremove(tmpapi,'&'))) logger.fdebug("Completed send-to-SAB link: " + str(helpers.apiremove(tmpapi,'&')))
try: try:
@ -1808,6 +1815,8 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
def notify_snatch(nzbname, sent_to, modcomicname, comyear, IssueNumber, nzbprov): def notify_snatch(nzbname, sent_to, modcomicname, comyear, IssueNumber, nzbprov):
snline = modcomicname + ' (' + comyear + ') - Issue #' + IssueNumber + ' snatched!'
if mylar.PROWL_ENABLED and mylar.PROWL_ONSNATCH: if mylar.PROWL_ENABLED and mylar.PROWL_ONSNATCH:
logger.info(u"Sending Prowl notification") logger.info(u"Sending Prowl notification")
prowl = notifiers.PROWL() prowl = notifiers.PROWL()
@ -1815,20 +1824,19 @@ def notify_snatch(nzbname, sent_to, modcomicname, comyear, IssueNumber, nzbprov)
if mylar.NMA_ENABLED and mylar.NMA_ONSNATCH: if mylar.NMA_ENABLED and mylar.NMA_ONSNATCH:
logger.info(u"Sending NMA notification") logger.info(u"Sending NMA notification")
nma = notifiers.NMA() nma = notifiers.NMA()
snline = modcomicname + ' (' + comyear + ') - Issue #' + IssueNumber + ' snatched!'
nma.notify(snline=snline,snatched_nzb=nzbname,sent_to=sent_to,prov=nzbprov) nma.notify(snline=snline,snatched_nzb=nzbname,sent_to=sent_to,prov=nzbprov)
if mylar.PUSHOVER_ENABLED and mylar.PUSHOVER_ONSNATCH: if mylar.PUSHOVER_ENABLED and mylar.PUSHOVER_ONSNATCH:
logger.info(u"Sending Pushover notification") logger.info(u"Sending Pushover notification")
thisline = 'Mylar has snatched: ' + nzbname + ' from ' + nzbprov + ' and has sent it to ' + sent_to
pushover = notifiers.PUSHOVER() pushover = notifiers.PUSHOVER()
pushover.notify(nzbname,"Download started using " + sent_to) pushover.notify(thisline,snline)
if mylar.BOXCAR_ENABLED and mylar.BOXCAR_ONSNATCH: if mylar.BOXCAR_ENABLED and mylar.BOXCAR_ONSNATCH:
logger.info(u"Sending Boxcar notification") logger.info(u"Sending Boxcar notification")
boxcar = notifiers.BOXCAR() boxcar = notifiers.BOXCAR()
boxcar.notify(snatched_nzb=nzbname,sent_to=sent_to) boxcar.notify(snatched_nzb=nzbname,sent_to=sent_to,snline=snline)
if mylar.PUSHBULLET_ENABLED and mylar.PUSHBULLET_ONSNATCH: if mylar.PUSHBULLET_ENABLED and mylar.PUSHBULLET_ONSNATCH:
logger.info(u"Sending Pushbullet notification") logger.info(u"Sending Pushbullet notification")
pushbullet = notifiers.PUSHBULLET() pushbullet = notifiers.PUSHBULLET()
snline = modcomicname + ' (' + comyear + ') - Issue #' + IssueNumber + ' snatched!'
pushbullet.notify(snline=snline,snatched=nzbname,sent_to=sent_to,prov=nzbprov) pushbullet.notify(snline=snline,snatched=nzbname,sent_to=sent_to,prov=nzbprov)
return return