mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-02 09:49:36 +01:00
Creating set_proxy, which generates proxy urls
Making it a function reduces the amount of repetition.
This commit is contained in:
@@ -895,23 +895,24 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None):
|
|||||||
pre_sorted_results = False
|
pre_sorted_results = False
|
||||||
minimumseeders = int(headphones.NUMBEROFSEEDERS) - 1
|
minimumseeders = int(headphones.NUMBEROFSEEDERS) - 1
|
||||||
|
|
||||||
|
def set_proxy(proxy_url):
|
||||||
|
if not proxy_url.startswith('http'):
|
||||||
|
proxy_url = 'http://' + proxy_url
|
||||||
|
if proxy_url.endswith('/'):
|
||||||
|
proxy_url = proxy_url[:-1]
|
||||||
|
|
||||||
|
return proxy_url
|
||||||
|
|
||||||
|
|
||||||
if headphones.KAT:
|
if headphones.KAT:
|
||||||
provider = "Kick Ass Torrents"
|
provider = "Kick Ass Torrents"
|
||||||
|
|
||||||
if headphones.KAT_PROXY_URL:
|
if headphones.KAT_PROXY_URL:
|
||||||
#Might need to clean up the user submitted url
|
proxy_url = set_proxy(headphones.KAT_PROXY_URL)
|
||||||
kat_proxy = headphones.KAT_PROXY_URL
|
providerurl = url_fix(proxy_url + "/usearch/" + term)
|
||||||
|
|
||||||
if not kat_proxy.startswith('http'):
|
|
||||||
kat_proxy = 'http://' + kat_proxy
|
|
||||||
if kat_proxy.endswith('/'):
|
|
||||||
kat_proxy = kat_proxy[:-1]
|
|
||||||
|
|
||||||
providerurl = url_fix(kat_proxy + "/usearch/" + term)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
providerurl = url_fix("http://kickass.to/usearch/" + term)
|
providerurl = url_fix("http://kickass.to/usearch/" + term)
|
||||||
|
|
||||||
if headphones.PREFERRED_QUALITY == 3 or losslessOnly:
|
if headphones.PREFERRED_QUALITY == 3 or losslessOnly:
|
||||||
categories = "7" #music
|
categories = "7" #music
|
||||||
format = "2" #flac
|
format = "2" #flac
|
||||||
@@ -1156,16 +1157,8 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None):
|
|||||||
if headphones.PIRATEBAY:
|
if headphones.PIRATEBAY:
|
||||||
provider = "The Pirate Bay"
|
provider = "The Pirate Bay"
|
||||||
if headphones.PIRATEBAY_PROXY_URL:
|
if headphones.PIRATEBAY_PROXY_URL:
|
||||||
#Might need to clean up the user submitted url
|
proxy_url = set_proxy(headphones.PIRATEBAY_PROXY_URL)
|
||||||
pirate_proxy = headphones.PIRATEBAY_PROXY_URL
|
providerurl = url_fix(proxy_url + "/search/" + term + "/0/99/")
|
||||||
|
|
||||||
if not pirate_proxy.startswith('http'):
|
|
||||||
pirate_proxy = 'http://' + pirate_proxy
|
|
||||||
if pirate_proxy.endswith('/'):
|
|
||||||
pirate_proxy = pirate_proxy[:-1]
|
|
||||||
|
|
||||||
providerurl = url_fix(pirate_proxy + "/search/" + term + "/0/99/")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
providerurl = url_fix("http://thepiratebay.se/search/" + term + "/0/99/")
|
providerurl = url_fix("http://thepiratebay.se/search/" + term + "/0/99/")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user