Add thumbnail config, creation
This commit is contained in:
parent
0546484df0
commit
13e45d50b9
5
app.py
5
app.py
|
@ -28,12 +28,13 @@ for location in config_locations:
|
|||
print(_("Found configuration file in {}").format(os.path.expanduser(location)))
|
||||
|
||||
upload_folder = os.path.join(os.path.expanduser(app.config['DEFAULT']['media_folder_local']), "")
|
||||
thumbnails_folder = os.path.join(os.path.expanduser(app.config['DEFAULT']['thumbnails_folder']), "")
|
||||
media_exts = app.config['DEFAULT']['media_exts']
|
||||
HTTP_secret = str(app.config['DEFAULT']['auth'])
|
||||
debug = app.config['DEFAULT']['debug']
|
||||
useSSL = app.config['DEFAULT']['useSSL']
|
||||
rssi_signal = 0
|
||||
thumbnails_folder = "thumb"
|
||||
|
||||
|
||||
# HTTP upload settings
|
||||
app.config['UPLOAD_FOLDER'] = upload_folder
|
||||
|
@ -171,6 +172,8 @@ def list_media_files(folder):
|
|||
|
||||
def generate_thumbnails():
|
||||
media_files = list_media_files(upload_folder)
|
||||
if not os.path.exists(thumbnails_folder):
|
||||
os.mkdir(thumbnails_folder)
|
||||
for media in media_files:
|
||||
if not os.path.exists(os.path.join(thumbnails_folder, media["filename"]) + ".jpg"):
|
||||
subprocess.call(['ffmpeg', '-i', os.path.join(upload_folder, media["filename"]), '-q:v', '30', '-s', '160x120', '-vf', 'boxblur=2', '-ss', '00:00:01.000', '-vframes', '1', os.path.join(thumbnails_folder, media["filename"]) + ".jpg", "-y"])
|
||||
|
|
|
@ -3,4 +3,5 @@ debug = 1
|
|||
useSSL = true
|
||||
auth = "secret"
|
||||
media_folder_local = "~/Videos"
|
||||
thumbnails_folder = "~/Videos/thumb"
|
||||
media_exts = ["mp4", "avi", "mkv"]
|
||||
|
|
Loading…
Reference in New Issue