mirror of
https://github.com/evilhero/mylar
synced 2024-12-25 17:16:51 +00:00
FIX:(#1010) Possible fix for sending urls via nzb.su provider, FIX: Incorrect download url being passed to nzbget, FIX: Fix for duplication of keys being generated when sending to SABnzbd
This commit is contained in:
parent
173b9304fe
commit
b144daa474
1 changed files with 18 additions and 13 deletions
|
@ -1647,18 +1647,22 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
||||||
headers = {'User-Agent': str(mylar.USER_AGENT)}
|
headers = {'User-Agent': str(mylar.USER_AGENT)}
|
||||||
#link doesn't have the apikey - add it and use ?t=get for newznab based.
|
#link doesn't have the apikey - add it and use ?t=get for newznab based.
|
||||||
|
|
||||||
if nzbprov == 'newznab':
|
if nzbprov == 'newznab' or nzbprov == 'nzb.su':
|
||||||
#need to basename the link so it just has the id/hash.
|
#need to basename the link so it just has the id/hash.
|
||||||
#rss doesn't store apikey, have to put it back.
|
#rss doesn't store apikey, have to put it back.
|
||||||
name_newznab = newznab[0].rstrip()
|
if nzbprov == 'newznab':
|
||||||
host_newznab = newznab[1].rstrip()
|
name_newznab = newznab[0].rstrip()
|
||||||
if host_newznab[len(host_newznab)-1:len(host_newznab)] != '/':
|
host_newznab = newznab[1].rstrip()
|
||||||
host_newznab_fix = str(host_newznab) + "/"
|
if host_newznab[len(host_newznab)-1:len(host_newznab)] != '/':
|
||||||
else:
|
host_newznab_fix = str(host_newznab) + "/"
|
||||||
host_newznab_fix = host_newznab
|
else:
|
||||||
|
host_newznab_fix = host_newznab
|
||||||
|
|
||||||
apikey = newznab[2].rstrip()
|
apikey = newznab[2].rstrip()
|
||||||
down_url = host_newznab_fix + 'api'
|
down_url = host_newznab_fix + 'api'
|
||||||
|
else:
|
||||||
|
down_url = 'https://api.nzb.su/api'
|
||||||
|
apikey = mylar.NZBSU_APIKEY
|
||||||
|
|
||||||
payload = {'t': 'get',
|
payload = {'t': 'get',
|
||||||
'id': str(nzbid),
|
'id': str(nzbid),
|
||||||
|
@ -1772,12 +1776,13 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
||||||
else:
|
else:
|
||||||
uid = newznab[3].strip()
|
uid = newznab[3].strip()
|
||||||
|
|
||||||
if any( ['&r=' not in linkapi, '&i=' not in linkapi, '&apikey=' not in linkapi] ):
|
if any( ['&r=' not in linkapi, '&i=' not in linkapi ] ) and ('&apikey=' not in linkapi):
|
||||||
fileURL = urllib.quote_plus(linkapi + '&i=' + uid + '&r=' + apikey)
|
fileURL = urllib.quote_plus(linkapi + '&i=' + uid + '&r=' + apikey)
|
||||||
else:
|
else:
|
||||||
fileURL = urllib.quote_plus(linkapi)
|
fileURL = urllib.quote_plus(linkapi)
|
||||||
else:
|
else:
|
||||||
fileURL = urllib.quote_plus(linkapi + '&r=' + apikey) # + '&i=' + uid + '&r=' + apikey)
|
#for nzb.su
|
||||||
|
fileURL = urllib.quote_plus(downurl + '&i=' + mylar.NZBSU_UID + '&r=' + mylar.NZBSU_APIKEY)
|
||||||
elif nzbprov == 'dognzb':
|
elif nzbprov == 'dognzb':
|
||||||
linkapi = down_url
|
linkapi = down_url
|
||||||
fileURL = urllib.quote_plus(down_url)
|
fileURL = urllib.quote_plus(down_url)
|
||||||
|
@ -1866,7 +1871,7 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
||||||
tmpapi = str(tmpapi) + str(mylar.NZBGET_USERNAME) + ":" + str(mylar.NZBGET_PASSWORD)
|
tmpapi = str(tmpapi) + str(mylar.NZBGET_USERNAME) + ":" + str(mylar.NZBGET_PASSWORD)
|
||||||
tmpapi = str(tmpapi) + "@" + str(nzbget_host) + ":" + str(mylar.NZBGET_PORT) + "/xmlrpc"
|
tmpapi = str(tmpapi) + "@" + str(nzbget_host) + ":" + str(mylar.NZBGET_PORT) + "/xmlrpc"
|
||||||
server = ServerProxy(tmpapi)
|
server = ServerProxy(tmpapi)
|
||||||
send_to_nzbget = server.appendurl(nzbname + ".nzb", str(mylar.NZBGET_CATEGORY), int(nzbgetpriority), True, linkapi)
|
send_to_nzbget = server.appendurl(nzbname + ".nzb", str(mylar.NZBGET_CATEGORY), int(nzbgetpriority), True, fileURL)
|
||||||
sent_to = "NZBGet"
|
sent_to = "NZBGet"
|
||||||
if send_to_nzbget is True:
|
if send_to_nzbget is True:
|
||||||
logger.info("Successfully sent nzb to NZBGet!")
|
logger.info("Successfully sent nzb to NZBGet!")
|
||||||
|
@ -1907,7 +1912,7 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
||||||
#final build of send-to-SAB
|
#final build of send-to-SAB
|
||||||
logger.fdebug("Completed send-to-SAB link: " + str(helpers.apiremove(tmpapi,'&')))
|
logger.fdebug("Completed send-to-SAB link: " + str(helpers.apiremove(tmpapi,'&')))
|
||||||
|
|
||||||
logger.info('sab-to-send:' + str(tmpapi))
|
logger.fdebug('sab-to-send:' + str(tmpapi))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from lib.requests.packages.urllib3 import disable_warnings
|
from lib.requests.packages.urllib3 import disable_warnings
|
||||||
|
|
Loading…
Reference in a new issue