From: Isabel V. R. <is...@sp...> - 2013-05-17 08:40:57
|
Hey guys, Just to give you an idea of what I am attempting, here is the code I have so far: set("log.file.path","liquidsoap.log") set( "log.level", 5 ) radio = fallback() def create_dynamic_request(param) request.dynamic({ request.create("bar:foo", indicators=get_process_lines("cat "^quote(param))) }) end def reload_all_streams() indicators=list.hd(get_process_lines("cat "^quote("playlist.txt"))) log(indicators) param = string.split(separator="\|",indicators) uri = list.nth(param,0) param1 = list.nth(param,1) param2 = list.nth(param,2) param3 = list.nth(param,3) stream1=input.http() stream2=input.http() stream3=input.http() if (string.match(pattern="http://",param1)) then stream1=strip_blank(input.http(param1)) else file.watch(param1, create_dynamic_request) end if (string.match(pattern="http://",param2)) then stream2=strip_blank(input.http(param2)) else file.watch(param2, create_dynamic_request) end if (string.match(pattern="http://",param3)) then stream3=strip_blank(input.http(param3)) else file.watch(param3, create_dynamic_request) end radio=fallback(track_sensitive=false,[stream1,stream2,stream3]) end file.watch("playlist.txt",reload_all_streams()) output.shoutcast(%mp3(bitrate=64,samplerate=44100,stereo=false),host=" sc4.spacialnet.com",port=32104,password="test1",radio) output.shoutcast(%mp3(bitrate=16,samplerate=44100,stereo=false),host=" sc6.spacialnet.com",port=31354,password="test1",radio) output.shoutcast(%mp3(bitrate=64,samplerate=44100,stereo=false),host=" sc4.spacialnet.com",port=30682,password="test1",radio) Any help you could offer would be greatly appreciated. Kindest Regards Isabel On Thu, May 16, 2013 at 4:08 PM, Isabel Van Rooyen <is...@sp...>wrote: > Hi, > > I'm trying to dynamically build a fallback from a file. > > The file will be updated regularly with new relays, I then want to be > alerted (using file.watch) and then I want to read the file, line by line, > and rebuild my list of sources, place them into a fallback, and start > streaming again from the top down. > > Could you guys maybe help me out on how to read the file line by line? > After that I think I can do it. > > Kindest Regards > Isabel > |