diff --git a/pirate/pirate.py b/pirate/pirate.py index e3ae9dc..15ad1e5 100755 --- a/pirate/pirate.py +++ b/pirate/pirate.py @@ -152,7 +152,7 @@ def main(): if args.list_sorts: 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' print(str(value), '\t', key, sep='', color=cur_color) return @@ -257,11 +257,11 @@ def main(): elif code == 'p': pirate.print.search_results(mags, sizes, uploaded) elif code == 'm': - save_magnets(choices, mags, - config.get('Save', 'directory')) + pirate.torrent.save_magnets(choices, mags, config.get( + 'Save', 'directory')) elif code == 't': - save_torrents(choices, mags, - config.get('Save', 'directory')) + pirate.torrent.save_torrents(choices, mags, config.get( + 'Save', 'directory')) elif not l: print('No links entered!', color='WARN') else: @@ -274,14 +274,14 @@ def main(): if args.save_magnets or config.getboolean('Save', 'magnets'): print('Saving selected magnets...') - pirate.torrent.save_magnets(choices, mags, - config.get('Save', 'directory')) + pirate.torrent.save_magnets(choices, mags, config.get( + 'Save', 'directory')) save_to_file = True if args.save_torrents or config.getboolean('Save', 'torrents'): print('Saving selected torrents...') - pirate.torrent.save_torrents(choices, mags, - config.get('Save', 'directory')) + pirate.torrent.save_torrents(choices, mags, config.get( + 'Save', 'directory')) save_to_file = True if save_to_file: diff --git a/pirate/print.py b/pirate/print.py index 7e0f612..f3e2e83 100644 --- a/pirate/print.py +++ b/pirate/print.py @@ -80,9 +80,9 @@ def descriptions(chosen_links, mags, site, identifiers): for link in chosen_links: link = int(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') - f = request.urlopen(req, timeout=default_timeout) + f = request.urlopen(req, timeout=pirate.data.default_timeout) if f.info().get('Content-Encoding') == 'gzip': f = gzip.GzipFile(fileobj=BytesIO(f.read())) @@ -105,9 +105,10 @@ def file_lists(chosen_links, mags, site, identifiers): for link in chosen_links: path = '/ajax_details_filelist.php' 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') - f = request.urlopen(req, timeout=default_timeout) + f = request.urlopen(req, timeout=pirate.data.default_timeout) if f.info().get('Content-Encoding') == 'gzip': f = gzip.GzipFile(fileobj=BytesIO(f.read()))