PageSourceSearch

https://www.liquidsoap.info/assets/js/66386c4a.86363b58.js

js liquidsoap.info collected 2026-10-03 22:43:29 UTC 6,336 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([["36075"],{21932(e,t,n){n.r(t),n.d(t,{metadata:()=>i,default:()=>h,frontMatter:()=>a,contentTitle:()=>l,toc:()=>c,assets:()=>r});var i=JSON.parse('{"id":"complete_case","title":"A complete case analysis","description":"We will develop here a more complex example, according to the following specifications:","source":"@site/versioned_docs/version-2.4.5/complete_case.md","sourceDirName":".","slug":"/complete_case","permalink":"/doc-2.4.5/complete_case","draft":false,"unlisted":false,"tags":[],"version":"2.4.5","frontMatter":{"title":"A complete case analysis","description":"We will develop here a more complex example, according to the following specifications:","sidebar_label":"A complete case"},"sidebar":"docs","previous":{"title":"Quickstart","permalink":"/doc-2.4.5/quick_start"},"next":{"title":"Getting help","permalink":"/doc-2.4.5/help"}}'),s=n(74848),o=n(28453);let a={title:"A complete case analysis",description:"We will develop here a more complex example, according to the following specifications:",sidebar_label:"A complete case"},l,r={},c=[];function d(e){let t={a:"a",code:"code",img:"img",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.p,{children:"We will develop here a more complex example, according to the following specifications:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"play different playlists during the day;"}),"\n",(0,s.jsx)(t.li,{children:"play user requests -- done via the telnet server;"}),"\n",(0,s.jsx)(t.li,{children:"insert about 1 jingle every 5 songs;"}),"\n",(0,s.jsx)(t.li,{children:"add one special jingle at the beginning of every hour, mixed on top of the normal stream;"}),"\n",(0,s.jsx)(t.li,{children:"relay live shows as soon as one is available;"}),"\n",(0,s.jsx)(t.li,{children:"and set up several outputs."}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:"Once you can describe what you want in such a modular way, you're halfway there. Think of the diagram below as a graph through which the audio stream flows, following the arrows. The nodes modify the stream using basic operators \u2014 switching and mixing in our case. The final nodes are outputs: they pull data out of the graph and send it to the world. In our case, we have two Icecast outputs using different formats."}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Graph for &#39;radio.liq&#39;",src:n(39190).A+"",width:"550",height:"97"})}),"\n",(0,s.jsxs)(t.p,{children:["Now here is how to write that in ",(0,s.jsx)(t.a,{href:"/doc-2.4.5/index.html",children:"Liquidsoap"}),"."]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-liquidsoap",metastring:'title="complete-case.liq"',children:'#!/usr/bin/liquidsoap\n\n# Lines starting with # are comments, they are ignored.\n\n# Put the log file in some directory where you have permission to write.\nlog.file.path := "/tmp/<script>.log"\n\n# Print log messages to the console, can also be done by passing the -v option\n# to Liquidsoap.\nlog.stdout := true\n\n# Use the telnet server for requests\nsettings.server.telnet := true\n\n# A bunch of files and playlists, supposedly all located in the same base dir.\ndefault = single("~/radio/default.ogg")\n\nday = playlist("~/radio/day.pls")\nnight = playlist("~/radio/night.pls")\njingles = playlist("~/radio/jingles.pls")\nclock = single("~/radio/clock.ogg")\n\n# Play user requests if there are any, otherwise one of our playlists, and the\n# default file if anything goes wrong.\nradio =\n  fallback(\n    [\n      request.queue(id="request"),\n      switch([({6h-22h}, day), ({22h-6h}, night)]),\n      default\n    ]\n  )\n\n# Add the normal jingles\nradio = random(weights=[1, 5], [jingles, radio])\n\n# And the clock jingle\nradio = add([radio, switch([({0m0s}, clock)])])\n\nradio = mksafe(radio)\n\n# Add the ability to relay live shows\nfull =\n  fallback(\n    track_sensitive=false,\n    [input.http("http://localhost:8000/live.ogg"), radio]\n  )\n\n# Output the full stream in OGG and MP3\noutput.icecast(\n  %mp3,\n  host="localhost",\n  port=8000,\n  password="hackme",\n  mount="radio",\n  full\n)\noutput.icecast(\n  %vorbis,\n  host="localhost",\n  port=8000,\n  password="hackme",\n  mount="radio.ogg",\n  full\n)\n\n# Output the stream without live in OGG\noutput.icecast(\n  %vorbis,\n  host="localhost",\n  port=8000,\n  password="hackme",\n  mount="radio_nolive.ogg",\n  radio\n)\n'})}),"\n",(0,s.jsxs)(t.p,{children:["To try this example, you'll need to edit the file names. To see the playlist switch in action, adjust the time intervals \u2014 if it's currently 16:42, try ",(0,s.jsx)(t.code,{children:"0h-16h45"})," and ",(0,s.jsx)(t.code,{children:"16h45-24h"})," instead of ",(0,s.jsx)(t.code,{children:"6h-22h"})," and ",(0,s.jsx)(t.code,{children:"22h-6h"}),". To test the hourly jingle, you can trigger it every minute by using the ",(0,s.jsx)(t.code,{children:"0s"})," interval instead of ",(0,s.jsx)(t.code,{children:"0m0s"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["To test the transition to a live show, start a new stream on the ",(0,s.jsx)(t.code,{children:"live.ogg"})," mount of your server. You can use the examples from the ",(0,s.jsx)(t.a,{href:"/doc-2.4.5/quick_start",children:"quickstart"})," to stream a playlist to it. To start a real live show from soundcard input, use ",(0,s.jsx)(t.code,{children:"darkice"}),", or simply liquidsoap if you have a working ALSA input:"]}
1),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-liquidsoap",children:'liquidsoap \'output.icecast(%vorbis, \\\n  mount="live.ogg",host="...",password="...",input.alsa())\'\n'})})]})}function h(e={}){let{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},39190(e,t,n){n.d(t,{A:()=>i});let i=n.p+"assets/images/liqgraph-134e4098d67fd6f2203e8d4d2a89cda4.png"},28453(e,t,n){n.d(t,{R:()=>a,x:()=>l});var i=n(96540);let s={},o=i.createContext(s);function a(e){let t=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),i.createElement(o.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.