diff options
| author | 2018-09-26 20:39:24 +0100 | |
|---|---|---|
| committer | 2018-09-26 20:39:24 +0100 | |
| commit | 9a7b93928b344310fec4935a266223c0d9bd5fa7 (patch) | |
| tree | defe4a527abb2c983816eae1cfeab91f70fdd3c2 /modules | |
| parent | Create delimited|multiple|events from the correct EventHook when using (diff) | |
| signature | ||
Didn't mean to commit this module yet.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/torrent.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/modules/torrent.py b/modules/torrent.py deleted file mode 100644 index fdc3221d..00000000 --- a/modules/torrent.py +++ /dev/null @@ -1,49 +0,0 @@ -#--ignore - -import tempfile, time -import libtorrent - -def magnet(magnet): - #log.info("Opening session for link %s", url) - - session = libtorrent.session() - session.add_extension('ut_metadata') - session.add_extension('ut_pex') - session.add_extension('metadata_transfer') - session.add_dht_router("router.utorrent.com", 6881) - session.add_dht_router("router.bittorrent.com", 6881) - session.add_dht_router("dht.transmissionbt.com", 6881) - session.add_dht_router("dht.aelitis.com", 6881) - session.start_dht() - session.start_lsd() - session.start_upnp() - session.start_natpmp() - - params = {'save_path': "/dev/null", 'duplicate_is_error': True, - 'storage_mode': libtorrent.storage_mode_t(2), 'paused': False, - 'auto_managed': True} - handle = libtorrent.add_magnet_uri(session, magnet, params) - - #log.info("Waiting metadata") - has_metadata = False - for i in range(10): - if handle.has_metadata(): - print("yes!") - has_metadata = True - break - else: - time.sleep(1) - if not has_metadata: - print("no!") - #event["stderr"].write("Timed out getting magnet info") - return - session.pause() - - #log.info("Metadata retrieved") - torrent_info = handle.get_torrent_info() - print(dir(torrent_info)) - - session.remove_torrent(handle) - #log.info("Torrent file saved to %s", file_path) - -magnet("magnet:?xt=urn:btih:ea5938cbb6176a675a3e71682faf9801b5b6116f") |
