If Load Track with macro fails, loading random track from specified folder

You have a question or need an advice about how to do something? Ask it here!
Post Reply
marvex
Posts: 4
Joined: 10 Nov 2022 12:13
If Load Track with macro fails, loading random track from specified folder

Post by marvex »

I made script to Program Scheduler or Overlay Scheduler:
Load Track - S:\shows\showZXCV\ZXCV ${start_yy}-${start_MM}-${start_dd}.mp3
It's fails ( don't have show for this day, bad file name ... etc)
After that when It's fails can then load random fail from folder S:\shows\showZXCV\ or from Media Libraries showZXCV ?
User avatar
radio42
Site Admin
Posts: 7533
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: If Load Track with macro fails, loading random track from specified folder

Post by radio42 »

When a track fails to load (eg. via the LoadTrack) mode, this script-line is being skipped and the next script-line is used.
I assume your current script looks like this:
Script-A:
1. LoadTrack, S:\shows\showZXCV\ZXCV ${start_yy}-${start_MM}-${start_dd}.mp3, Count=1
2. …

To achieve to load a random track, if that fails, you can modify you script like this:
Script-A:
1. Execute, Script-B, Count=1
2. …

Script-B:
1. LoadTrack, S:\shows\showZXCV\ZXCV ${start_yy}-${start_MM}-${start_dd}.mp3, Count=1
2. LoadFolder, S:\shows\showZXCV|6|ZXCV*.mp3, Count=1

EG. Instead of directly using the LoadTrack script-line you execute a 2nd Script-B to return 1 track. In that script you now use the LoadTrack mode and if that fails the next script-line is used to load a folder content and randomly pick one track with a filter filename…

So yes, this is possible.
marvex
Posts: 4
Joined: 10 Nov 2022 12:13
Re: If Load Track with macro fails, loading random track from specified folder

Post by marvex »

To continue the question:
After the Script B picks random file and plays it on the air at 11 o'clock ( this was show x ) which should repeat the next day at 6 p.m.
Can we made some script / macro to play exact same randomly picket file/show/music as reruns on 6 p.m. on next day ?

or situation two:
randomly picked track as " song of the day " first plays at 11:25 then repeats it 13:25 and 15:55 and 19:05
User avatar
radio42
Site Admin
Posts: 7533
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: If Load Track with macro fails, loading random track from specified folder

Post by radio42 »

Yes, you can set an Archive (see script settings) to record/save the generated script playlist to a file.
You can then create another script, which uses the LoadPlaylist mode to load and play that playlist file on the other day, eg. use that other script.
Note, make sure to not run Script B again before the show has repeated, as it would override the archive playlist.

The 2nd request isn’t that trivial, as the system can not randomly select a song of the day for you. Eg. this might need to be selected and saved to a fixed filename by you. You might then use the LoadTrack mode of a script-line to play this file.
You can schedule this on fixed time slots using eg. the Overlay Scheduler or using a Fixed-Time-Element.
marvex
Posts: 4
Joined: 10 Nov 2022 12:13
Re: If Load Track with macro fails, loading random track from specified folder

Post by marvex »

radio42 wrote: 23 Nov 2022 07:31 The 2nd request isn’t that trivial, as the system can not randomly select a song of the day for you. Eg. this might need to be selected and saved to a fixed filename by you. You might then use the LoadTrack mode of a script-line to play this file.
You can schedule this on fixed time slots using eg. the Overlay Scheduler or using a Fixed-Time-Element.
For Example :
I make Folder / library where I put all songs which could be " Song Of The Day"
And make script LoadFolder, S:\music\songOfTheDay, Count=1 and using "Archive" value as You indicated and 2-3 times (13:25, 15:55, 19:05) I refer to pick this Archive file ?
User avatar
radio42
Site Admin
Posts: 7533
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: If Load Track with macro fails, loading random track from specified folder

Post by radio42 »

There had been a small issue with the archive and the skipping of LoadPlaylist script-line in case , so a new version 4.3.3.4 is available.
To your two case...

1) Pick a show with macros and if that is not existing use the next script-line:
Script-A:
1. Execute, Script-B, Count=1
2. ...

Script-B:
1. LoadPlaylist, S:\shows\showZXCV\ZXCV ${start_yy}-${start_MM}-${start_dd}.mp3, Count=1, Option=KeepStreamLoading
2. LoadFolder, S:\shows\showZXCV|6|ZXCV*.mp3, Count=1

Note, that the Option KeepStreamLoading for the LoadPlaylist script-line must be set, in order to skip that line if the playlist file does not exist (this is actually new in v4.3.3.4).


2) Song-Of-The-Day: Here are three scripts needed:
The first one generates the song of the day and saves it into the archive, so that it can later played again.
Script-C:
1. ...
2. ...
3. Execute, Script-D, Count=1, Option=KeepStreamLoading
4. ...

Script-Line 4 generates the song-of-the day and the , KeepStreamLoading option ensures, that the archive is fully written (also new in v4.3.3.4).

Script-D:
Archive: C:\Temp\SoD.pfp
1. LoadFolder, S:\music\songOfTheDay|6|, Count=1

This script loads a random rack from a folder and saves the script execution in an archive playlist.

To repeat the song-of-the-day, you simply load that SoD.pfp playlist, it should only contain one entry - the song-of-the-day as generated in Script-C.
...
3. LoadPlaylist, C:\Temp\SoD.pfp, Count=1

Post Reply