summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-03-16 16:57:52 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-03-16 16:57:52 +0100
commit79e913bd969daff3e4b42ed481ddbb4b0ab58884 (patch)
treebb0cbcc6f0e8f519dd2ce2625df6be830596c0dc
parentno torrent_log_alert (diff)
downloadtravnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar.gz
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar.bz2
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar.lz
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar.xz
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.tar.zst
travnik-79e913bd969daff3e4b42ed481ddbb4b0ab58884.zip
-rwxr-xr-xradio/radio.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/radio/radio.py b/radio/radio.py
index cdfb7a7..b9806ca 100755
--- a/radio/radio.py
+++ b/radio/radio.py
@@ -80,6 +80,7 @@ def alerts(session, playstack, save_path, torrents):
print(f"error notification alert from libtorrent: {a}")
if type(a) == libtorrent.file_completed_alert:
if a.handle.get_file_priorities()[a.index] != 4:
+ print(f"alerts: IT LOOKS LIKE THIS FILE WAS CHECKED FROM CACHE")
continue
playstack.append(a.handle.torrent_file().files().file_path(a.index))
if not random_file(a.handle, save_path):
@@ -88,7 +89,7 @@ def alerts(session, playstack, save_path, torrents):
continue
else:
a.handle.resume()
- if type(a) in [libtorrent.external_ip_alert, libtorrent.listen_succeeded_alert, libtorrent.dht_get_peers_alert, libtorrent.dht_outgoing_get_peers_alert, libtorrent.dht_reply_alert, libtorrent.torrent_added_alert, libtorrent.state_changed_alert, libtorrent.torrent_resumed_alert, libtorrent.stats_alert, libtorrent.torrent_checked_alert, libtorrent.peer_connect_alert, libtorrent.alert, libtorrent.peer_disconnected_alert, libtorrent.incoming_connection_alert, libtorrent.block_downloading_alert, libtorrent.dht_bootstrap_alert, libtorrent.dht_announce_alert, libtorrent.block_finished_alert, libtorrent.piece_finished_alert, libtorrent.peer_unsnubbed_alert, libtorrent.peer_snubbed_alert, libtorrent.portmap_error_alert, libtorrent.block_timeout_alert, libtorrent.block_uploaded_alert, libtorrent.performance_alert, libtorrent.cache_flushed_alert, libtorrent.dht_log_alert, libtorrent.portmap_log_alert, libtorrent.dht_pkt_alert, libtorrent.log_alert, libtorrent.peer_log_alert, libtorrent.picker_log_alert, libtorrent.torrent_log_alert]:
+ if type(a) in [libtorrent.external_ip_alert, libtorrent.listen_succeeded_alert, libtorrent.dht_get_peers_alert, libtorrent.dht_outgoing_get_peers_alert, libtorrent.dht_reply_alert, libtorrent.torrent_added_alert, libtorrent.state_changed_alert, libtorrent.torrent_resumed_alert, libtorrent.stats_alert, libtorrent.torrent_checked_alert, libtorrent.peer_connect_alert, libtorrent.alert, libtorrent.peer_disconnected_alert, libtorrent.incoming_connection_alert, libtorrent.block_downloading_alert, libtorrent.dht_bootstrap_alert, libtorrent.dht_announce_alert, libtorrent.block_finished_alert, libtorrent.piece_finished_alert, libtorrent.peer_unsnubbed_alert, libtorrent.peer_snubbed_alert, libtorrent.portmap_error_alert, libtorrent.block_timeout_alert, libtorrent.block_uploaded_alert, libtorrent.performance_alert, libtorrent.cache_flushed_alert, libtorrent.dht_log_alert, libtorrent.portmap_log_alert, libtorrent.dht_pkt_alert, libtorrent.log_alert, libtorrent.peer_log_alert, libtorrent.picker_log_alert, libtorrent.torrent_log_alert, libtorrent.file_prio_alert, libtorrent.torrent_finished_alert]:
continue
print(f"{type(a)} | {a}")
@@ -98,13 +99,15 @@ def stream(playstack, unix=None):
# sock = socket(AF_INET, SOCK_STREAM)
# sock.connect("tranzistor", 1234)
sock = socket(AF_UNIX, SOCK_STREAM)
- sock.connect("/tmp/ls")
+ sock.connect(unix)
sock.sendall(b"request.alive\r\n")
sleep(1)
data = sock.recv(256)
a = data.split(b"\r")[0]
if a == b"":
- sock.sendall(b"request.push " + bytes(playstack.pop(), encoding="utf-8"))
+ komad = playstack.pop()
+ sock.sendall(b"request.push " + bytes(komad, encoding="utf-8"))
+ print(f"stream: REQUESTING PLAYBACK of {komad}")
sleep(1)
else:
while True: