Hi There,

I am having problems in playing dynamically "changing" MP3 news audio files at 
scheduled times. If the MP3 news file does not change and remain the same 
everything plays OK, but after it is changed and replaced with a new one with 
the same name it's skipped. In the following example, news from several sources 
are downloaded at least once every hour before being scheduled, each every 15 
min, but only the preNews and postNews file are played (preNews and postNews do 
not change).

News items are updated every N minutes as MP3 files, and each new file replaces 
the old MP3 file using the same name. For example every hour at HH:55 I 
download 
the hourly BBC news updates at /BBCNEWS/news.mp3 to be played next at HH:00.

Actually, the strange thing is that news items are played only ONCE after 
Ilaunch the script, but do not get played after news files have been updated.

I tried using single, playlist with just one file (with a 15 min relaod time) 
and ended up trying request.dynamic. None of these methods work for playing the 
news files at 00, 15, 30 and 45 minutes as in the example below -- but the news 
will not be played at all after a new version of the news has been 
automatically 
downloaded and replaces the old file with the same name.

I am attaching a simplified version of the script that shows this problem. It's 
a liquidsoap bug, feature or some error in my script? Any suggestion on how can 
I may solve this??

Thanks.

Pad
P.S I am using Liquidsoap 1.0.0 that I compiled from sources on Ubuntu Lucid.



---- cut here -------

#!/usr/bin/liquidsoap
# Log dir
set("log.file.path","/tmp/test-radio.log")
set("log.stdout",true)
set("server.telnet",false)

MYSTATION="MyStation"
# MYURL="http://www.mystation.org";
# MYHOST="10.1.1.101"
# MYMOUNT="test.mp3"
# MYDESCRIPTION="My description"
# MYGENRE="Various"
# MYPASSWORD="password"


### FUNCTIONS
def new_cbcnews()
    url = list.hd(get_process_lines("/bin/ls -1 /CBCNEWS/news.mp3"))
    request.create(url)
end
def new_bbcnews()
    url = list.hd(get_process_lines("/bin/ls -1 /BBCNEWS/news.mp3"))
    request.create(url)
end
def new_voanews()
    url = list.hd(get_process_lines("/bin/ls -1 /VOANEWS/news.mp3"))
    request.create(url)
end
def new_nprnews()
    url = list.hd(get_process_lines("/bin/ls -1 /NPRNEWS/news.mp3"))
    request.create(url)
end

def final_fade(a,b)
   sequence([fade.final(duration=2.,a),b])
end
def out_fade(a,b)
   sequence([a,fade.initial(duration=2.,b)])
end

# Normalize volume
def audio_process(s)
   gain = interactive.float("compress.gain",3.)
   ratio = 3. # interactive.float("compress.ratio",3.)
   threshold = interactive.float("compress.threshold",-15.)
   target = interactive.float("norm.target",-13.)
   k_up = interactive.float("norm.kup",0.005)
   k_down = interactive.float("norm.kdn",0.1)
   s = normalize(target=target,k_up=k_up,k_down=k_down,s)
   s = compress(gain=gain,ratio=ratio,threshold=threshold,s)
   s
end

## END FUNCTIONS

voanewsitem = audio_to_stereo(request.dynamic(new_voanews))
bbcnewsitem = audio_to_stereo(request.dynamic(new_bbcnews))
nprnewsitem = audio_to_stereo(request.dynamic(new_nprnews))
cbcnewsitem = audio_to_stereo(request.dynamic(new_cbcnews))

preNews  = audio_to_stereo(single("/IDS/FromSouthOfTheAlps.mp3"))
postNews = audio_to_stereo(single("/IDS/YourAreListeningToAndAddress1.mp3"))

security = single("say:Hello, this is #{quote(MYSTATION)}! \
                       We are currently having some \
                       technical difficulties but we'll \
                       be back soon so stay tuned!")

day = mksafe(nrj(smart_crossfade(start_next=8., fade_in=0., fade_out=7., 
high=0., medium=-40., playlist(mode="random", reload=7200, "/MUSIC/AC"))))
psa = mksafe(nrj(playlist(reload=3600,"/PSA")))

radio = day

# When blank/silence is detected of -28dB for more than 3 seconds then skip 
track/advance to next track
radio = skip_blank(threshold=-28.,length=3.,radio)


psa=rewrite_metadata(insert_missing=true,[
                     ("artist","#{quote(MYSTATION)}"),
                      ("title","Public Service Announcement")
                      ],psa)
cbcnewsitem=rewrite_metadata(insert_missing=true,[
                     ("artist","#{quote(MYSTATION)}"),
                      ("title","CBC NEWS")
                      ],cbcnewsitem)
nprnewsitem=rewrite_metadata(insert_missing=true,[
                     ("artist","#{quote(MYSTATION)}"),
                      ("title","NPR NEWS")
                      ],nprnewsitem)
bbcnewsitem=rewrite_metadata(insert_missing=true,[
                     ("artist","#{quote(MYSTATION)}"),
                      ("title","BBC News")
                      ],bbcnewsitem)
voanewsitem=rewrite_metadata(insert_missing=true,[
                     ("artist","#{quote(MYSTATION)}"),
                      ("title","VOA News")
                      ],voanewsitem)


cbcnews=sequence(merge=true,[
                              preNews,
                              cbcnewsitem,
                              postNews
                      ])
voanews=sequence(merge=true,[
                              preNews,
                              voanewsitem,
                              postNews
                      ])
bbcnews=sequence(merge=true,[
                              preNews,
                              bbcnewsitem,
                              postNews
                      ])
nprnews=sequence(merge=true,[
                              preNews,
                              nprnewsitem,
                              postNews
                      ])


# PROCESSING

# Add public service announcements
radio = random(weights=[3,1],[ radio, psa ])

radio = smooth_add(delay=0.5,p=0.0,normal=radio,special=switch([({ 0m0s   }, 
bbcnews)]))
radio = smooth_add(delay=0.5,p=0.0,normal=radio,special=switch([({ 15m0s  }, 
cbcnews)]))
radio = smooth_add(delay=0.5,p=0.0,normal=radio,special=switch([({ 30m0s  }, 
voanews)]))
radio = smooth_add(delay=0.5,p=0.0,normal=radio,special=switch([({ 45m0s  }, 
nprnews)]))

radio = fallback(track_sensitive = false, [radio, security])

radio = audio_process(radio)

# Stream it out
# read: http://savonet.sourceforge.net/doc-svn/encoding_formats.html
#

output.icecast( %vorbis.abr(samplerate=44100, channels=2, bitrate=128, 
max_bitrate=192, min_bitrate=64), host = "XX.XXXX.XXX", port = 8000, password = 
"mypassword", mount = "test.ogg", name="My Station", genre="Various", 
url="http://XXX.XXXX.XXX";, description="Private test stream", radio)
nx1:~/liquidsoap$

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to