Conditional filename in LoadTrack

You are missing a feature or need an enhancement? Post your suggestion here!
Post Reply
andrerotgans
Posts: 188
Joined: 27 Nov 2012 13:23

Conditional filename in LoadTrack

Post by andrerotgans » 30 Sep 2014 20:25

Hi Bernd,

Can't find it, so it's perhaps not possible at this moment, but would it be an option to use conditional filenames with the LoadTrack script line ? That way it would be possible to load a certain sound file depending on the day and hour of that day, i.e.

Kind regards,

André

User avatar
radio42
Site Admin
Posts: 6050
Joined: 05 Apr 2012 16:26

Re: Conditional filename in LoadTrack

Post by radio42 » 30 Sep 2014 21:00

To load different filenames based on the day or hour you might use the standard date and time macros, e.g. ${dow}, ${week}, ${dd}, ${HH} etc. (see the User Manual Appendix for details)

Or are you mixing this with...
Conditional, dynamic script-line Filters added
You can now use track macros within script-line filters. Any regular track macro like for example ${genre} will then be replaced by the data of the last scheduled track.
E.g. the following filter would make sure, that the Genre of the current script-like is the same as the genre of the previous scheduled track; but the rating must be different:
~[Genre] == '${genre}' And [Rating] <> '${rating}'


Or are you mixing this with...
Conditional Program (Script) execution added
viewtopic.php?f=4&t=1016


Or are you mixing this with...
Script-Rules...
viewtopic.php?f=4&t=705


However, I assume, that with one of the above 4 options you can achieve what you want...

andrerotgans
Posts: 188
Joined: 27 Nov 2012 13:23

Re: Conditional filename in LoadTrack

Post by andrerotgans » 01 Oct 2014 13:14

Thanks Bernd, I wasn't aware that the standard date and time macros also work in a file 'get' situation. I use it when creating files, and that works flawless. So, I'll give that a try.

Just one more question. If I use the current hour (${HH} ie) in a script line on a load track, somewhere in a script ie :

loadtrack c:\audio\thisisarecordedshowfor${HH}oclock.mp3

And the script is fired of at 12.59.00, from the scheduler. The scrip line itself is due for 13:05:00. Is the ${HH} resolved at the moment that the script line is executed, or is it resolved at the start of the script ?
You'll probably know why I'm asking it, in the first case ${HH} will resolve to 13, if it's resolved at the start of the script it's resolved to 12.

Best regards,

André

User avatar
radio42
Site Admin
Posts: 6050
Joined: 05 Apr 2012 16:26

Re: Conditional filename in LoadTrack

Post by radio42 » 01 Oct 2014 13:33

The following script-line modes do support macros:
- LoadTrack
- LoadPlaylist
- Container
- LoadFolder

The standard date/time macros (e.g. ${HH} etc.) resolve to the current system date/time! That is correct.
Use one of the following macros to reference the defined program start time (instead of the effective system date/time; as defined in the User Manual Appendix):
${scriptname} : the name of the script
${programname} : the name of the program
${programtype} : the type of the program
${start} : the program start date and time in format ‘yyyy-MM-dd HH:mm:ss’
${start_yyyy} : the program start year 4-digits (0000-9999)
${start_yy} : the program start year 2-digits (00-99)
${start_MM} : the program start month 2-digits (00-12)
${start_dd} : the program start day 2-digits (00-31)
${start_dow} : the program start day of the week (1=Monday…7=Sunday)
${start_week} : the program start Iso8601 week number 2-digits (00-53)
${start_HH} : the program start hour 2-digits (00-23)
${start_mm} : the program start minute 2-digits (00-59)
${start_ss} : the program start second 2-digits (00-59)
${end} : the program end date and time in format ‘yyyy-MM-dd HH:mm:ss’
${end_yyyy} : the program end year 4-digits (0000-9999)
${end_yy} : the program end year 2-digits (00-99)
${end_MM} : the program end month 2-digits (00-12)
${end_dow} : the program end day of the week (1=Monday…7=Sunday)
${end_week} : the program end Iso8601 week number 2-digits (00-53)
${end_dd} : the program st end art day 2-digits (00-31)
${end_HH} : the program end hour 2-digits (00-23)
${end_mm} : the program end minute 2-digits (00-59)
${end_ss} : the program end second 2-digits (00-59)

andrerotgans
Posts: 188
Joined: 27 Nov 2012 13:23

Re: Conditional filename in LoadTrack

Post by andrerotgans » 01 Oct 2014 20:23

Ok, thanks. But, regarding my earlier question, I understand it correct that the macro's will be resolved at the start of the script ?
So, in my example it will resolve ${HH} as 12 ?

Best regards,

André

User avatar
radio42
Site Admin
Posts: 6050
Joined: 05 Apr 2012 16:26

Re: Conditional filename in LoadTrack

Post by radio42 » 01 Oct 2014 22:40

Yes, the standard date/time macros are resolved when the resp. script line is executed.
E.g. in your example ${HH}:${mm} would be resolved to 12:59.
You might use the ${fix_HH}:${fix_mm} macro to resolve to the estimated scheduled time, in your example to 13:05.
Or the above mentioned macros to resolve to the program start/end time.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests