1
0
Fork 0

expand libtorrent

This commit is contained in:
Mateusz Konieczny 2025-02-05 18:49:45 +01:00
parent 1827c90894
commit df11af8552

View file

@ -1,4 +1,4 @@
import libtorrent as lt
import libtorrent
import time
import sys
from datetime import datetime
@ -9,7 +9,7 @@ config = __import__("0_config")
def main():
print(datetime.now().isoformat(timespec='minutes'))
ses = lt.session({'listen_interfaces': '0.0.0.0:6881'})
ses = libtorrent.session({'listen_interfaces': '0.0.0.0:6881'})
torrent_file_directory = config.cache_folder()
filename = 'planet-latest.osm.pbf.torrent'
@ -19,7 +19,7 @@ def main():
url = 'https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf.torrent'
osm_bot_abstraction_layer.util_download_file.download_file_if_not_present_already(url, torrent_file_directory, filename)
info = lt.torrent_info(torrent_file_directory + filename)
info = libtorrent.torrent_info(torrent_file_directory + filename)
h = ses.add_torrent({'ti': info, 'save_path': config.planet_download_folder()})
s = h.status()
print('starting', s.name)
@ -33,7 +33,7 @@ def main():
alerts = ses.pop_alerts()
for a in alerts:
if a.category() & lt.alert.category_t.error_notification:
if a.category() & libtorrent.alert.category_t.error_notification:
print(a)
sys.stdout.flush()