mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 12:19:27 +00: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
|
||||
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:
|
||||
provider = "Kick Ass Torrents"
|
||||
|
||||
|
||||
if headphones.KAT_PROXY_URL:
|
||||
#Might need to clean up the user submitted url
|
||||
kat_proxy = headphones.KAT_PROXY_URL
|
||||
|
||||
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)
|
||||
|
||||
proxy_url = set_proxy(headphones.KAT_PROXY_URL)
|
||||
providerurl = url_fix(proxy_url + "/usearch/" + term)
|
||||
else:
|
||||
providerurl = url_fix("http://kickass.to/usearch/" + term)
|
||||
|
||||
|
||||
if headphones.PREFERRED_QUALITY == 3 or losslessOnly:
|
||||
categories = "7" #music
|
||||
format = "2" #flac
|
||||
@@ -1156,16 +1157,8 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None):
|
||||
if headphones.PIRATEBAY:
|
||||
provider = "The Pirate Bay"
|
||||
if headphones.PIRATEBAY_PROXY_URL:
|
||||
#Might need to clean up the user submitted url
|
||||
pirate_proxy = headphones.PIRATEBAY_PROXY_URL
|
||||
|
||||
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/")
|
||||
|
||||
proxy_url = set_proxy(headphones.PIRATEBAY_PROXY_URL)
|
||||
providerurl = url_fix(proxy_url + "/search/" + term + "/0/99/")
|
||||
else:
|
||||
providerurl = url_fix("http://thepiratebay.se/search/" + term + "/0/99/")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user