#!/usr/bin/liquidsoap set("init.daemon",true) set("init.daemon.pidfile",true) set("log.file.path", "/<путь к лог файлу>.log") set("init.daemon.pidfile.path", "/<путь к файлу процесса>.pid") set("log.level",1) output.file(%mp3(bitrate=128),"<путь куда писать архив>/%Y-%m-%d/%H/%H:%M:%S $(title).mp3",reopen_on_metadata=true,mksafe(input.http("http://sc.ultima.fm:8001/stream/1/stream.mp3")))
#!/usr/bin/liquidsoap set("init.daemon",true) set("init.daemon.pidfile",true) set("log.file.path", "/<путь к лог файлу>.log") set("init.daemon.pidfile.path", "/<путь к файлу процесса>.pid") set("log.level",1) output.file(%mp3(bitrate=128),"<путь куда писать архив>/%Y-%m-%d/%H/%H:%M:%S $(title).mp3",reopen_on_metadata=true,mksafe(input.http("ht tp://sc.ultima.fm:8001/stream/1/stream.mp3")))
def check_metadata(m) = title = get_process_output('php <абсолютный путь к папке проекта>/title.php "'^ m["title"] ^'"') [("title", "#{title}")] end source = mksafe(input.http("http://sc.ultima.fm:8001/stream/1/stream.mp3")) source = map_metadata(check_metadata, source) output.file(%mp3(bitrate=128),"<абсолютный путь к папке проекта>/records/%Y-%m-%d/%H/$(title).mp3", append=true, reopen_on_metadata=true, source)
<?php error_reporting(0); $file = "<абсолютный путь к папке проекта>/title.txt"; $stored_title = explode("::", file_get_contents($file)); if ((isset($argv[1])) and (strlen($argv[1]) !== 0) and ($argv[1] !== $stored_title[1])) { echo date("H:i:s") . " " . $argv[1]; $title = date("H:i:s") . "::" . $argv[1]; $file_to = fopen($file, "w+"); fwrite($file_to, $title); fclose($file_to); } else { echo $stored_title[0] . " " . $stored_title[1]; } ?>
2016/04/14 10:26:53 [http_4761:3] New metadata chunk: ? -- . 2016/04/14 10:26:54 [mksafe:3] Switch to http_4761 with transition. 2016/04/14 10:26:54 [map_metadata_4765:3] Inserting missing metadata. /home/worksart/ultimaback/title.php: 1: /home/worksart/ultimaback/title.php: cannot open ?php: No such file /home/worksart/ultimaback/title.php: 2: /home/worksart/ultimaback/title.php: Syntax error: word unexpected (expecting ")") 2016/04/14 10:26:54 [/home/worksart/ultimaback/%Y-%m-%d/%H/$(title)(dot)mp3:3] Re-opening output pipe... /home/worksart/ultimaback/title.php: 1: /home/worksart/ultimaback/title.php: cannot open ?php: No such file /home/worksart/ultimaback/title.php: 2: /home/worksart/ultimaback/title.php: Syntax error: word unexpected (expecting ")") 2016/04/14 10:26:55 [/home/worksart/ultimaback/%Y-%m-%d/%H/$(title)(dot)mp3:3] Re-opening output pipe...
whereis php
def check_metadata(m) = title = get_process_output('/usr/bin/php /home/worksart/ultimaback/title.php "'^ m["title"] ^'"') [("title", "#{title}")] end