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
import datetime
import time
import string
import random
import ox
import mpv
@ -32,10 +34,20 @@ playlist = 'play.m3u'
today = datetime.date.today()
seconds_since_midnight = time.time() - time.mktime(today.timetuple())
prefix = ''
if os.path.exists('local'):
files = sorted(glob('/srv/pandora/static/render/*/*.mp4'))
else:
files = sorted(glob('*/*.mp4'))
prefix = '/srv/pandora/static/render/'
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
while position < seconds_since_midnight:
f = files.pop(0)