This commit is contained in:
j 2017-03-15 11:08:49 +01:00
parent 87b4d1bd0d
commit 6bce711ea3

View file

@ -5,6 +5,8 @@ import sys
from glob import glob from glob import glob
import datetime import datetime
import time import time
import string
import random
import ox import ox
import mpv import mpv
@ -32,10 +34,20 @@ playlist = 'play.m3u'
today = datetime.date.today() today = datetime.date.today()
seconds_since_midnight = time.time() - time.mktime(today.timetuple()) seconds_since_midnight = time.time() - time.mktime(today.timetuple())
prefix = ''
if os.path.exists('local'): if os.path.exists('local'):
files = sorted(glob('/srv/pandora/static/render/*/*.mp4')) prefix = '/srv/pandora/static/render/'
else:
files = sorted(glob('*/*.mp4')) files = []
videos = {}
for letter in string.ascii_uppercase:
videos[letter] = glob('%s*/%s.mp4' % (prefix, letter))
random.shuffle(videos[letter])
for i in range(10):
for letter in string.ascii_uppercase:
files.append(videos[letter][i])
position = 0 position = 0
while position < seconds_since_midnight: while position < seconds_since_midnight:
f = files.pop(0) f = files.pop(0)