Compare commits
5 Commits
844ad5452e
...
fedd9ac3a0
| Author | SHA1 | Date | |
|---|---|---|---|
| fedd9ac3a0 | |||
| 586b597ae5 | |||
| e4173c73fe | |||
| 22983bee73 | |||
| 87555c9670 |
@ -119,7 +119,7 @@ def file_handler(message):
|
|||||||
def scan(message):
|
def scan(message):
|
||||||
tfm_tb.reply_to(message, "Scanning...")
|
tfm_tb.reply_to(message, "Scanning...")
|
||||||
log.info("Scanning...")
|
log.info("Scanning...")
|
||||||
scan_dir = "/srv/hfs/misc/tfm_temp/scan"
|
scan_dir = "/srv/share/hfs/misc/tfm_temp/scan"
|
||||||
files = []
|
files = []
|
||||||
for file in os.listdir(scan_dir):
|
for file in os.listdir(scan_dir):
|
||||||
new_file = {"name": file}
|
new_file = {"name": file}
|
||||||
@ -127,7 +127,11 @@ def scan(message):
|
|||||||
if not os.path.isfile(file):
|
if not os.path.isfile(file):
|
||||||
continue
|
continue
|
||||||
new_file["path"] = file
|
new_file["path"] = file
|
||||||
|
try:
|
||||||
exif = ljson(os.popen(f"exiftool -json \"{file}\"").read())[0]
|
exif = ljson(os.popen(f"exiftool -json \"{file}\"").read())[0]
|
||||||
|
except Exception as e:
|
||||||
|
log.error("Error while parsing EXIF for file '%s': %s" % (file, e))
|
||||||
|
continue
|
||||||
dt = exif["FileModifyDate"]
|
dt = exif["FileModifyDate"]
|
||||||
if "SubSecDateTimeOriginal" in exif.keys():
|
if "SubSecDateTimeOriginal" in exif.keys():
|
||||||
dt = exif["SubSecDateTimeOriginal"]
|
dt = exif["SubSecDateTimeOriginal"]
|
||||||
@ -139,10 +143,14 @@ def scan(message):
|
|||||||
except:
|
except:
|
||||||
dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S.%f"))
|
dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S.%f"))
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
dt = datetime.strptime(dt, "%Y:%m:%d %H:%M:%S%z")
|
dt = datetime.strptime(dt, "%Y:%m:%d %H:%M:%S%z")
|
||||||
except:
|
except:
|
||||||
dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S"))
|
dt = TZ.localize(datetime.strptime(dt[:19], "%Y:%m:%d %H:%M:%S"))
|
||||||
|
except:
|
||||||
|
log.error("Broken date: %s\t%s" % (new_file, dt))
|
||||||
|
continue
|
||||||
new_file["datetime"] = dt
|
new_file["datetime"] = dt
|
||||||
files.append(new_file)
|
files.append(new_file)
|
||||||
tfm_tb.reply_to(message, f"{len(files)} files found.")
|
tfm_tb.reply_to(message, f"{len(files)} files found.")
|
||||||
|
|||||||
@ -75,7 +75,7 @@ $(window).on("load", function (e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("main").scroll(function (e) {
|
$("main").scroll(function (e) {
|
||||||
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
|
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 100) {
|
||||||
files_load();
|
files_load();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,2 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<browserconfig><msapplication><tile><square70x70logo src="/images/ms-icon-70x70.png"/><square150x150logo src="/images/ms-icon-150x150.png"/><square310x310logo src="/images/ms-icon-310x310.png"/><TileColor>#5c913b</TileColor></tile></msapplication></browserconfig>
|
<browserconfig>
|
||||||
|
<msapplication>
|
||||||
|
<tile>
|
||||||
|
<square70x70logo src="/images/ms-icon-70x70.png" />
|
||||||
|
<square150x150logo src="/images/ms-icon-150x150.png" />
|
||||||
|
<square310x310logo src="/images/ms-icon-310x310.png" />
|
||||||
|
<TileColor>#615880</TileColor>
|
||||||
|
</tile>
|
||||||
|
</msapplication>
|
||||||
|
</browserconfig>
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
"scope": "/",
|
"scope": "/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#615880",
|
"theme_color": "#615880",
|
||||||
|
"background_color": "#312F45",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "\/images\/android-icon-36x36.png",
|
"src": "\/images\/android-icon-36x36.png",
|
||||||
|
|||||||
@ -434,7 +434,7 @@ def thumb(file_id=None):
|
|||||||
raise RuntimeError("File does not exist")
|
raise RuntimeError("File does not exist")
|
||||||
return send_file(
|
return send_file(
|
||||||
tfm_api.previewer.get_jpeg_preview(join(tfm_api.conf["Paths"]["Files"], file_id), height=160, width=160),
|
tfm_api.previewer.get_jpeg_preview(join(tfm_api.conf["Paths"]["Files"], file_id), height=160, width=160),
|
||||||
mimetype=file["mime_name"]
|
mimetype="image/jpeg"
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
abort(404)
|
abort(404)
|
||||||
@ -453,7 +453,7 @@ def preview(file_id=None):
|
|||||||
raise RuntimeError("File does not exist")
|
raise RuntimeError("File does not exist")
|
||||||
return send_file(
|
return send_file(
|
||||||
tfm_api.previewer.get_jpeg_preview(join(tfm_api.conf["Paths"]["Files"], file_id), height=1080, width=1920),
|
tfm_api.previewer.get_jpeg_preview(join(tfm_api.conf["Paths"]["Files"], file_id), height=1080, width=1920),
|
||||||
mimetype=file["mime_name"]
|
mimetype="image/jpeg"
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user