From 39e32743e13180c839d829bce65fab1745105580 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 19 Jun 2012 16:23:09 +0100 Subject: [PATCH 1/6] Fixed typos in changelog --- changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index 087af1103..ebe61ddda 100644 --- a/changelog +++ b/changelog @@ -19,7 +19,7 @@ * Removing a watched directory and adding it again preserves playlists & shows with those files. * An icon in the playlist shows whether a file is missing on disk, warning the user that the playlist will not go according to plan. * Media monitor detects add and removal of watched temporary local storage (USB disks for example) and network drives. - * Broadcast Log - export play count of tracks within a given time range.  Useful for royalty reporting purposes. + * Broadcast Log - export play count of tracks within a given time range. Useful for royalty reporting purposes. * Minor Improvements: * Ability to turn off the broadcast. * Editing metadata in the library will update the metadata on disk. @@ -30,7 +30,7 @@ * Repeating shows default to "No End" * Ability to "View on Soundcloud" for recorded shows in the calendar * "Listen" preview player no longer falls behind the broadcast (you can only mute the stream now, not stop it) - * Tracks that cannot be played will be rejected on upload and put in to the directory "/srv/airtime/store/problem_files" (but currently it will not tell you that it rejected them - sorry\!) + * Tracks that cannot be played will be rejected on upload and put in to the directory "/srv/airtime/stor/problem_files" (but currently it will not tell you that it rejected them - sorry\!) * Library is automatically refreshed when media import is finished * Show "Disk Full" message when trying to upload a file that wont fit on the disk * Reduced CPU utilization for OGG streams From 1e8c8f81572a28974f04a09f7fe1fa9805890a27 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 9 Jul 2012 11:21:12 -0400 Subject: [PATCH 2/6] add a few try catch blocks --- .../airtimefilemonitor/airtimemetadata.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py index e7b6ad01d..cea950cba 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py @@ -221,9 +221,20 @@ class AirtimeMetadata: md['MDATA_KEY_COPYRIGHT'] = self.truncate_to_length(md['MDATA_KEY_COPYRIGHT'], 512) #end of db truncation checks. - md['MDATA_KEY_BITRATE'] = getattr(file_info.info, "bitrate", None) - md['MDATA_KEY_SAMPLERATE'] = getattr(file_info.info, "sample_rate", None) - self.logger.info( "Bitrate: %s , Samplerate: %s", md['MDATA_KEY_BITRATE'], md['MDATA_KEY_SAMPLERATE'] ) + try: + md['MDATA_KEY_BITRATE'] = getattr(file_info.info, "bitrate", "0") + except Exception as e: + self.logger.warn("Could not get Bitrate") + md['MDATA_KEY_BITRATE'] = "0" + + try: + md['MDATA_KEY_SAMPLERATE'] = getattr(file_info.info, "sample_rate", "0") + except Exception as e: + self.logger.warn("Could not get Samplerate") + md['MDATA_KEY_SAMPLERATE'] = "0" + + self.logger.info("Bitrate: %s , Samplerate: %s", md['MDATA_KEY_BITRATE'], md['MDATA_KEY_SAMPLERATE']) + try: md['MDATA_KEY_DURATION'] = self.format_length(file_info.info.length) except Exception as e: self.logger.warn("File: '%s' raises: %s", filepath, str(e)) From 6ce52f081a0075fba226ba63cef981aaf5a26e9d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 9 Jul 2012 12:20:41 -0400 Subject: [PATCH 3/6] CC-4091: More comprehensive error message for installs on systems with incorrect locale -done --- install_minimal/airtime-install | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index 86691c427..8c4541685 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -107,11 +107,28 @@ echo "* Making sure /etc/default/locale is set properly" set +e update-locale cat /etc/default/locale | grep -i "LANG=.*UTF-\?8" -set -e if [ "$?" != "0" ]; then - echo "non UTF-8 default locale found in /etc/default/locale." + echo -e " * Fail\n" + echo "A non UTF-8 default locale found in /etc/default/locale. Airtime requires +a UTF-8 locale to run. To fix this please do the following: + +Ubuntu: +Put line 'en_US.UTF-8 UTF-8' (or similar) without quotes to '/var/lib/locales/supported.d/local', +replacing any existing lines. +A list of supported locales is available in '/usr/share/i18n/SUPPORTED' +Then run 'sudo dpkg-reconfigure locales' + +Debian: +Run 'sudo dpkg-reconfigure locales' and use the interface to select 'en_US.UTF-8 UTF-8' (or similar). +On the second page select this new locale as the default. + +After these changes have been made simply run install again. + +Now exiting install... +" exit 1 fi +set -e # Check if airtime exists already From e5bbed378213581cb1a0cdba5228e9638f7e8ba7 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 26 Oct 2012 00:35:44 -0400 Subject: [PATCH 4/6] remove CR line endings --- widgets/sample_page.html | 114 +++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/widgets/sample_page.html b/widgets/sample_page.html index 94cc51396..cba9c37ed 100644 --- a/widgets/sample_page.html +++ b/widgets/sample_page.html @@ -1,57 +1,57 @@ - - - - -Airtime widgets - - - - - - - -

"Now Playing" Widget

-This widget displays what is currently playing: -
-
-
-
-
-

"Today's Program" Widget

-This widget displays what is being played today: -
-
-
-
-
-

"Weekly Program" Widget

-This widget displays all the shows for the entire week: -
-
-
- - - + + + + +Airtime widgets + + + + + + + +

"Now Playing" Widget

+This widget displays what is currently playing: +
+
+
+
+
+

"Today's Program" Widget

+This widget displays what is being played today: +
+
+
+
+
+

"Weekly Program" Widget

+This widget displays all the shows for the entire week: +
+
+
+ + + From e285bcfba1e64266c3f53577cbcab2a85e29142f Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 26 Oct 2012 12:54:10 -0400 Subject: [PATCH 5/6] update liquidsoap library scripts -git commit hash f776e7f4c5d3729cbcf863381f3cadd96c578a5b --- .../library/external-todo.liq | 314 ------------------ .../liquidsoap_scripts/library/externals.liq | 1 + .../pypo/liquidsoap_scripts/library/http.liq | 16 +- .../liquidsoap_scripts/library/pervasives.liq | 3 +- .../pypo/liquidsoap_scripts/library/utils.liq | 59 ++-- .../liquidsoap_scripts/library/video_text.liq | 2 + 6 files changed, 46 insertions(+), 349 deletions(-) delete mode 100644 python_apps/pypo/liquidsoap_scripts/library/external-todo.liq diff --git a/python_apps/pypo/liquidsoap_scripts/library/external-todo.liq b/python_apps/pypo/liquidsoap_scripts/library/external-todo.liq deleted file mode 100644 index 24ae18cdc..000000000 --- a/python_apps/pypo/liquidsoap_scripts/library/external-todo.liq +++ /dev/null @@ -1,314 +0,0 @@ -# These operators need to be updated.. - - -# Stream data from mplayer -# @category Source / Input -# @param s data URI. -# @param ~restart restart on exit. -# @param ~restart_on_error restart on exit with error. -# @param ~buffer Duration of the pre-buffered data. -# @param ~max Maximum duration of the buffered data. -def input.mplayer(~id="input.mplayer", - ~restart=true,~restart_on_error=false, - ~buffer=0.2,~max=10.,s) = - input.external(id=id,restart=restart, - restart_on_error=restart_on_error, - buffer=buffer,max=max, - "mplayer -really-quiet -ao pcm:file=/dev/stdout \ - -vc null -vo null #{quote(s)} 2>/dev/null") -end - - -# Output the stream using aplay. -# Using this turns "root.sync" to false -# since aplay will do the synchronisation -# @category Source / Output -# @param ~id Output's ID -# @param ~device Alsa pcm device name -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s Source to play -def output.aplay(~id="output.aplay",~device="default", - ~fallible=false,~on_start={()},~on_stop={()}, - ~restart_on_crash=false,s) - def aplay_p(m) = - "aplay -D #{device}" - end - log(label=id,level=3,"Setting root.sync to false") - set("root.sync",false) - output.pipe.external(id=id, - fallible=fallible,on_start=on_start,on_stop=on_stop, - restart_on_crash=restart_on_crash, - restart_on_new_track=false, - process=aplay_p,s) -end - -%ifdef output.icecast.external -# Output to icecast using the lame command line encoder. -# @category Source / Output -# @param ~id Output's ID -# @param ~start Start output threads on operator initialization. -# @param ~restart Restart output after a failure. By default, liquidsoap will stop if the output failed. -# @param ~restart_delay Delay, in seconds, before attempting new connection, if restart is enabled. -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~restart_on_new_track Restart encoder upon new track. -# @param ~restart_encoder_delay Restart the encoder after this delay, in seconds. -# @param ~user User for shout source connection. Useful only in special cases, like with per-mountpoint users. -# @param ~lame The lame binary -# @param ~bitrate Encoder bitrate -# @param ~swap Swap audio samples. Depends on local machine's endianess and lame's version. Test this parameter if you experience garbaged mp3 audio data. On intel 32 and 64 architectures, the parameter should be "true" for lame version >= 3.98. -# @param ~dumpfile Dump stream to file, for debugging purpose. Disabled if empty. -# @param ~protocol Protocol of the streaming server: 'http' for Icecast, 'icy' for Shoutcast. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s The source to output -def output.icecast.lame( - ~id="output.icecast.lame",~start=true, - ~restart=false,~restart_delay=3, - ~host="localhost",~port=8000, - ~user="source",~password="hackme", - ~genre="Misc",~url="http://savonet.sf.net/", - ~description="Liquidsoap Radio!",~public=true, - ~dumpfile="",~mount="Use [name]", - ~name="Use [mount]",~protocol="http", - ~lame="lame",~bitrate=128,~swap=false, - ~fallible=false,~on_start={()},~on_stop={()}, - ~restart_on_crash=false,~restart_on_new_track=false, - ~restart_encoder_delay=3600,~headers=[],s) - samplerate = get(default=44100,"frame.samplerate") - samplerate = float_of_int(samplerate) / 1000. - channels = get(default=2,"frame.channels") - swap = if swap then "-x" else "" end - mode = - if channels == 2 then - "j" # Encoding in joint stereo.. - else - "m" - end - # Metadata update is set by ICY with icecast - def lame_p(m) - "#{lame} -b #{bitrate} -r --bitwidth 16 -s #{samplerate} \ - --signed -m #{mode} --nores #{swap} -t - -" - end - output.icecast.external(id=id, - process=lame_p,bitrate=bitrate,start=start, - restart=restart,restart_delay=restart_delay, - host=host,port=port,user=user,password=password, - genre=genre,url=url,description=description, - public=public,dumpfile=dumpfile,restart_encoder_delay=restart_encoder_delay, - name=name,mount=mount,protocol=protocol, - header=false,restart_on_crash=restart_on_crash, - restart_on_new_track=restart_on_new_track,headers=headers, - fallible=fallible,on_start=on_start,on_stop=on_stop, - s) -end - -# Output to shoutcast using the lame encoder. -# @category Source / Output -# @param ~id Output's ID -# @param ~start Start output threads on operator initialization. -# @param ~restart Restart output after a failure. By default, liquidsoap will stop if the output failed. -# @param ~restart_delay Delay, in seconds, before attempting new connection, if restart is enabled. -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~restart_on_new_track Restart encoder upon new track. -# @param ~restart_encoder_delay Restart the encoder after this delay, in seconds. -# @param ~user User for shout source connection. Useful only in special cases, like with per-mountpoint users. -# @param ~lame The lame binary -# @param ~bitrate Encoder bitrate -# @param ~icy_reset Reset shoutcast source buffer upon connecting (necessary for NSV). -# @param ~dumpfile Dump stream to file, for debugging purpose. Disabled if empty. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s The source to output -def output.shoutcast.lame( - ~id="output.shoutcast.mp3",~start=true, - ~restart=false,~restart_delay=3, - ~host="localhost",~port=8000, - ~user="source",~password="hackme", - ~genre="Misc",~url="http://savonet.sf.net/", - ~description="Liquidsoap Radio!",~public=true, - ~dumpfile="",~name="Use [mount]",~icy_reset=true, - ~lame="lame",~aim="",~icq="",~irc="", - ~fallible=false,~on_start={()},~on_stop={()}, - ~restart_on_crash=false,~restart_on_new_track=false, - ~restart_encoder_delay=3600,~bitrate=128,s) = - icy_reset = if icy_reset then "1" else "0" end - headers = [("icy-aim",aim),("icy-irc",irc), - ("icy-icq",icq),("icy-reset",icy_reset)] - output.icecast.lame( - id=id, headers=headers, lame=lame, - bitrate=bitrate, start=start, - restart=restart, restart_encoder_delay=restart_encoder_delay, - host=host, port=port, user=user, password=password, - genre=genre, url=url, description=description, - public=public, dumpfile=dumpfile, - restart_on_crash=restart_on_crash, - restart_on_new_track=restart_on_new_track, - name=name, mount="/", protocol="icy", - fallible=fallible,on_start=on_start,on_stop=on_stop, - s) -end - -# Output to icecast using the flac command line encoder. -# @category Source / Output -# @param ~id Output's ID -# @param ~start Start output threads on operator initialization. -# @param ~restart Restart output after a failure. By default, liquidsoap will stop if the output failed. -# @param ~restart_delay Delay, in seconds, before attempting new connection, if restart is enabled. -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~restart_on_new_track Restart encoder upon new track. If false, the resulting stream will have a single track. -# @param ~restart_encoder_delay Restart the encoder after this delay, in seconds. -# @param ~user User for shout source connection. Useful only in special cases, like with per-mountpoint users. -# @param ~flac The flac binary -# @param ~quality Encoder quality (0..8) -# @param ~dumpfile Dump stream to file, for debugging purpose. Disabled if empty. -# @param ~protocol Protocol of the streaming server: 'http' for Icecast, 'icy' for Shoutcast. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s The source to output -def output.icecast.flac( - ~id="output.icecast.flac",~start=true, - ~restart=false,~restart_delay=3, - ~host="localhost",~port=8000, - ~user="source",~password="hackme", - ~genre="Misc",~url="http://savonet.sf.net/", - ~description="Liquidsoap Radio!",~public=true, - ~dumpfile="",~mount="Use [name]", - ~name="Use [mount]",~protocol="http", - ~flac="flac",~quality=6, - ~restart_on_crash=false, - ~restart_on_new_track=true, - ~restart_encoder_delay=(-1), - ~fallible=false,~on_start={()},~on_stop={()}, - s) - # We will use raw format, to - # bypass input length value in WAV - # header (input length is not known) - channels = get(default=2,"frame.channels") - samplerate = get(default=44100,"frame.samplerate") - def flac_p(m)= - def option(x) = - "-T #{quote(fst(x))}=#{quote(snd(x))}" - end - m = list.map(option,m) - m = string.concat(separator=" ",m) - "#{flac} --force-raw-format --endian=little --channels=#{channels} \ - --bps=16 --sample-rate=#{samplerate} --sign=signed #{m} \ - -#{quality} --ogg -c -" - end - output.icecast.external(id=id, - process=flac_p,bitrate=(-1),start=start, - restart=restart,restart_delay=restart_delay, - host=host,port=port,user=user,password=password, - genre=genre,url=url,description=description, - public=public,dumpfile=dumpfile, - name=name,mount=mount,protocol=protocol, - fallible=fallible,on_start=on_start,on_stop=on_stop, - restart_on_new_track=restart_on_new_track, - format="ogg",header=false,icy_metadata=false, - restart_on_crash=restart_on_crash, - restart_encoder_delay=restart_encoder_delay, - s) -end - -# Output to icecast using the aacplusenc command line encoder. -# @category Source / Output -# @param ~id Output's ID -# @param ~start Start output threads on operator initialization. -# @param ~restart Restart output after a failure. By default, liquidsoap will stop if the output failed. -# @param ~restart_delay Delay, in seconds, before attempting new connection, if restart is enabled. -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~restart_on_new_track Restart encoder upon new track. -# @param ~restart_encoder_delay Restart the encoder after this delay, in seconds. -# @param ~user User for shout source connection. Useful only in special cases, like with per-mountpoint users. -# @param ~aacplusenc The aacplusenc binary -# @param ~bitrate Encoder bitrate -# @param ~dumpfile Dump stream to file, for debugging purpose. Disabled if empty. -# @param ~protocol Protocol of the streaming server: 'http' for Icecast, 'icy' for Shoutcast. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s The source to output -def output.icecast.aacplusenc( - ~id="output.icecast.aacplusenc",~start=true, - ~restart=false,~restart_delay=3, - ~host="localhost",~port=8000, - ~user="source",~password="hackme", - ~genre="Misc",~url="http://savonet.sf.net/", - ~description="Liquidsoap Radio!",~public=true, - ~dumpfile="",~mount="Use [name]", - ~name="Use [mount]",~protocol="http", - ~aacplusenc="aacplusenc",~bitrate=64, - ~fallible=false,~on_start={()},~on_stop={()}, - ~restart_on_crash=false,~restart_on_new_track=false, - ~restart_encoder_delay=3600,~headers=[],s) - # Metadata update is set by ICY with icecast - def aacplusenc_p(m) - "#{aacplusenc} - - #{bitrate}" - end - output.icecast.external(id=id, - process=aacplusenc_p,bitrate=bitrate,start=start, - restart=restart,restart_delay=restart_delay, - host=host,port=port,user=user,password=password, - genre=genre,url=url,description=description, - public=public,dumpfile=dumpfile, - name=name,mount=mount,protocol=protocol, - fallible=fallible,on_start=on_start,on_stop=on_stop, - header=true,restart_on_crash=restart_on_crash, - restart_on_new_track=restart_on_new_track,headers=headers, - restart_encoder_delay=restart_encoder_delay,format="audio/aacp",s) -end - -# Output to shoutcast using the aacplusenc encoder. -# @category Source / Output -# @param ~id Output's ID -# @param ~start Start output threads on operator initialization. -# @param ~restart Restart output after a failure. By default, liquidsoap will stop if the output failed. -# @param ~restart_delay Delay, in seconds, before attempting new connection, if restart is enabled. -# @param ~restart_on_crash Restart external process on crash. If false, liquidsoap will stop. -# @param ~restart_on_new_track Restart encoder upon new track. -# @param ~restart_encoder_delay Restart the encoder after this delay, in seconds. -# @param ~user User for shout source connection. Useful only in special cases, like with per-mountpoint users. -# @param ~aacplusenc The aacplusenc binary -# @param ~bitrate Encoder bitrate -# @param ~icy_reset Reset shoutcast source buffer upon connecting (necessary for NSV). -# @param ~dumpfile Dump stream to file, for debugging purpose. Disabled if empty. -# @param ~fallible Allow the child source to fail, in which case the output will be (temporarily) stopped. -# @param ~on_start Callback executed when outputting starts. -# @param ~on_stop Callback executed when outputting stops. -# @param s The source to output -def output.shoutcast.aacplusenc( - ~id="output.shoutcast.aacplusenc",~start=true, - ~restart=false,~restart_delay=3, - ~host="localhost",~port=8000, - ~user="source",~password="hackme", - ~genre="Misc",~url="http://savonet.sf.net/", - ~description="Liquidsoap Radio!",~public=true, - ~fallible=false,~on_start={()},~on_stop={()}, - ~dumpfile="",~name="Use [mount]",~icy_reset=true, - ~aim="",~icq="",~irc="",~aacplusenc="aacplusenc", - ~restart_on_crash=false,~restart_on_new_track=false, - ~restart_encoder_delay=3600,~bitrate=64,s) = - icy_reset = if icy_reset then "1" else "0" end - headers = [("icy-aim",aim),("icy-irc",irc), - ("icy-icq",icq),("icy-reset",icy_reset)] - output.icecast.aacplusenc( - id=id, headers=headers, aacplusenc=aacplusenc, - bitrate=bitrate, start=start, - restart=restart, restart_delay=restart_delay, - host=host, port=port, user=user, password=password, - genre=genre, url=url, description=description, - public=public, dumpfile=dumpfile, - fallible=fallible,on_start=on_start,on_stop=on_stop, - restart_on_crash=restart_on_crash, restart_encoder_delay=restart_encoder_delay, - restart_on_new_track=restart_on_new_track, - name=name, mount="/", protocol="icy", - s) -end -%endif - diff --git a/python_apps/pypo/liquidsoap_scripts/library/externals.liq b/python_apps/pypo/liquidsoap_scripts/library/externals.liq index 6e1b98a60..b56f13d0c 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/externals.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/externals.liq @@ -4,6 +4,7 @@ # Enable external Musepack decoder. Requires the # mpcdec binary in the path. Does not work on # Win32. +# @category Liquidsoap def enable_external_mpc_decoder() = # A list of know extensions and content-type for Musepack. # Values from http://en.wikipedia.org/wiki/Musepack diff --git a/python_apps/pypo/liquidsoap_scripts/library/http.liq b/python_apps/pypo/liquidsoap_scripts/library/http.liq index 109baf41e..53644ce38 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/http.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/http.liq @@ -13,18 +13,12 @@ def http_response(~protocol="HTTP/1.1", ~headers=[], ~data="") = status = http_codes[string_of(code)] - # Set content-length if needed and not set by the - # user. + # Set content-length and connection: close headers = - if data != "" and - not list.mem_assoc("Content-Length",headers) - then - list.append([("Content-Length", - "#{string.length(data)}")], - headers) - else - headers - end + list.append(headers, + [("Content-Length", "#{string.length(data)}"), + ("Connection", "close")]) + headers = list.map(fun (x) -> "#{fst(x)}: #{snd(x)}",headers) headers = string.concat(separator="\r\n",headers) # If no headers are provided, we should avoid diff --git a/python_apps/pypo/liquidsoap_scripts/library/pervasives.liq b/python_apps/pypo/liquidsoap_scripts/library/pervasives.liq index bd894766b..722138018 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/pervasives.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/pervasives.liq @@ -4,4 +4,5 @@ %include "lastfm.liq" %include "flows.liq" %include "http.liq" -%include "video_text.liq" \ No newline at end of file +%include "video_text.liq" +%include "gstreamer.liq" diff --git a/python_apps/pypo/liquidsoap_scripts/library/utils.liq b/python_apps/pypo/liquidsoap_scripts/library/utils.liq index 3d82d8997..a35af94f3 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/utils.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/utils.liq @@ -21,10 +21,14 @@ end # @param a Key to look for # @param l List of pairs (key,value) def list.mem_assoc(a,l) - v = list.assoc(a,l) - # We check for existence, since "" may indicate - # either a binding (a,"") or no binding.. - list.mem((a,v),l) + def f(cur, el) = + if not cur then + fst(el) == a + else + cur + end + end + list.fold(f, false, l) end # Remove a pair from an associative list @@ -164,8 +168,7 @@ def out(s) output.prefered(mksafe(s)) end -# Special track insensitive fallback that -# always skip current song before switching. +# Special track insensitive fallback that always skips current song before switching. # @category Source / Track Processing # @param ~input The input source # @param f The fallback source @@ -212,14 +215,17 @@ end # Simple crossfade. # @category Source / Track Processing # @param ~start_next Duration in seconds of the crossed end of track. -# @param ~fade_in Duration of the fade in for next track -# @param ~fade_out Duration of the fade out for previous track -# @param s The source to use -def crossfade(~id="",~start_next,~fade_in,~fade_out,s) +# @param ~fade_in Duration of the fade in for next track. +# @param ~fade_out Duration of the fade out for previous track. +# @param ~conservative Always prepare for a premature end-of-track. +# @param s The source to use. +def crossfade(~id="",~conservative=true, + ~start_next=5.,~fade_in=3.,~fade_out=3., + s) s = fade.in(duration=fade_in,s) s = fade.out(duration=fade_out,s) fader = fun (a,b) -> add(normalize=false,[b,a]) - cross(id=id,conservative=true,duration=start_next,fader,s) + cross(id=id,conservative=conservative,duration=start_next,fader,s) end # Append speech-synthesized tracks reading the metadata. @@ -242,8 +248,7 @@ def helium(s) end %endif -# Return true if process exited with 0 code. -# Command should return quickly. +# Return true if process exited with 0 code. Command should return quickly. # @category System # @param command Command to test def test_process(command) @@ -277,12 +282,9 @@ def url.split(uri) = end end -# Register a server/telnet command to -# update a source's metadata. Returns -# a new source, which will receive the -# updated metadata. It behaves just like -# the pre-1.0 insert_metadata() operator, -# i.e. insert key1="val1",key2="val2",... +# Register a server/telnet command to update a source's metadata. Returns +# a new source, which will receive the updated metadata. The command has +# the following format: insert key1="val1",key2="val2",... # @category Source / Track Processing # @param ~id Force the value of the source ID. def server.insert_metadata(~id="",s) = @@ -424,15 +426,15 @@ end # @param ~conservative Always prepare for a premature end-of-track. # @param ~default Transition used when no rule applies \ # (default: sequence). -# @param ~high Value, in dB, for loud sound level -# @param ~medium Value, in dB, for medium sound level +# @param ~high Value, in dB, for loud sound level. +# @param ~medium Value, in dB, for medium sound level. # @param ~margin Margin to detect sources that have too different \ # sound level for crossing. # @param s The input source. def smart_crossfade (~start_next=5.,~fade_in=3.,~fade_out=3., ~default=(fun (a,b) -> sequence([a, b])), ~high=-15., ~medium=-32., ~margin=4., - ~width=2.,~conservative=false,s) + ~width=2.,~conservative=true,s) fade.out = fade.out(type="sin",duration=fade_out) fade.in = fade.in(type="sin",duration=fade_in) add = fun (a,b) -> add(normalize=false,[b, a]) @@ -549,7 +551,18 @@ def playlist.reloadable(~id="",~random=false,~on_done={()},uri) if request.resolve(playlist) then playlist = request.filename(playlist) files = playlist.parse(playlist) - list.map(snd,files) + def file_request(el) = + meta = fst(el) + file = snd(el) + s = list.fold(fun (cur, el) -> + "#{cur},#{fst(el)}=#{string.escape(snd(el))}", "", meta) + if s == "" then + file + else + "annotate:#{s}:#{file}" + end + end + list.map(file_request,files) else log(label=id,"Couldn't read playlist: request resolution failed.") [] diff --git a/python_apps/pypo/liquidsoap_scripts/library/video_text.liq b/python_apps/pypo/liquidsoap_scripts/library/video_text.liq index b372a1f7b..8c017a93d 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/video_text.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/video_text.liq @@ -1,5 +1,6 @@ %ifdef video.add_text.gd # Add a scrolling line of text on video frames. +# @category Source / Video Processing # @param ~id Force the value of the source ID. # @param ~color Text color (in 0xRRGGBB format). # @param ~cycle Cycle text. @@ -22,6 +23,7 @@ end %ifdef video.add_text.sdl # Add a scrolling line of text on video frames. +# @category Source / Video Processing # @param ~id Force the value of the source ID. # @param ~color Text color (in 0xRRGGBB format). # @param ~cycle Cycle text. From 3cb2346af95a1b11436e774bf9bd8b595e6a97d8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 26 Oct 2012 18:23:28 -0400 Subject: [PATCH 6/6] add pcre debian package for compiling liquidsoap --- dev_tools/fabric/fab_liquidsoap_compile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev_tools/fabric/fab_liquidsoap_compile.py b/dev_tools/fabric/fab_liquidsoap_compile.py index 221aa41c6..98f816e47 100644 --- a/dev_tools/fabric/fab_liquidsoap_compile.py +++ b/dev_tools/fabric/fab_liquidsoap_compile.py @@ -181,7 +181,8 @@ libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev libtaglib-ocaml-dev libvo libspeex-dev libspeexdsp-dev speex libladspa-ocaml-dev festival festival-dev \ libsamplerate-dev libxmlplaylist-ocaml-dev libxmlrpc-light-ocaml-dev libflac-dev \ libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \ -libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev libjack-dev camlidl libfaad-dev''') +libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev libjack-dev +camlidl libfaad-dev libpcre-ocaml-dev''') root = '/home/martin/src' do_run('mkdir -p %s' % root)