Trying to go for an 'autoDJ' ls_script.liq but having trouble
  • It doesn't generate any errors and parses correctly, but it doesn't detect silence either - the switch case does not produce musical or jingle playout.

    It does work correctly otherwise - it handles scheduled programming and DJ access fine, but it doesn't switch in the alternative 'default' content.

    Can somebody please have a look at this and tell me what the frell I did wrong?

    Post edited by Krypton Radio at 2013-12-12 18:06:13
  • 14 Comments sorted by
  • Wow this looked like my first script.

    But have no fear,If you follow my github post later this month you will see how I do mine easily,using all the features of Airtime.

    Here is what I achieve,
    • A forth category on the show tab [so it now moves from Master==>Show==>Schedule==>AutoDj
    • My AutoDj will play from playlist
    • The Playlist are generated by uploading the songs via Airtime Media.
    I actually found a way to use the existing Airtime enviroment to implement all the AutoDj without no major changes.
    Stay tuned,I am testing it Now

    Voisses
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • I cannot test all the categories (playlist) you have and so I give you this solution and you will have to guide me on your problems.
    here is what should work after your playlist


    # If something goes wrong, we'll play this
    security = single("/srv/backup/drops/station.mp3")

    daily_schedule =
               switch([

                         ({ (0h-6h)}, earlymorning),
                         ({ (1w or 2w or 3w or 4w) and 6h-13h}, weekmorning),
                         ({ (1w or 2w or 3w or 4w) and 13h-20h}, weekafternoon),
                         ({ (1w or 2w or 3w or 4w) and 20h-23h59}, weeknights),
                         ({ (2w or 3w or 4w or 5w) and 0h-6h}, weeknights),
                         ({ (5w) and 6h-13h}, fridaymorning),
                         ({ (5w) and 13h-20h}, fridayafternoon),
                         ({ (5w) and 20h-23h59}, fridaynight),
                         ({ (6w) and 0h-6h}, fridaynight),
                         ({ (6w) and 6h-13h}, saturdaymorning),
                         ({ (6w) and 13h-20h}, saturdayafternoon),
                         ({ (6w) and 20h-23h59}, saturdaynight),
                         ({ (7w) and 0h-6h}, saturdaynight),
                         ({ (7w) and 6h-13h}, sundaymorning),
                         ({ (7w) and 13h-20h}, sundayafternoon),
                         ({ (7w) and 20h-23h59}, sundaynight),
                         ({ (1w) and 0h-6h}, sundaynight),
                        
                         ({ true }, pop)
                           # put something else of your choice instead of pop but its for when nothing is covered above
                         ])


    mixed=mksafe(daily_schedule)
    jingles=delay(1.,jingles)

    mixed = rotate(weights=[1,1],[jingles,mixed])

    #put this instead
    default = fallback(track_sensitive=false,[mixed,security])

    you do not need to make safe default its already falliable (its always available and play silence after)








    I am very concern about the way you use the weights above as this will result in a few problems eg.
    sunday you want it to play like this

    sundaynight       = random(weights = [4, 3, 1, 1, 1],    [chill,serenehappy,jingles,ads, stationids])
    where only one jingle,one ads,one stationids
    but if these are not prepared on time then expect some unpredictable results. eg.
    You Might have to delay each so that more than one jingles is not forced to play because the ads was not prepared  in time. Look at how I do the delay  for jingles above and do that for ads and station Id

    VOISSES

    Post edited by Voisses Tech at 2013-12-12 23:31:39
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Preserving Your Script

    One of the biggest headache is after you type all this and you upgrade your problem re-occur.
    To mitigate that here is a solution

    • Create a directory to hold your script. I will call it fallback and place it in the srv folder. (/srv/fallback)
    • make it writeable chmod 777 /srv/fallback
    • now open gedit and enter the information and then save it as autodj.liq in the folder.(/srv/fallback/autodj.liq)
    • now link your script with the airtime ls_script enter this at the terminal  
    • sudo ln -s /srv/fallback/autodj.liq  /usr/lib/airtime/pypo/bin/liquidsoap_scripts/
    • now edit the airtime ls_script as usual  line 153  by commenting the default
    • place this %include "fallback/autodj.liq" at this line or at the top
    • Restart your Airtime liquidsoap and you are good to go
    Now the next time you do an upgrade just do these three step.


    1. sudo ln -s /srv/fallback/autodj.liq  /usr/lib/airtime/pypo/bin/liquidsoap_scripts/
    2. now edit the airtime ls_script as usual  line 153  by commenting the default
    3. place this %include "fallback/autodj.liq" at this line or at the top

    The advantage is that you can modify autodj.liq anytime without have to mess with the whole airtime script and it takes less than 5 minutes to fixed each time you do an upgrade

    Tip.
    Just comment line 153 in the Airtime script
    copy the exact thing to your autodj.liq
    so if now you uncomment line 153 its like the original airtime and  if you comment line 153

    Oh I chose srv folder instead of anything else,you can chose any folder you want

    VOISSES
    Post edited by Voisses Tech at 2013-12-13 00:01:54
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Well done! Nice one :)
    No longer using Airtime or Libretime.
  • Really looking forward to the AutoDJ solution - the lack of this in AirTime is one of two or three significant major missing features.
  • Also thank you for the script fix - I'm going to go try it!
    Post edited by Krypton Radio at 2013-12-17 15:11:24
  • It failed.  It produces silence.

    I tried using the delay statements for ads, & stationids in addition to jingles - when nothing is scheduled, what goes out is simply silence.

    Obviously something else is wrong, or I have not restarted the playlist processing correctly, or the assumptions about the timing broke the logic somehow.
  • In particular, I  think I may have a problem with the weights statement.  I may have told it something that the language accepts but makes no sense logically:

    jingles=delay(1.,jingles)
    ads=delay(1.,ads)
    stationids=delay(1.,stationids)

    mixed = rotate(weights=[1,1,1,1],[jingles,ads,stationids,mixed])

  • try removing the mksafe on the daily schedule

    mixed=daily_schedule

    Give me a look at the /var/logs/airtime/pypo-liquidsoap/ls_script.liq   [i think check please ]
    when the silence occur

    make sure you have no other default=.......  in your script except   default = fallback(track_sensitive=false,[mixed,security])

    Your playlist should start playing before the default is initiated

    Logs would be great either tail it to see what going on or look at the whole thing

    VOISSES

    Voisses

    Post edited by Voisses Tech at 2013-12-19 07:08:14
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Removing the mkssafe() instruction made the security asset play in a loop.  Apparently the 'mixed' composite asset is still being incorrectly assembled, or it is not being assembled at all.

    And I think I know why.  Looking at the logs, I see, for example, this:

    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/chill/Meld-Merized-320kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/ads/4-Golden Illuminati ad-128kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/ads/4-Golden Illuminati ad-128kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/serenehappy/Brass Buttons-231kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/serenehappy/DoctorWhoTheMusical.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/stationids/Krypton Radio Station ID (2)-128kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/chill/Helicarrier-320kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/serenehappy/Setting Things Right-128kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/chill/Batman Drives To Gotham-128kbps.mp3"!
    2013/12/19 15:11:07 [request:3] Read permission denied for "/srv/airtime/standby/chill/Soran's Gun-192kbps.mp3"!


    I think - and I may be wildly mistaken here, but go with me on this - I think I have a permissions problem.

  • And that was the final problem.  My autoDJ now works - though I have only two lists in the definition of 'mixed' right now, because I wanted to strip it down to match your example and get that working first to remove as many variables as possible.

    Now I'm going to play with that line in the code and try and add more of my lists back in.

  • Oops.  It turns out I hadn't.  I'd left all the lists in.  And they just work.

    THANK YOU!  You just gave me ten hours a week of my life back!

  • Oops.  It turns out I hadn't.  I'd left all the lists in.  And they just work.

    THANK YOU!  You just gave me ten hours a week of my life back!

  • Wow this looked like my first script.


    But have no fear,If you follow my github post later this month you will see how I do mine easily,using all the features of Airtime.

    Here is what I achieve,
    • A forth category on the show tab [so it now moves from Master==>Show==>Schedule==>AutoDj
    • My AutoDj will play from playlist
    • The Playlist are generated by uploading the songs via Airtime Media.
    I actually found a way to use the existing Airtime enviroment to implement all the AutoDj without no major changes.
    Stay tuned,I am testing it Now

    Voisses


    Can you link to your GitHub project?