Hi Dave,

I've been playing around with the script and it works really well.  I changed 
it to include any entry rather than hard times which is handy, I also added a 
host variable as my dbs aren't local.  

The only error checking I can think of is to test the SQL result but if you get 
a bogus result you most likely won't have an SQL server to talk to anyway so 
Riv won't be able to do much so its kind of a pointless check.

I decided to dig into the code to see if I could make LL do a Make Next rather 
than a straight play as I didn't like the current event being cut off if 
someone clicked reload log.

>From what I can figure out so far LL is handled in rdairplay/local_macros.cpp 
>Line 99 onwards.

The only thing thats stopping this from working is that after loading the log 
Riv performs air_log[whatever_log_machine] -> play(given_line, 
RDLogLine::StartMacro)

If it could do a makenext instead e.g.:

air_log[whatever_log_machine]->makeNext(given_line);

So I propose an alteration to the LL macro to take 4 arguments instead of 3.

LL <mach> [<log>] [<start-line>] [<make-next>]!

Make-Next = 1 to make next or 0 to play (or don't set it to play)

The code changes are actually pretty minor:

Line 100 changes to:

if((rml->argQuantity()<1)||(rml->argQuantity()>4)) { //I changed >3 to >4

Then line 136 gets an extra part of the if:

if(rml->argQuantity()==3 || rml->argQuantity()==4) { // Start Log 
//I added || rml->argQuantity()==4

Then Before the line if(rml->argQuantity()==3){ I add some extra ifs as follows:

if(rml->argQuantity()==4 && rml->arg(3).toInt()==1){
  air_log[rml->arg(0).toInt()-1]->makeNext(rml->arg(2).toInt());
}else{
  air_log[rml->arg(0).toInt()-1]->play(rml->arg(2).toInt(),
                                         RDLogLine::StartMacro);
}

All I'm doing here is saying if we have 4 arguments and the 4th (0 - 3) is set 
to 1 then do a makeNext

Else do a play

So now you can do LL 1 LOG 100 1 and it will make next.  I've tested this to 
make sure I didn't break anything.

Thought I'd post this here in case anyone finds it useful.

Thanks again for the bash script, made me feel stupid how easy it was to do 
which is always a good thing.

Regards,

Wayne

-----Original Message-----
From: rivendell-dev-boun...@lists.rivendellaudio.org on behalf of Dave B.
Sent: Mon 23/07/2012 18:57
To: User discussion about the Rivendell Radio Automation System
Subject: Re: [RDD] Scrolling to current time on Load
 
I've been experimenting with a shell script that does this when run via 
the Run Shell Command macro. The script below assumes a log date format 
something like yymmdd_log and builds the table name accordingly. It then 
opens the database, performs a query on that table, finds the nearest 
hard start time, and uses rmlsend to run a Load Log macro to load the 
log at one line before the specific line number returned (in the field 
named COUNT). Still very experimental and with no error 
checking/recovery, but it seems to work quite well! Feel free to tweak 
to your needs and post improvements!

#!/bin/bash
let h=$(date +%-k)*3600000
let m=$(date +%-M)*60000
let s=$(date +%-S)*1000
let ms=$h+$m+$s

NOWDATE=$(date +%Y%m%d)
LOG_NAME=$NOWDATE"_LOG"
user="rduser"
pass="letmein"
db="Rivendell"

let SQLRESULT=$(mysql --skip-column-names -u "$user" -p"$pass" "$db" -e 
"select COUNT from $LOG_NAME WHERE START_TIME >= $ms AND TIME_TYPE=1 
LIMIT 1";)-1

rmlsend LL\ 1\ $NOWDATE\ $SQLRESULT\!




On 7/23/2012 5:56 PM, Wayne Merricks wrote:
> Hi all,
>
> Apologies for the questions lately, as way of an apology I logged 3 bugs
> on mantis and then went on to fix two of them (source code attached on
> mantis too).
>
> Is it possible to scroll the log to the current time when airplay is
> loaded via some macro magic?
>

_______________________________________________
Rivendell-dev mailing list
Rivendell-dev@lists.rivendellaudio.org
http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev


#######################
Scanned by MailMarshal
#######################

############

Attention: 

The information contained in this message is confidential and intended 
for the addressee(s) only. If you have received this message in error 
or there are any problems, please notify the originator immediately.
The unauthorised use, disclosure, copying or alteration of this message
is strictly forbidden. Christian Vision or any of its subsidiaries will
not be liable for direct, special, indirect or consequential damages 
arising from alteration of the contents of this message by a third party
or as a result of any virus being passed on. Please note that we reserve
the right to monitor and read any e-mails sent or received by the 
company under the Telecommunications (Lawful Business Practice) 
(Interception of Communications) Regulation 2000. Christian Vision is 
registered in England as a limited company 2842414 and as a charity 
1031031  

############

<<winmail.dat>>

_______________________________________________
Rivendell-dev mailing list
Rivendell-dev@lists.rivendellaudio.org
http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev

Reply via email to