Here is a python script that I use to fill to the top of the hour.
Change your database variables accordingly
Change the music and sweeper categories (Case Sensitive)
The drift variable is for the average size of the sweeper that the macro 
is going into.
The margin variable is to help pick songs by giving you +/- on the song size

The number of songs to pick is in Milliseconds.  Change according to 
your format.
I have hard coded the hostname to localhost just because this really 
should be ran from your On-Air machine but change it if you want to mess 
with your On Air Staff.

In the macro cart I have RN //var/snd/scripts/filltoTop.py!
Create your cart for where ever you put the script.
Make sure the script is executable.
You will need the mysql python module

In your log you will have your topofhour macro ->sweeper




On#!/usr/bin/python
# -*- coding: utf-8 -*-

import MySQLdb as mdb
import datetime
import subprocess
import sys,  os

con = None
host = '192.168.2.6'
user = 'rduser'
upword = 'letmein'
dbase = 'Rivendell'
## Where to get your fill songs
##Make sure all the quotes arre there
musicGroups = " 'CrnkdMusic', 'CrnkTemp' "
## Where to get your sweepers, jingles, splitters
sweeperGroups = " 'Sweepers' "
hourNow = datetime.datetime.now().hour
minNow = datetime.datetime.now().minute
secNow = datetime.datetime.now().second
##Change the 60 to what ever minute in the hour your want to fill to
secFromTop = ((minNow*60)+secNow)*1000
secLeft = ((60*60*1000)-secFromTop)
## Average size of Previous Sweeper in millisec
drift = 4000
## Plus/Minus song size in millisec
margin = 1750
secLeft = secLeft-drift

## Number of songs to pick
if secLeft < 360000 :
     songCount = 1
elif (secLeft > 360000) & (secLeft < 540000 ):
    songCount = 2
elif (secLeft > 540000) & (secLeft < 780000 ):
    songCount = 3
elif (secLeft > 780000) & (secLeft < 960000 ):
    songCount = 4
elif (secLeft > 960000) & (secLeft < 1080000 ):
    songCount = 5
elif (secLeft > 1080000) & (secLeft < 1440000 ):
    songCount = 6
elif (secLeft > 1440000) & (secLeft < 1800000 ):
    songCount = 7
else:
     songCount = 8

try:
     con = mdb.connect(host,  user,  upword,  dbase);
     cur = con.cursor()
     if songCount == 1:
         cur.execute("select number, average_length from Rivendell.CART 
where average_length between {0} and {1} and GROUP_NAME in ({2}) order 
by Rand() limit 1".format((secLeft-margin),  (secLeft+margin), musicGroups))
         data = cur.fetchone()
         subprocess.call (["rmlsend", "--to-host=localhost"," PX 1 
{0}!".format(data[0])])

     elif songCount > 1:
         songs = ((songCount*2)-1)
         for i in range(songs):
             if i%2==0:
                 cur.execute("select number, average_length from 
Rivendell.CART where average_length between {0} and {1} and GROUP_NAME 
in ({2}) order by Rand() limit 1".format(((secLeft/songCount)-margin), 
((secLeft/songCount)+margin), musicGroups))
                 data = cur.fetchone()
                 secLeft = secLeft-data[1]
                 subprocess.call (["rmlsend", "--to-host=localhost"," PX 
1 {0}!".format(data[0])])
                 songCount=songCount-1
             else:
                 cur.execute("select number, average_length from 
Rivendell.CART where GROUP_NAME in ({0}) order by Rand() limit 
1".format(sweeperGroups))
                 data = cur.fetchone()
                 secLeft = secLeft-data[1]
                 subprocess.call (["rmlsend", "--to-host=localhost"," PX 
1 {0}!".format(data[0])])

except mdb.Error,  e:

     print "Error %d: %s" % (e.args[0], e.args[1])
     sys.exit(1)

finally:
     if con:
         con.close()
013 2:53 AM, Jay Eames wrote:
> Hi guys,
>
> I've done some digging around on Google and the like, but so far have 
> been unable to find a definitive answer.
>
> As far as I understand it, Rivendell does not support back timing, 
> which is presenting us with a bit of a problem when it comes to the 
> run up to the news.
>
> The news is hard timed to the top of the hour, and when in automatic 
> mode it will play music before hand. The problem is that to ensure 
> there isn't silence before the news we overfill the hour, but this 
> often means that we end up playing less than 30 seconds of a track 
> before the news fires. Clearly this doesn't sound very good at all.
>
> I am interested in how other people deal with TOTH hard starts like 
> this in Rivendell? Is there something obvious (or not so obvious) that 
> I'm missing?
>
> Jay
>
> -- 
> There are 2 kinds of people in the world; Those who can 
> extrapolate from incomplete data
>
>
> _______________________________________________
> Rivendell-dev mailing list
> [email protected]
> http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev

_______________________________________________
Rivendell-dev mailing list
[email protected]
http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev

Reply via email to