play
This commit is contained in:
parent
87b4d1bd0d
commit
6bce711ea3
1 changed files with 15 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue