Add filename parameter to gen_thumb()
This commit is contained in:
parent
afaaead835
commit
66e7ef3387
8
app.py
8
app.py
|
@ -170,10 +170,13 @@ def list_media_files(folder):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def generate_thumbnails():
|
def generate_thumbnails(filename=''):
|
||||||
media_files = list_media_files(upload_folder)
|
|
||||||
if not os.path.exists(thumbnails_folder):
|
if not os.path.exists(thumbnails_folder):
|
||||||
os.mkdir(thumbnails_folder)
|
os.mkdir(thumbnails_folder)
|
||||||
|
if filename:
|
||||||
|
media_files = [{"filename": filename}]
|
||||||
|
else:
|
||||||
|
media_files = list_media_files(upload_folder)
|
||||||
for media in media_files:
|
for media in media_files:
|
||||||
if not os.path.exists(os.path.join(thumbnails_folder, media["filename"]) + ".jpg"):
|
if not os.path.exists(os.path.join(thumbnails_folder, media["filename"]) + ".jpg"):
|
||||||
print("Generating thumbnail for {}...".format(media["filename"]))
|
print("Generating thumbnail for {}...".format(media["filename"]))
|
||||||
|
@ -304,6 +307,7 @@ def upload_file(filename, chunk_size, over_write=1):
|
||||||
print(len(chunk))
|
print(len(chunk))
|
||||||
dl_file.write(chunk)
|
dl_file.write(chunk)
|
||||||
# ~ file.save(os.path.join(upload_folder, filename))
|
# ~ file.save(os.path.join(upload_folder, filename))
|
||||||
|
generate_thumbnails(filename_l)
|
||||||
return _("File saved as {}").format(file_path)
|
return _("File saved as {}").format(file_path)
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
|
GIT_URL="https://forge.chapril.org/pilpil/pilpil-client.git"
|
||||||
# dhcpcd.conf : Remove 2 last lines
|
# dhcpcd.conf : Remove 2 last lines
|
||||||
sed -i "$(( $(wc -l < /etc/dhcpcd.conf) - 2 +1 )),$ d" /etc/dhcpcd.conf
|
sed -i "$(( $(wc -l < /etc/dhcpcd.conf) - 2 +1 )),$ d" /etc/dhcpcd.conf
|
||||||
# sshd_config : Remove 3 last lines
|
# sshd_config : Remove 3 last lines
|
||||||
|
@ -7,6 +8,13 @@ sed -i "$(( $(wc -l < /etc/ssh/sshd_config) - 3 +1 )),$ d" /etc/ssh/sshd_config
|
||||||
# wpa_supplicant.conf : subs SSID and PW
|
# wpa_supplicant.conf : subs SSID and PW
|
||||||
sed -i 's/\(ssid=\"\).*/\1pilpil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
|
sed -i 's/\(ssid=\"\).*/\1pilpil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
sed -i 's/\(psk=\"\).*/\1poilpoil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
|
sed -i 's/\(psk=\"\).*/\1poilpoil\"/' /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
# Clear git/ssh credentials
|
||||||
|
#~ cd /home/pil/pilpil-client/
|
||||||
|
#~ git config --global --unset credential.helper
|
||||||
|
#~ git config --local --unset credential.helper
|
||||||
|
#~ git config --unset credential.helper
|
||||||
|
#~ rm /home/pil/.ssh/*
|
||||||
|
# sed -i "s:localgit:$GIT_URL:g" .git/config
|
||||||
# Empty a few folders
|
# Empty a few folders
|
||||||
rm -rf /home/pil/.ssh/authorized_keys /home/pil/Videos/* /etc/ssl/private/nginx-selfsigned.key /etc/ssl/certs/nginx-selfsigned.crt
|
rm -rf /home/pil/.ssh/authorized_keys /home/pil/Videos/* /etc/ssl/private/nginx-selfsigned.key /etc/ssl/certs/nginx-selfsigned.crt
|
||||||
# Create dummy file in ~/Videos to reserve some space
|
# Create dummy file in ~/Videos to reserve some space
|
||||||
|
@ -15,3 +23,5 @@ dd if=/dev/zero of=/home/pil/Videos/remove_me bs=4MB count=100
|
||||||
echo "pilpil" | sudo tee /etc/hostname
|
echo "pilpil" | sudo tee /etc/hostname
|
||||||
# hosts : Replace with hostname
|
# hosts : Replace with hostname
|
||||||
sed -i 's/\(127.0.1.1\t\).*/\1pilpil/' /etc/hosts
|
sed -i 's/\(127.0.1.1\t\).*/\1pilpil/' /etc/hosts
|
||||||
|
|
||||||
|
#awk '{print $0" consoleblank=1"}' /boot/cmdline.txt
|
Loading…
Reference in New Issue