From 8708bd0fe27077115de254e71b51e7192ff58f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 17 Mar 2023 21:08:58 +0100 Subject: radio --- radio/milo.ls | 11 +++++++++-- radio/radio.php | 38 ++++++++++++++++++++++++++++++++++++++ radio/radio.py | 15 ++++++++------- 3 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 radio/radio.php diff --git a/radio/milo.ls b/radio/milo.ls index 61560fc..fa47b72 100755 --- a/radio/milo.ls +++ b/radio/milo.ls @@ -1,6 +1,13 @@ #!/usr/bin/env liquidsoap set("server.socket", true) set("server.socket.path", "/tmp/ls") -radio = fallback([request.queue(id="request"), single("/home/z/tmp/rem.flac")], track_sensitive=false) +# radio = fallback([request.queue(id="request"), single("/home/z/tmp/rem.flac")], track_sensitive=false) +radio = request.queue(id="request") +radio = normalize(radio) +radio = crossfade(radio) +radio = skip_blank(radio) +# radio = sine() # out(radio) -output.icecast(%vorbis, host="tranzistor",port=8000,password="hackme", mount="radio_nolive.ogg", radio) +radio = fallback([radio, single("/home/z/tmp/rem.flac")], track_sensitive=false) +output.icecast(%ogg(%flac(compression=8)), host="tranzistor", port=8000, password="hackme", mount="travnik", radio) +output.icecast(%opus, host="tranzistor", port=8000, password="hackme", mount="travnik.opus", radio) diff --git a/radio/radio.php b/radio/radio.php new file mode 100644 index 0000000..4c8bf3f --- /dev/null +++ b/radio/radio.php @@ -0,0 +1,38 @@ + +radijski pretok neprestano teče že +
+do konca komada je še . +
+
+ +
+ +poročilo: zahteva za preskok komada je bila uspešno poslana. počakaj nekaj sekund, da se zgodi crossfade. preveri, da si na koncu pretoka! + +
+metapodatki o komadu in o prej predvajanih komadih: +
+
+
+
diff --git a/radio/radio.py b/radio/radio.py index 5106813..c9fd156 100755 --- a/radio/radio.py +++ b/radio/radio.py @@ -53,7 +53,7 @@ def random_file(torrent, save_path, endung=".flac"): print(f"random file {torrent.torrent_file().files().file_path(get_index_from_endung(chosen))} chosen to download") return True -def watcher(session, torrents, s, d, active_torrents=10): +def watcher(session, torrents, s, d, active_torrents=1): i = inotify.adapters.Inotify() i.add_watch(d) for event in i.event_gen(yield_nones=False): @@ -101,7 +101,7 @@ def stream(playstack, unix=None): while True: if len(playstack) == 0: # print("stream: no songs in playstack") - print(playstack) + # print(playstack) sleep(1) continue # sock = socket(AF_INET, SOCK_STREAM) @@ -111,16 +111,17 @@ def stream(playstack, unix=None): sock.sendall(b"request.alive\r\n") sleep(1) data = sock.recv(256) - print(f"stream: remote said {data}") + # print(f"stream: remote said {data}") a = data.split(b"\r")[0] - if a == b"" or a == b"0": + if len(a.split(b" ")) < 3: komad = playstack.pop() # komad = "/tmp/o.flac" + # sock.sendall(b"request.push annotate:filename=\"" + bytes(komad, encoding="utf-8") + b"\":" + bytes(komad, encoding="utf-8") + b"\r\n") sock.sendall(b"request.push " + bytes(komad, encoding="utf-8") + b"\r\n") print(f"stream: REQUESTING PLAYBACK of {komad}") sleep(1) - else: - print(f"stream: remote returned that {a} is playing") + # else: + # print(f"stream: remote returned that {a} is playing") else: while True: if len(playstack) == 0: @@ -134,7 +135,7 @@ def progress(session, torrents): while True: for torr in torrents: s = torr.status() - print(torr.torrent_file().name() + '\t%.2f%% complete (down: %.1f kB/s up: %.1f kB/s peers: %d) %s' % (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, s.num_peers, s.state)) + # print(torr.torrent_file().name() + '\t%.2f%% complete (down: %.1f kB/s up: %.1f kB/s peers: %d) %s' % (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, s.num_peers, s.state)) sleep(1) if __name__ == "__main__": -- cgit v1.2.3