mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-11 11:33:59 +01:00
Redacted: use a FL token when available
- Use a FL token when available - Added a configuration (default off) to enable the feature - Skip prefetching the data with Deluge as with Transmission in `preprocess()` - Note: because QBittorrent & uTorrent need the data to compute the torrenthash but still require the url to download the file, it will result in 2 FL tokens used instead of one because the .torrent will be downloaded twice from the server. Fixes #3163
This commit is contained in:
@@ -401,14 +401,15 @@ class GazelleAPI(object):
|
||||
|
||||
return {'curr_page': curr_page, 'pages': pages, 'results': matching_torrents}
|
||||
|
||||
def generate_torrent_link(self, id):
|
||||
url = "%storrents.php?action=download&id=%s&authkey=%s&torrent_pass=%s" %\
|
||||
(self.site, id, self.logged_in_user.authkey, self.logged_in_user.passkey)
|
||||
def generate_torrent_link(self, id, use_token=False):
|
||||
url = "%storrents.php?action=download&id=%s&authkey=%s&torrent_pass=%s&usetoken=%d" %\
|
||||
(self.site, id, self.logged_in_user.authkey, self.logged_in_user.passkey, use_token)
|
||||
return url
|
||||
|
||||
def save_torrent_file(self, id, dest):
|
||||
def save_torrent_file(self, id, dest, use_token=False):
|
||||
file_data = self.unparsed_request("torrents.php", 'download',
|
||||
id=id, authkey=self.logged_in_user.authkey, torrent_pass=self.logged_in_user.passkey)
|
||||
id=id, authkey=self.logged_in_user.authkey, torrent_pass=self.logged_in_user.passkey,
|
||||
usetoken=int(use_token))
|
||||
with open(dest, 'w+') as dest_file:
|
||||
dest_file.write(file_data)
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ class Torrent(object):
|
||||
self.snatched = search_torrent_json_response['snatches']
|
||||
self.free_torrent = search_torrent_json_response['isFreeleech'] or search_torrent_json_response['isPersonalFreeleech']
|
||||
self.time = search_torrent_json_response['time']
|
||||
self.can_use_token = search_torrent_json_response.get('canUseToken', False)
|
||||
|
||||
def set_torrent_top_10_data(self, top_10_json_response):
|
||||
if self.id != top_10_json_response['torrentId']:
|
||||
|
||||
Reference in New Issue
Block a user