# "Auto DJ" feature (like the LiquidSoap hack on old version)

**URL:** <https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69>\
**Category:** Uncategorized\
**Created:** [December 13, 2017, 7:07pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69 "2017-12-13T19:07:34Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrKrotos](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@MrKrotos](https://discourse.libretime.org/u/MrKrotos)\
**Post date:** [December 13, 2017, 7:07pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/1 "2017-12-13T19:07:34Z")

</div>

Hi there, I have got the server installed and LibreTime running 🙂  
Is there a way to set an “Auto DJ” that plays files from directory(s) in a scripted manner? Like the LiquidSoap hack we use on the older version?

The following is an example of how I used to do it:

def mixsetfade(~id="",~conservative=true,~start\_next=3.,~fade\_in=3.,~fade\_out=3.,thesource)  
thesource = [fade.in](http://fade.in)(duration=fade\_in,thesource)  
thesource = fade.out(duration=fade\_out,thesource)  
fader = fun (a,b) -\> add(normalize=false,[b,a])  
cross(id=id,conservative=conservative,duration=start\_next,fader,thesource)  
end

jingles = playlist(mode=‘randomize’,reload=60,reload\_mode=“watch”,"/disk2/media/Converted-Jingles")  
tracks = playlist(mode=‘randomize’,reload=60,reload\_mode=“watch”,"/disk2/media/Converted-Tracks")  
mixsets = playlist(mode=‘randomize’,reload=60,reload\_mode=“watch”,"/disk2/media/Converted-Mixes")

## adverts = playlist(mode=‘randomize’,reload=60,reload\_mode=“watch”,"/disk2/media/Converted-Adverts")

## tests = playlist(mode=‘randomize’,reload=60,reload\_mode=“watch”,"/disk2/media/Test-Tones")

failover = single("/disk2/media/Converted-Failover/Mixset.co.uk ~ Failover - 192.mp3")

airplay = mixsetfade(rotate(weights=[1,1,1,3],[jingles,mixsets,jingles,tracks]))  
default = fallback(track\_sensitive = false,[airplay,failover])

ref\_off\_air\_meta = ref off\_air\_meta  
if !ref\_off\_air\_meta == “” then  
ref\_off\_air\_meta := "Airtime - offline"  
end

ignore(output.dummy(default, fallible=true))

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [December 14, 2017, 1:37pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/2 "2017-12-14T13:37:42Z")

</div>

I’m sure there is a way, but nobody has coded it yet. Most of the work has been done on the AutoPlaylist functionality and some theoretical work on building a web interface to replicate something similar to what is above. I don’t plan on coding anything that doesn’t also provide a web UI to interact with. But you are more than welcome to give a shot at writing the code to do this. It might rely upon a liquidsoap hack to work.

---

<div class="post-metadata">

**Author:** ![MrKrotos](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@MrKrotos](https://discourse.libretime.org/u/MrKrotos)\
**Post date:** [March 7, 2018, 2:10pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/3 "2018-03-07T14:10:15Z")

</div>

How do you deal with dead air?  
Is there no auto dj in this fork?

---

<div class="post-metadata">

**Author:** ![facundo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/facundo/32/71_2.png) [@facundo](https://discourse.libretime.org/u/facundo)\
**Post date:** [March 9, 2018, 12:00pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/4 "2018-03-09T12:00:18Z")

</div>

Could you make this work somehow?

---

<div class="post-metadata">

**Author:** ![Togar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/togar/32/184_2.png) [@Togar](https://discourse.libretime.org/u/Togar)\
**Post date:** [September 4, 2019, 6:40am UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/5 "2019-09-04T06:40:43Z")

</div>

I’m definitely interested in this. Seems like it would/should be one of the most basic features for a station automation software.

The background of this goes way back. It was so easy to set up a Winamp playlist and dish out the tunes in random order in perpetuity. SAM Broadcaster has the same function, but it uses scripting to set up weighted rotations, and to script a jingle every so often. Then, if a live DJ was scheduled, they’d kick into the stream and take over. Once they’re done, it goes back to the Auto-DJ. Some stations use this method 24/7 and have been streaming literally for years without intervention.

I’m surprised this isn’t built directly into the UI, unless I’m missing something?

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [September 4, 2019, 3:20pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/6 "2019-09-04T15:20:43Z")

</div>

So, this is one of those functionalities that we haven’t built because nobody has fleshed it out entirely. We do have an autoloading playlist which can in effect perform the same action, but it requires being setup ahead of time. We do need to make it more clear and redesign the UI so that this can be easily configured without someone knowing a number of different custom steps. I’m going to be working on this over the next couple of months.

---

<div class="post-metadata">

**Author:** ![codenift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/codenift/32/165_2.png) [@codenift](https://discourse.libretime.org/u/codenift)\
**Post date:** [September 4, 2019, 3:47pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/7 "2019-09-04T15:47:33Z")

</div>

I think Auto-DJ is great but I think most people want some kind of control, I personally think the way LB is now is a much better solution for serious stations. One might be able to achieve something similar by just using smart blocks in a playlist, you would just need to spend a day organizing your tracks and how you want that playlist to look, then just repeat it throughout the day. I guess you can use one of the unused fields to add some sort of weight that you can at least use in Smart Blocks.

I’ve added a couple new fields just to make it easier for me that can be used in the search criteria inside Smart Blocks, I think I might just add another one with ratings. At the moment, I notice people are using Genre for things like Jingles, but I needed it to be a bit more organized so I added a Media Type dropdown _(Music, Station ID, Intro, Outro, Sweeper, Jingle, Promo, Shout Out, News, Commercial, Interview, Voice Tracking)_ since I needed it separate from Genre in my app. It’s in my fork of LB right now, but I still need to get a few things sorted out before doing a pull-request to original. I just did this because I needed a quick solution with artwork for my app since I switched from SAM Broadcaster Cloud to this but you can still do this if using Genre for the types in case you need some kind of solution.

So this would be my setup if I was trying to do a station like that using Smart Blocks, create a few Smart Blocks:

```
Sweeper :: Media Type Is Sweeper ::Limit to 1 Items
Sound Bridges :: Media Type Is Sound Bridges	::Limit to 1 Items
Promo :: Media Type Is Promo ::Limit to 1 Items

Commercials [2x] :: Media Type Is Commercial	::Limit to 2 Items
Commercials [3x] :: Media Type Is Commercial ::Limit to 3 Items

Then you can decide how you want to get the songs or just mix them up when you add them to playlist.

Random Song[1x] ::Media Type Is Music	::Limit to 1 Items
Random Song[2x] ::Media Type Is Music	::Limit to 2 Items
Random Song[3x] ::Media Type Is Music	::Limit to 3 Items
Random Song[5 Mins] ::Media Type Is Music ::Limit to 5 Minutes ::Allow Last Track to Exceed…
Random Song[10 Mins] ::Media Type Is Music	::Limit to 10 Minutes ::Allow Last Track to Exceed…
Random Song[15 Mins] ::Media Type Is Music	::Limit to 15 Minutes ::Allow Last Track to Exceed…

```

Create Playlist named **Station ID** , and set it in _Settings\>General\>Intro Autoloading Playlist_ so you can add all the Station IDs and play on top of the hour.

Create another playlist: “ **My Random** ” Playlist and just start filling it with smart blocks, for example:

```
Random Song[10 Mins]
Commercials [3x] 
Sweeper
Random Song[10 Mins]
Sound Bridges
Random Song[2x]
Commercials [3x] 
Random Song[10 Mins]
Commercials [2x] 
Random Song[2x]
Sweeper
Random Song[1x]
Commercials [3x] 
Random Song[10 Mins]
Sound Bridges
Random Song[2x]
Commercials [3x] 
Random Song[10 Mins]
Sweeper
Random Song[2x]

```

If we use this playlist for an hour, just add more than an hour of smart blocks just to make sure you have no gaps since some songs could be shorter.

Now when going to Calendar (which I renamed to Schedule since I feel it’s a better term in Radio) Just create a show depending on how long you made the playlist, so if one hour, do a 1 hour show for every hour of the day. When you edit the show, like robbt mentioned, you can autoload that playlist on all shows and set it all shows to repeat on the whole week. I mean you could probably just do 1 long 24hr show and set that to repeat but you’ll be all day organizing. The way I showed you, you’ll have more control and can always schedule a live show for whatever hour. Djs can always come in and out of live broadcast they are scheduled for, and if they come out a live broadcast after just a few minutes it will just continue playing what you had in the playlist seamlessly.

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [September 4, 2019, 3:50pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/8 "2019-09-04T15:50:05Z")

</div>

> [@codenift](#):
>
> So this would be my setup if I was trying to do a station like that using Smart Blocks, create a few Smart Blocks:

Any change you can work on getting a PR from your fork opened with the main project so we could integrate the media type work. I had planned on doing something like this so it’s awesome that someone else was able to beat me to the punch.

---

<div class="post-metadata">

**Author:** ![codenift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/codenift/32/165_2.png) [@codenift](https://discourse.libretime.org/u/codenift)\
**Post date:** [September 4, 2019, 3:56pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/9 "2019-09-04T15:56:07Z")

</div>

Sure. I will do it tonight.

---

<div class="post-metadata">

**Author:** ![kmahelona](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/kmahelona/32/807_2.png) [@kmahelona](https://discourse.libretime.org/u/kmahelona)\
**Post date:** [March 10, 2020, 4:55am UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/10 "2020-03-10T04:55:30Z")

</div>

This looks cool. Currently I’m using the “useless” “label/organisation” ID3 tag as a place for me to “label” things like Station ID, Jingles, etc. It means that I can ensure those tags stick with the audio files metadata. I wonder if there’s a universal place where you can store this “media\_type” information with the file.

---

<div class="post-metadata">

**Author:** ![codenift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/codenift/32/165_2.png) [@codenift](https://discourse.libretime.org/u/codenift)\
**Post date:** [March 12, 2020, 3:12am UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/11 "2020-03-12T03:12:10Z")

</div>

Yes, it should be out real soon, hopefully this week.

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [March 13, 2020, 11:47am UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/12 "2020-03-13T11:47:38Z")

</div>

Yeah, this will be useful, since we don’t currently store any metadata updates on the files, ie any changes are only on the database, it won’t be saving back to the ID3/metadata yet. This could be included if and when we start modifying the underlying files when you update the metadata in LibreTime - see [https://github.com/LibreTime/libretime/issues/621](https://github.com/LibreTime/libretime/issues/621)

---

<div class="post-metadata">

**Author:** ![codenift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/codenift/32/165_2.png) [@codenift](https://discourse.libretime.org/u/codenift)\
**Post date:** [March 13, 2020, 1:00pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/13 "2020-03-13T13:00:31Z")

</div>

@robbt @kmahelona Yes, I actually have something for storing to the file using the getID3 library. just need to go back to it and make sure everything works properly before doing a PR. It will write tags onto the file including artwork when saving, acting like a ID3 tag editor. Has some benefits if sharing directory, moving files maybe to another installation, and since we have that download button I can see this being used if a remote DJ wants to download a few tracks in library to play live and keeping the same info. Maybe add an option to disable/enable the feature. You should see a PR soon.

---

<div class="post-metadata">

**Author:** ![ProgzillaRadio](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/progzillaradio/32/381_2.png) [@ProgzillaRadio](https://discourse.libretime.org/u/ProgzillaRadio)\
**Post date:** [August 29, 2020, 4:44pm UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/14 "2020-08-29T16:44:40Z")

</div>

I’m in the process of building our own LT server, to replace our hosted AT server and have been using the ‘old LiquidSoap hack’ to ensure we never have dead air after a DJ ends their stream.

As this feature still seems incomplete, is it possible to use the old hack to the same effect, until such time as it becomes available?

---

<div class="post-metadata">

**Author:** ![Leekid](https://avatars.discourse-cdn.com/v4/letter/l/a8b319/32.png) [@Leekid](https://discourse.libretime.org/u/Leekid)\
**Post date:** [September 3, 2020, 5:56am UTC](https://discourse.libretime.org/t/auto-dj-feature-like-the-liquidsoap-hack-on-old-version/69/15 "2020-09-03T05:56:59Z")

</div>

@ProgzillaRadio : We use the “old” liquidsoap hack (the one used on Airtime) on our Libretime install, it works without problem and fixes the dead air problem when nothing scheduled in Libretime.
