Migrating to a new Liquidsoap version
In this page, we list the most common catches when migrating to a new version of Liquidsoap.
From 2.0.x to 2.1.x
First-class regular expression are introduced and are used to replace the following operators: *
string.match(pattern=<regexp>, <string> is replaced by:
string.extract(pattern=<regexp>, <string>) is replaced by:
string.replace(pattern=<regexp>, <string>) is replaced by:
string.split(separator=<regexp>, <string>) is replaced by:
From 1.4.x to 2.0.0
audio_to_stereo should not be required in most situations anymore.
liquidsoap can handle channels conversions transparently now!
Http input and operators
In order to provide as much compatibility as possible with the different HTTP procotols and implementation, we have decided to delegate HTTP support to external libraries which have large scale support and implementation. This means that, if you have installed
- You need to install the
ocurlpackage to enable all HTTP request operators,
- You need to install the
1.0.0or above) to enable
- You do not need to install the
sslpackage anymore to enable their
httpscounter-part. These operators have been deprecated.
The parameters for
cross transitions was changed to take advantage of the new module system. Instead of passing multiple arguments related to the ending and starting track, those are regrouped into a single record. So, if you had a transition like this:
def transition( ending_dB_level, starting_dB_level, ending_metadata, starting_metadata, ending_source, starting_source) = ...end
You would now do:
def transition(ending, starting) = # Now you can use: # - ending.db_level, ending.metadata, ending.source # - starting.db_level, starting.metadata, starting.source ...end
Settings are now exported as records. Where you would before write:
set("decoder.decoders", ["MAD", "FFMPEG"])
You can now write:
Likewise, to get a setting’s value you can now do:
current_decoders = settings.decoder.decoders()
This provides many good features, in particular type-safety.
For convenience, we have added shorter versions of the most used settings. These are all shortcuts to their respective
log.level.set(4) log.file.set(true) log.stdout.set(true) init.daemon.set(true) audio.samplerate.set(48000) audio.channels.set(2) video.frame.width.set(720) video.frame.height.set(1280)
register operator could not be adapted to this new API and had to be removed, however, backward-compatible
get operators are provided. Make sure to replace them as they should be removed in a future version.
insert_metadata does not return a pair anymore, but a source with a method named
insert_metadata. This means that you should change the code
fs = insert_metadata(s) # The function to insert metadata f = fst(ms) # The source with inserted metadata s = snd(ms) ...# Using the function f([("artist", "Bob")]) ...# Using the source output.pulseaudio(s)
s = insert_metadata(s) ...# Using the function s.insert_metadata([("artist", "Bob")]) ...# Using the source output.pulseaudio(s)
Queueing for request-based sources has been simplified. The
length have been removed in favor of a simpler implementation. You can now pass a
prefetch parameter which tells the source how many requests should be queued in advance.
Should you need more advanced queueing strategy,
request.dynamic now export functions to retrieve and set their own queue of requests.
json_of has been renamed
of_json has been renamed
JSON export has been enhanced with a new generic json object export. Associative lists of type
(string, 'a) are now exported as lists. See our JSON documentation page for more details.
Convenience functions have been added to convert metadata to and from JSON object format:
Some operators have been deprecated. For most of them, we provide a backward-compatible support but it is good practice to update your script. You should see logs in your script when running deprecated operatords. Here’s a list of the most important ones:
playlist.safeis replaced by:
playlist.onceis replaced by:
rewrite_metadatashould be rewritten using
fade.finalare not needed anymore
get_process_outputis replaced by:
get_process_linesis replaced by:
test_processis replaced by:
systemis replaced by:
add_timeoutis replaced by:
on_blankis replaced by:
skip_blankis replaced by:
eat_blankis replaced by:
strip_blankis replaced by:
whichis replaced by:
register_flow: flow is no longer maintained
emptyis replaced by:
file.unlinkis replaced by:
string.utf8.escapeis replaced by:
The windows binary is statically built and, for this reason, we cannot enable both the
%ffmpeg encoder and any encoder that uses the same underlying libraries, for instance
mp3 encoding. The technical reason is that both libraries import the same C symbols, which makes compilation fail.
%ffmpeg encoder provides all the functionalities of the internal encoders that conflict with it along with many more format we do not support otherwise. For this reason, it was decided to enable the
%ffmpeg encoder and disable all other encoders.
This means that, if you were previously using a different encoder than
%ffmpeg, you will need to adapt your script to use it. For instance, for mp3 encoding with variable bitrate:
%ffmpeg(format="mp3", %audio(codec="libmp3lame", q=7))