Compare commits

...
11 Commits
Author SHA1 Message Date
rembo10 b71c0d8b93 v0.5.18 2016-12-01 15:59:35 +00:00
rembo10 0ecfe499fc Updated changelog for v0.5.18 2016-12-01 15:59:11 +00:00
rembo10 68d85841ea Merge remote-tracking branch 'DenzoNL/master' into develop 2016-12-01 15:52:46 +00:00
rembo10 1ffcc177a4 Merge remote-tracking branch 'MIKAd3v/develop' into develop 2016-12-01 15:51:01 +00:00
rembo10 2230c5bc0c Merge remote-tracking branch 'wfriesen/develop' into develop 2016-12-01 15:49:58 +00:00
Denzo 352b009e91 # Removed slash from ajax.php 2016-11-29 20:54:20 +01:00
Denzo b6b33e1b1e + Added support for PassTheHeadphones.me
% Removed hardcoding for What.CD in pygazelle API, making it easy to add other Gazelle-based trackers

+ Added URL parameter for What.CD and PTH, in case they come back under a new domain name
2016-11-29 20:49:52 +01:00
massiliattak dff1ac2e41 Update T411 new domain ( t411.li ) 2016-11-20 20:15:37 +01:00
William Friesen 92601e0eb8 Use HTML escaping for password fields
Fixes rembo10/headphones#2474
2016-11-19 12:15:22 +11:00
rembo10 6e82423947 Merge remote-tracking branch 'Betree/search_with_partial_dates' into develop 2016-11-10 21:07:04 +00:00
Benjamin Piouffle c77f43be5e Accept partial release date for search 2016-10-25 19:21:16 +11:00
6 changed files with 205 additions and 29 deletions
+11
View File
@@ -1,5 +1,16 @@
# Changelog # Changelog
## v0.5.18
Released 01 December 2016
Highlights:
* Added: PassTheHeadphones support
* Fixed: Special characters in password fields breaking on config page
* Improved: Updated t411 url
The full list of commits can be found [here](https://github.com/rembo10/headphones/compare/v0.5.17...v0.5.18).
## v0.5.17 ## v0.5.17
Released 10 November 2016 Released 10 November 2016
+46 -17
View File
@@ -56,7 +56,7 @@
<label title="Password for web server authentication. Leave empty to disable."> <label title="Password for web server authentication. Leave empty to disable.">
HTTP Password HTTP Password
</label> </label>
<input type="password" name="http_password" value="${config['http_password']}" size="30"> <input type="password" name="http_password" value="${config['http_password'] | h}" size="30">
</div> </div>
<div class="row checkbox"> <div class="row checkbox">
<input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} /> <input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} />
@@ -173,7 +173,7 @@
<label title="SABnzbd password. Leave empty if not applicable."> <label title="SABnzbd password. Leave empty if not applicable.">
SABnzbd Password SABnzbd Password
</label> </label>
<input type="password" name="sab_password" value="${config['sab_password']}" size="20"> <input type="password" name="sab_password" value="${config['sab_password'] | h}" size="20">
</div> </div>
<div class="row"> <div class="row">
<label title="SABnzbd API key. Can be found in SABnzbd settings."> <label title="SABnzbd API key. Can be found in SABnzbd settings.">
@@ -207,7 +207,7 @@
<label title="NZBGet password. Leave empty if not applicable"> <label title="NZBGet password. Leave empty if not applicable">
NZBget Password NZBget Password
</label> </label>
<input type="password" name="nzbget_password" value="${config['nzbget_password']}" size="20"> <input type="password" name="nzbget_password" value="${config['nzbget_password'] | h}" size="20">
</div> </div>
<div class="row"> <div class="row">
<label title="Name of NZBget category to add downloads to."> <label title="Name of NZBget category to add downloads to.">
@@ -359,7 +359,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>Transmission Password</label> <label>Transmission Password</label>
<input type="password" name="transmission_password" value="${config['transmission_password']}" size="30"> <input type="password" name="transmission_password" value="${config['transmission_password'] | h}" size="30">
</div> </div>
<div class="row"> <div class="row">
<small>Note: With Transmission, you can specify a different download directory for downloads sent from Headphones. <small>Note: With Transmission, you can specify a different download directory for downloads sent from Headphones.
@@ -379,7 +379,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>uTorrent Password</label> <label>uTorrent Password</label>
<input type="password" name="utorrent_password" value="${config['utorrent_password']}" size="30"> <input type="password" name="utorrent_password" value="${config['utorrent_password'] | h}" size="30">
</div> </div>
<div class="row"> <div class="row">
<label>uTorrent Label</label> <label>uTorrent Label</label>
@@ -400,7 +400,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>Deluge Password</label> <label>Deluge Password</label>
<input type="password" name="deluge_password" value="${config['deluge_password']}" size="30"> <input type="password" name="deluge_password" value="${config['deluge_password'] | h}" size="30">
</div> </div>
<div class="row"> <div class="row">
<small>Note: With Deluge, you can specify a different download directory for downloads sent from Headphones. <small>Note: With Deluge, you can specify a different download directory for downloads sent from Headphones.
@@ -466,7 +466,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>Password</label> <label>Password</label>
<input class="hppass" type="password" value="${config['hppass']}" size="20"> <input class="hppass" type="password" value="${config['hppass'] | h}" size="20">
</div> </div>
<div class="row"> <div class="row">
<a href="https://headphones.codeshy.com/vip" id="vipserver" target="_blank">Don't have an account? Sign up!</a> <a href="https://headphones.codeshy.com/vip" id="vipserver" target="_blank">Don't have an account? Sign up!</a>
@@ -622,7 +622,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>Password</label> <label>Password</label>
<input type="password" name="rutracker_password" value="${config['rutracker_password']}" size="36"> <input type="password" name="rutracker_password" value="${config['rutracker_password'] | h}" size="36">
</div> </div>
<div class="row"> <div class="row">
<label>Seed Ratio</label> <label>Seed Ratio</label>
@@ -642,7 +642,11 @@
</div> </div>
<div class="row"> <div class="row">
<label>Password</label> <label>Password</label>
<input type="password" name="whatcd_password" value="${config['whatcd_password']}" size="36"> <input type="password" name="whatcd_password" value="${config['whatcd_password'] | h}" size="36">
</div>
<div class="row">
<label>URL</label>
<input type="text" name="whatcd_url" value="${config['whatcd_url']}" size="36">
</div> </div>
<div class="row"> <div class="row">
<label>Seed Ratio</label> <label>Seed Ratio</label>
@@ -651,6 +655,30 @@
</div> </div>
</fieldset> </fieldset>
<fieldset>
<div class="row checkbox left">
<input id="use_pth" type="checkbox" class="bigcheck" name="use_pth" value="1" ${config['use_pth']} /><label for="use_pth"><span class="option">PassTheHeadphones.me</span></label>
</div>
<div class="config">
<div class="row">
<label>Username</label>
<input type="text" name="pth_username" value="${config['pth_username']}" size="36">
</div>
<div class="row">
<label>Password</label>
<input type="password" name="pth_password" value="${config['pth_password']}" size="36">
</div>
<div class="row">
<label>URL</label>
<input type="text" name="pth_url" value="${config['pth_url']}" size="36">
</div>
<div class="row">
<label>Seed Ratio</label>
<input type="text" class="override-float" name="pth_ratio" value="${config['pth_ratio']}" size="10" title="Stop seeding when ratio met, 0 = unlimited. Scheduled job will remove torrent when post processed and finished seeding">
</div>
</div>
</fieldset>
<fieldset> <fieldset>
<div class="row checkbox left"> <div class="row checkbox left">
<input id="use_strike" type="checkbox" class="bigcheck" name="use_strike" value="1" ${config['use_strike']} /><label for="use_strike"><span class="option">Strike Search</span></label> <input id="use_strike" type="checkbox" class="bigcheck" name="use_strike" value="1" ${config['use_strike']} /><label for="use_strike"><span class="option">Strike Search</span></label>
@@ -755,7 +783,7 @@
</div> </div>
<div class="row"> <div class="row">
<label>Password</label> <label>Password</label>
<input type="password" name="tquattrecentonze_password" value="${config['tquattrecentonze_password']}" size="36"> <input type="password" name="tquattrecentonze_password" value="${config['tquattrecentonze_password'] | h}" size="36">
</div> </div>
</div> </div>
</fieldset> </fieldset>
@@ -980,7 +1008,7 @@
<label>SMTP User</label><input type="text" name="email_smtp_user" value="${config['email_smtp_user']}" size="254"> <label>SMTP User</label><input type="text" name="email_smtp_user" value="${config['email_smtp_user']}" size="254">
</div> </div>
<div class="row"> <div class="row">
<label>SMTP Password</label><input type="password" name="email_smtp_password" value="${config['email_smtp_password']}" size="50"> <label>SMTP Password</label><input type="password" name="email_smtp_password" value="${config['email_smtp_password'] | h}" size="50">
</div> </div>
<div class="row checkbox"> <div class="row checkbox">
<input type="text" class="override-float" name="email_smtp_port" value="${config['email_smtp_port']}" size="4"><label>SMTP Port</label> <input type="text" class="override-float" name="email_smtp_port" value="${config['email_smtp_port']}" size="4"><label>SMTP Port</label>
@@ -1006,7 +1034,7 @@
<label>Growl Host:Port</label><input type="text" name="growl_host" value="${config['growl_host']}" size="30"> <label>Growl Host:Port</label><input type="text" name="growl_host" value="${config['growl_host']}" size="30">
</div> </div>
<div class="row"> <div class="row">
<label>Growl Password</label><input type="password" name="growl_password" value="${config['growl_password']}" size="30"> <label>Growl Password</label><input type="password" name="growl_password" value="${config['growl_password'] | h}" size="30">
</div> </div>
<div class="row checkbox"> <div class="row checkbox">
<input type="checkbox" name="growl_onsnatch" value="1" ${config['growl_onsnatch']} /><label>Notify on snatch?</label> <input type="checkbox" name="growl_onsnatch" value="1" ${config['growl_onsnatch']} /><label>Notify on snatch?</label>
@@ -1028,7 +1056,7 @@
<label>Username</label><input type="text" name="xbmc_username" value="${config['xbmc_username']}" size="30"> <label>Username</label><input type="text" name="xbmc_username" value="${config['xbmc_username']}" size="30">
</div> </div>
<div class="row"> <div class="row">
<label>Password</label><input type="password" name="xbmc_password" value="${config['xbmc_password']}" size="30"> <label>Password</label><input type="password" name="xbmc_password" value="${config['xbmc_password'] | h}" size="30">
</div> </div>
<div class="checkbox row"> <div class="checkbox row">
<input type="checkbox" name="xbmc_update" value="1" ${config['xbmc_update']} /><label>Update Library</label> <input type="checkbox" name="xbmc_update" value="1" ${config['xbmc_update']} /><label>Update Library</label>
@@ -1142,7 +1170,7 @@
<small>Username of your Plex client API (blank for none)</small> <small>Username of your Plex client API (blank for none)</small>
</div> </div>
<div class="row"> <div class="row">
<label>Plex Password</label><input type="password" name="plex_password" value="${config['plex_password']}" size="30"> <label>Plex Password</label><input type="password" name="plex_password" value="${config['plex_password'] | h}" size="30">
<small>Password of your Plex client API (blank for none)</small> <small>Password of your Plex client API (blank for none)</small>
</div> </div>
<div class="row"> <div class="row">
@@ -1242,7 +1270,7 @@
<label>Subsonic Username</label><input type="text" name="subsonic_username" value="${config['subsonic_username']}" size="30"> <label>Subsonic Username</label><input type="text" name="subsonic_username" value="${config['subsonic_username']}" size="30">
</div> </div>
<div class="row"> <div class="row">
<label>Subsonic Password</label><input type="password" name="subsonic_password" value="${config['subsonic_password']}" size="30"> <label>Subsonic Password</label><input type="password" name="subsonic_password" value="${config['subsonic_password'] | h}" size="30">
</div> </div>
</div> </div>
</fieldset> </fieldset>
@@ -1642,7 +1670,7 @@
<label>Username</label><input type="text" class="customuser" name="customuser" value="${config['customuser']}" size="20"> <label>Username</label><input type="text" class="customuser" name="customuser" value="${config['customuser']}" size="20">
</div> </div>
<div class="row"> <div class="row">
<label>Password</label><input type="password" class="custompass" name="custompass" value="${config['custompass']}" size="15"><br> <label>Password</label><input type="password" class="custompass" name="custompass" value="${config['custompass'] | h}" size="15"><br>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@@ -1655,7 +1683,7 @@
<label>Username</label><input type="text" class="hpuser" name="hpuser" value="${config['hpuser']}" size="20"> <label>Username</label><input type="text" class="hpuser" name="hpuser" value="${config['hpuser']}" size="20">
</div> </div>
<div class="row"> <div class="row">
<label>Password</label><input type="password" class="hppass" name="hppass" value="${config['hppass']}" size="20"><br> <label>Password</label><input type="password" class="hppass" name="hppass" value="${config['hppass'] | h}" size="20"><br>
<a href="https://headphones.codeshy.com/vip" id="vipserver" target="_blank">Get an Account!</a> <a href="https://headphones.codeshy.com/vip" id="vipserver" target="_blank">Get an Account!</a>
</div> </div>
</div> </div>
@@ -2412,6 +2440,7 @@
initConfigCheckbox("#use_waffles"); initConfigCheckbox("#use_waffles");
initConfigCheckbox("#use_rutracker"); initConfigCheckbox("#use_rutracker");
initConfigCheckbox("#use_whatcd"); initConfigCheckbox("#use_whatcd");
initConfigCheckbox("#use_pth");
initConfigCheckbox("#use_strike"); initConfigCheckbox("#use_strike");
initConfigCheckbox("#api_enabled"); initConfigCheckbox("#api_enabled");
initConfigCheckbox("#enable_https"); initConfigCheckbox("#enable_https");
+6
View File
@@ -293,6 +293,12 @@ _CONFIG_DEFINITIONS = {
'WHATCD_PASSWORD': (str, 'What.cd', ''), 'WHATCD_PASSWORD': (str, 'What.cd', ''),
'WHATCD_RATIO': (str, 'What.cd', ''), 'WHATCD_RATIO': (str, 'What.cd', ''),
'WHATCD_USERNAME': (str, 'What.cd', ''), 'WHATCD_USERNAME': (str, 'What.cd', ''),
'WHATCD_URL': (str, 'What.cd', 'https://what.cd'),
'PTH': (int, 'PassTheHeadphones.me', 0),
'PTH_PASSWORD': (str, 'PassTheHeadphones.me', ''),
'PTH_RATIO': (str, 'PassTheHeadphones.me', ''),
'PTH_USERNAME': (str, 'PassTheHeadphones.me', ''),
'PTH_URL': (str, 'PassTheHeadphones.me', 'https://passtheheadphones.me'),
'XBMC_ENABLED': (int, 'XBMC', 0), 'XBMC_ENABLED': (int, 'XBMC', 0),
'XBMC_HOST': (str, 'XBMC', ''), 'XBMC_HOST': (str, 'XBMC', ''),
'XBMC_NOTIFY': (int, 'XBMC', 0), 'XBMC_NOTIFY': (int, 'XBMC', 0),
+133 -9
View File
@@ -38,7 +38,6 @@ from headphones import logger, db, helpers, classes, sab, nzbget, request
from headphones import utorrent, transmission, notifiers, rutracker, deluge from headphones import utorrent, transmission, notifiers, rutracker, deluge
from bencode import bencode, bdecode from bencode import bencode, bdecode
# Magnet to torrent services, for Black hole. Stolen from CouchPotato. # Magnet to torrent services, for Black hole. Stolen from CouchPotato.
TORRENT_TO_MAGNET_SERVICES = [ TORRENT_TO_MAGNET_SERVICES = [
# 'https://zoink.it/torrent/%s.torrent', # 'https://zoink.it/torrent/%s.torrent',
@@ -163,6 +162,8 @@ def get_seed_ratio(provider):
seed_ratio = headphones.CONFIG.KAT_RATIO seed_ratio = headphones.CONFIG.KAT_RATIO
elif provider == 'What.cd': elif provider == 'What.cd':
seed_ratio = headphones.CONFIG.WHATCD_RATIO seed_ratio = headphones.CONFIG.WHATCD_RATIO
elif provider == 'PassTheHeadphones.Me':
seed_ratio = headphones.CONFIG.PTH_RATIO
elif provider == 'The Pirate Bay': elif provider == 'The Pirate Bay':
seed_ratio = headphones.CONFIG.PIRATEBAY_RATIO seed_ratio = headphones.CONFIG.PIRATEBAY_RATIO
elif provider == 'Old Pirate Bay': elif provider == 'Old Pirate Bay':
@@ -201,14 +202,13 @@ def searchforalbum(albumid=None, new=False, losslessOnly=False,
continue continue
if headphones.CONFIG.WAIT_UNTIL_RELEASE_DATE and album['ReleaseDate']: if headphones.CONFIG.WAIT_UNTIL_RELEASE_DATE and album['ReleaseDate']:
try: release_date = strptime_musicbrainz(album['ReleaseDate'])
release_date = datetime.datetime.strptime(album['ReleaseDate'], "%Y-%m-%d") if not release_date:
except: logger.warn("No valid date for: %s. Skipping automatic search" %
logger.warn( album['AlbumTitle'])
"No valid date for: %s. Skipping automatic search" % album['AlbumTitle'])
continue continue
if release_date > datetime.datetime.today(): elif release_date > datetime.datetime.today():
logger.info("Skipping: %s. Waiting for release date of: %s" % ( logger.info("Skipping: %s. Waiting for release date of: %s" % (
album['AlbumTitle'], album['ReleaseDate'])) album['AlbumTitle'], album['ReleaseDate']))
continue continue
@@ -237,6 +237,26 @@ def searchforalbum(albumid=None, new=False, losslessOnly=False,
logger.info('Search for wanted albums complete') logger.info('Search for wanted albums complete')
def strptime_musicbrainz(date_str):
"""
Release date as returned by Musicbrainz may contain the full date (Year-Month-Day)
but it may as well be just Year-Month or even just the year.
Args:
date_str: the date as a string (ex: "2003-05-01", "2003-03", "2003")
Returns:
The more accurate datetime object we can create or None if parse failed
"""
acceptable_formats = ('%Y-%m-%d', '%Y-%m', '%Y')
for date_format in acceptable_formats:
try:
return datetime.datetime.strptime(date_str, date_format)
except:
pass
return None
def do_sorted_search(album, new, losslessOnly, choose_specific_download=False): def do_sorted_search(album, new, losslessOnly, choose_specific_download=False):
NZB_PROVIDERS = (headphones.CONFIG.HEADPHONES_INDEXER or NZB_PROVIDERS = (headphones.CONFIG.HEADPHONES_INDEXER or
headphones.CONFIG.NEWZNAB or headphones.CONFIG.NEWZNAB or
@@ -255,6 +275,7 @@ def do_sorted_search(album, new, losslessOnly, choose_specific_download=False):
headphones.CONFIG.WAFFLES or headphones.CONFIG.WAFFLES or
headphones.CONFIG.RUTRACKER or headphones.CONFIG.RUTRACKER or
headphones.CONFIG.WHATCD or headphones.CONFIG.WHATCD or
headphones.CONFIG.PTH or
headphones.CONFIG.STRIKE) headphones.CONFIG.STRIKE)
results = [] results = []
@@ -1485,7 +1506,8 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
try: try:
logger.info(u"Attempting to log in to What.cd...") logger.info(u"Attempting to log in to What.cd...")
gazelle = gazelleapi.GazelleAPI(headphones.CONFIG.WHATCD_USERNAME, gazelle = gazelleapi.GazelleAPI(headphones.CONFIG.WHATCD_USERNAME,
headphones.CONFIG.WHATCD_PASSWORD) headphones.CONFIG.WHATCD_PASSWORD,
headphones.CONFIG.WHATCD_URL)
gazelle._login() gazelle._login()
except Exception as e: except Exception as e:
gazelle = None gazelle = None
@@ -1545,6 +1567,106 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
provider, provider,
'torrent', True)) 'torrent', True))
# PassTheHeadphones.me - Using same logic as What.CD as it's also Gazelle, so should really make this into something reusable
if headphones.CONFIG.PTH:
provider = "PassTheHeadphones.me"
providerurl = "https://passtheheadphones.me/"
bitrate = None
bitrate_string = bitrate
if headphones.CONFIG.PREFERRED_QUALITY == 3 or losslessOnly: # Lossless Only mode
search_formats = [gazelleformat.FLAC]
maxsize = 10000000000
elif headphones.CONFIG.PREFERRED_QUALITY == 2: # Preferred quality mode
search_formats = [None] # should return all
bitrate = headphones.CONFIG.PREFERRED_BITRATE
if bitrate:
if 225 <= int(bitrate) < 256:
bitrate = 'V0'
elif 200 <= int(bitrate) < 225:
bitrate = 'V1'
elif 175 <= int(bitrate) < 200:
bitrate = 'V2'
for encoding_string in gazelleencoding.ALL_ENCODINGS:
if re.search(bitrate, encoding_string, flags=re.I):
bitrate_string = encoding_string
if bitrate_string not in gazelleencoding.ALL_ENCODINGS:
logger.info(
u"Your preferred bitrate is not one of the available What.cd filters, so not using it as a search parameter.")
maxsize = 10000000000
elif headphones.CONFIG.PREFERRED_QUALITY == 1 or allow_lossless: # Highest quality including lossless
search_formats = [gazelleformat.FLAC, gazelleformat.MP3]
maxsize = 10000000000
else: # Highest quality excluding lossless
search_formats = [gazelleformat.MP3]
maxsize = 300000000
if not gazelle or not gazelle.logged_in():
try:
logger.info(u"Attempting to log in to PassTheHeadphones.me...")
gazelle = gazelleapi.GazelleAPI(headphones.CONFIG.PTH_USERNAME,
headphones.CONFIG.PTH_PASSWORD,
headphones.CONFIG.PTH_URL)
gazelle._login()
except Exception as e:
gazelle = None
logger.error(u"PassTheHeadphones credentials incorrect or site is down. Error: %s %s" % (
e.__class__.__name__, str(e)))
if gazelle and gazelle.logged_in():
logger.info(u"Searching %s..." % provider)
all_torrents = []
for search_format in search_formats:
if usersearchterm:
all_torrents.extend(
gazelle.search_torrents(searchstr=usersearchterm, format=search_format,
encoding=bitrate_string)['results'])
else:
all_torrents.extend(gazelle.search_torrents(artistname=semi_clean_artist_term,
groupname=semi_clean_album_term,
format=search_format,
encoding=bitrate_string)['results'])
# filter on format, size, and num seeders
logger.info(u"Filtering torrents by format, maximum size, and minimum seeders...")
match_torrents = [t for t in all_torrents if
t.size <= maxsize and t.seeders >= minimumseeders]
logger.info(
u"Remaining torrents: %s" % ", ".join(repr(torrent) for torrent in match_torrents))
# sort by times d/l'd
if not len(match_torrents):
logger.info(u"No results found from %s for %s after filtering" % (provider, term))
elif len(match_torrents) > 1:
logger.info(u"Found %d matching releases from %s for %s - %s after filtering" %
(len(match_torrents), provider, artistterm, albumterm))
logger.info(
"Sorting torrents by times snatched and preferred bitrate %s..." % bitrate_string)
match_torrents.sort(key=lambda x: int(x.snatched), reverse=True)
if gazelleformat.MP3 in search_formats:
# sort by size after rounding to nearest 10MB...hacky, but will favor highest quality
match_torrents.sort(key=lambda x: int(10 * round(x.size / 1024. / 1024. / 10.)),
reverse=True)
if search_formats and None not in search_formats:
match_torrents.sort(
key=lambda x: int(search_formats.index(x.format))) # prefer lossless
# if bitrate:
# match_torrents.sort(key=lambda x: re.match("mp3", x.getTorrentDetails(), flags=re.I), reverse=True)
# match_torrents.sort(key=lambda x: str(bitrate) in x.getTorrentFolderName(), reverse=True)
logger.info(
u"New order: %s" % ", ".join(repr(torrent) for torrent in match_torrents))
for torrent in match_torrents:
if not torrent.file_path:
torrent.group.update_group_data() # will load the file_path for the individual torrents
resultlist.append((torrent.file_path,
torrent.size,
gazelle.generate_torrent_link(torrent.id),
provider,
'torrent', True))
# Pirate Bay # Pirate Bay
if headphones.CONFIG.PIRATEBAY: if headphones.CONFIG.PIRATEBAY:
provider = "The Pirate Bay" provider = "The Pirate Bay"
@@ -1782,7 +1904,7 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
if headphones.CONFIG.TQUATTRECENTONZE: if headphones.CONFIG.TQUATTRECENTONZE:
username = headphones.CONFIG.TQUATTRECENTONZE_USER username = headphones.CONFIG.TQUATTRECENTONZE_USER
password = headphones.CONFIG.TQUATTRECENTONZE_PASSWORD password = headphones.CONFIG.TQUATTRECENTONZE_PASSWORD
API_URL = "http://api.t411.ch" API_URL = "http://api.t411.li"
AUTH_URL = API_URL + '/auth' AUTH_URL = API_URL + '/auth'
DL_URL = API_URL + '/torrents/download/' DL_URL = API_URL + '/torrents/download/'
provider = "t411" provider = "t411"
@@ -1888,6 +2010,8 @@ def preprocess(resultlist):
headers['User-Agent'] = USER_AGENT headers['User-Agent'] = USER_AGENT
elif result[3] == 'What.cd': elif result[3] == 'What.cd':
headers['User-Agent'] = 'Headphones' headers['User-Agent'] = 'Headphones'
elif result[3] == 'PassTheHeadphones.me':
headers['User-Agent'] = 'Headphones'
elif result[3] == "The Pirate Bay" or result[3] == "Old Pirate Bay": elif result[3] == "The Pirate Bay" or result[3] == "Old Pirate Bay":
headers[ headers[
'User-Agent'] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2243.2 Safari/537.36' 'User-Agent'] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2243.2 Safari/537.36'
+6
View File
@@ -1228,6 +1228,12 @@ class WebInterface(object):
"whatcd_username": headphones.CONFIG.WHATCD_USERNAME, "whatcd_username": headphones.CONFIG.WHATCD_USERNAME,
"whatcd_password": headphones.CONFIG.WHATCD_PASSWORD, "whatcd_password": headphones.CONFIG.WHATCD_PASSWORD,
"whatcd_ratio": headphones.CONFIG.WHATCD_RATIO, "whatcd_ratio": headphones.CONFIG.WHATCD_RATIO,
"whatcd_url": headphones.CONFIG.WHATCD_URL,
"use_pth": checked(headphones.CONFIG.PTH),
"pth_username": headphones.CONFIG.PTH_USERNAME,
"pth_password": headphones.CONFIG.PTH_PASSWORD,
"pth_ratio": headphones.CONFIG.PTH_RATIO,
"pth_url": headphones.CONFIG.PTH_URL,
"use_strike": checked(headphones.CONFIG.STRIKE), "use_strike": checked(headphones.CONFIG.STRIKE),
"strike_ratio": headphones.CONFIG.STRIKE_RATIO, "strike_ratio": headphones.CONFIG.STRIKE_RATIO,
"use_tquattrecentonze": checked(headphones.CONFIG.TQUATTRECENTONZE), "use_tquattrecentonze": checked(headphones.CONFIG.TQUATTRECENTONZE),
+3 -3
View File
@@ -42,7 +42,7 @@ class GazelleAPI(object):
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'} 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'}
def __init__(self, username=None, password=None): def __init__(self, username=None, password=None, url=None):
self.session = requests.session() self.session = requests.session()
self.session.headers = self.default_headers self.session.headers = self.default_headers
self.username = username self.username = username
@@ -59,7 +59,7 @@ class GazelleAPI(object):
self.cached_torrents = {} self.cached_torrents = {}
self.cached_requests = {} self.cached_requests = {}
self.cached_categories = {} self.cached_categories = {}
self.site = "https://what.cd/" self.site = url + "/"
self.past_request_timestamps = [] self.past_request_timestamps = []
def wait_for_rate_limit(self): def wait_for_rate_limit(self):
@@ -95,7 +95,7 @@ class GazelleAPI(object):
self.wait_for_rate_limit() self.wait_for_rate_limit()
loginpage = 'https://what.cd/login.php' loginpage = self.site + 'login.php'
data = {'username': self.username, data = {'username': self.username,
'password': self.password, 'password': self.password,
'keeplogged': '1'} 'keeplogged': '1'}