#!/usr/local/twc/bin/python

#
# The purpose of this file is to generate a list of times and an index number
# so that the product team can check the bkg music scheduling.
#
# This is the scheduler for the background music for the LocalOCM segment
# There should be 6 songs from which to chose.
# The desire is to not play the same song at the same time each day.

import time

for dow in range(7):
    for h in range(24):
            for m in range(60): #Use this to see every minute
            #for m in range(8,60,10): # Use this to see only the 8's
                    # The local may not always start exactly on the 8's so we
                    # add 5 to the minutes so that a few minutes either way
                    # will produce the same index
                    # Also add 1 to the index for each hour and each day
                    # so we get a different song at the same time each consecutive day.
                    ndx=(((m+5)/10)+h+dow)%6 #NOTE: This assumes 6 songs available
                    print 'dow=%d h=%d m=%d ndx=%d' % (dow,h,m,ndx)


# Thsi is the code we use in the scheduler to generate the index.
y,m,d,h,m,s,dow,jul,dst=time.gmtime()
ndx=(((m+5)/10)+h+dow)%6
print 'current selection for dow=%d h=%d m=%d ndx=%d' % (dow,h,m,ndx)

