mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Fix missing imports
This commit is contained in:
parent
aea37d3837
commit
ee8abc5d37
@ -152,7 +152,7 @@ def main():
|
|||||||
|
|
||||||
if args.list_sorts:
|
if args.list_sorts:
|
||||||
cur_color = 'zebra_0'
|
cur_color = 'zebra_0'
|
||||||
for key, value in sorted(sorts.items()):
|
for key, value in sorted(pirate.data.sorts.items()):
|
||||||
cur_color = 'zebra_0' if cur_color == 'zebra_1' else 'zebra_1'
|
cur_color = 'zebra_0' if cur_color == 'zebra_1' else 'zebra_1'
|
||||||
print(str(value), '\t', key, sep='', color=cur_color)
|
print(str(value), '\t', key, sep='', color=cur_color)
|
||||||
return
|
return
|
||||||
@ -257,11 +257,11 @@ def main():
|
|||||||
elif code == 'p':
|
elif code == 'p':
|
||||||
pirate.print.search_results(mags, sizes, uploaded)
|
pirate.print.search_results(mags, sizes, uploaded)
|
||||||
elif code == 'm':
|
elif code == 'm':
|
||||||
save_magnets(choices, mags,
|
pirate.torrent.save_magnets(choices, mags, config.get(
|
||||||
config.get('Save', 'directory'))
|
'Save', 'directory'))
|
||||||
elif code == 't':
|
elif code == 't':
|
||||||
save_torrents(choices, mags,
|
pirate.torrent.save_torrents(choices, mags, config.get(
|
||||||
config.get('Save', 'directory'))
|
'Save', 'directory'))
|
||||||
elif not l:
|
elif not l:
|
||||||
print('No links entered!', color='WARN')
|
print('No links entered!', color='WARN')
|
||||||
else:
|
else:
|
||||||
@ -274,14 +274,14 @@ def main():
|
|||||||
|
|
||||||
if args.save_magnets or config.getboolean('Save', 'magnets'):
|
if args.save_magnets or config.getboolean('Save', 'magnets'):
|
||||||
print('Saving selected magnets...')
|
print('Saving selected magnets...')
|
||||||
pirate.torrent.save_magnets(choices, mags,
|
pirate.torrent.save_magnets(choices, mags, config.get(
|
||||||
config.get('Save', 'directory'))
|
'Save', 'directory'))
|
||||||
save_to_file = True
|
save_to_file = True
|
||||||
|
|
||||||
if args.save_torrents or config.getboolean('Save', 'torrents'):
|
if args.save_torrents or config.getboolean('Save', 'torrents'):
|
||||||
print('Saving selected torrents...')
|
print('Saving selected torrents...')
|
||||||
pirate.torrent.save_torrents(choices, mags,
|
pirate.torrent.save_torrents(choices, mags, config.get(
|
||||||
config.get('Save', 'directory'))
|
'Save', 'directory'))
|
||||||
save_to_file = True
|
save_to_file = True
|
||||||
|
|
||||||
if save_to_file:
|
if save_to_file:
|
||||||
|
@ -80,9 +80,9 @@ def descriptions(chosen_links, mags, site, identifiers):
|
|||||||
for link in chosen_links:
|
for link in chosen_links:
|
||||||
link = int(link)
|
link = int(link)
|
||||||
path = '/torrent/%s/' % identifiers[link]
|
path = '/torrent/%s/' % identifiers[link]
|
||||||
req = request.Request(site + path, headers=default_headers)
|
req = request.Request(site + path, headers=pirate.data.default_headers)
|
||||||
req.add_header('Accept-encoding', 'gzip')
|
req.add_header('Accept-encoding', 'gzip')
|
||||||
f = request.urlopen(req, timeout=default_timeout)
|
f = request.urlopen(req, timeout=pirate.data.default_timeout)
|
||||||
|
|
||||||
if f.info().get('Content-Encoding') == 'gzip':
|
if f.info().get('Content-Encoding') == 'gzip':
|
||||||
f = gzip.GzipFile(fileobj=BytesIO(f.read()))
|
f = gzip.GzipFile(fileobj=BytesIO(f.read()))
|
||||||
@ -105,9 +105,10 @@ def file_lists(chosen_links, mags, site, identifiers):
|
|||||||
for link in chosen_links:
|
for link in chosen_links:
|
||||||
path = '/ajax_details_filelist.php'
|
path = '/ajax_details_filelist.php'
|
||||||
query = '?id=' + identifiers[int(link)]
|
query = '?id=' + identifiers[int(link)]
|
||||||
req = request.Request(site + path + query, headers=default_headers)
|
req = request.Request(site + path + query,
|
||||||
|
headers=pirate.data.default_headers)
|
||||||
req.add_header('Accept-encoding', 'gzip')
|
req.add_header('Accept-encoding', 'gzip')
|
||||||
f = request.urlopen(req, timeout=default_timeout)
|
f = request.urlopen(req, timeout=pirate.data.default_timeout)
|
||||||
|
|
||||||
if f.info().get('Content-Encoding') == 'gzip':
|
if f.info().get('Content-Encoding') == 'gzip':
|
||||||
f = gzip.GzipFile(fileobj=BytesIO(f.read()))
|
f = gzip.GzipFile(fileobj=BytesIO(f.read()))
|
||||||
|
Loading…
Reference in New Issue
Block a user