new names
This commit is contained in:
parent
ed4b2fde61
commit
867abbf74d
2 changed files with 8 additions and 7 deletions
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
from glob import glob
|
||||
|
@ -34,14 +33,14 @@ playlist = 'play.m3u'
|
|||
today = datetime.date.today()
|
||||
seconds_since_midnight = time.time() - time.mktime(today.timetuple())
|
||||
|
||||
prefix = ''
|
||||
prefix = 'video/'
|
||||
if os.path.exists('local'):
|
||||
prefix = '/srv/pandora/static/render/'
|
||||
|
||||
files = []
|
||||
videos = {}
|
||||
for letter in string.ascii_uppercase:
|
||||
videos[letter] = glob('%s*/%s.mp4' % (prefix, letter))
|
||||
videos[letter] = glob('%s%s*.mp4' % (prefix, letter.lower()))
|
||||
random.shuffle(videos[letter])
|
||||
|
||||
for i in range(10):
|
||||
|
|
|
@ -18,19 +18,21 @@ os.chdir(folder)
|
|||
|
||||
if os.path.exists(lock):
|
||||
sys.exit(0)
|
||||
with open(lock, 'w') as f: f.write('')
|
||||
with open(lock, 'w') as f:
|
||||
f.write('')
|
||||
|
||||
for i in range(10):
|
||||
for letter in string.ascii_uppercase:
|
||||
name = '%02d/%s.mp4' % (i, letter)
|
||||
for letter in string.ascii_lowercase:
|
||||
name = '%s%02d.1080p.mp4' % (letter, i)
|
||||
url = '%s/%s' % (base, name)
|
||||
name = 'video/' + name
|
||||
folder = os.path.dirname(name)
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
if os.path.exists(name):
|
||||
head = requests.head(url)
|
||||
mtime = time.mktime(datetime.datetime.strptime(head.headers.get("Last-Modified"), "%a, %d %b %Y %X GMT").timetuple())
|
||||
get = mtime > os.path.getmtime(name)
|
||||
get = mtime > os.path.getmtime(name) or int(head.headers.get("Content-Length")) != os.path.getsize(name)
|
||||
else:
|
||||
get = True
|
||||
if get:
|
||||
|
|
Loading…
Reference in a new issue