Compare commits

...

5 Commits

5 changed files with 26 additions and 8 deletions

View File

@ -119,7 +119,7 @@ def file_handler(message):
def scan(message):
tfm_tb.reply_to(message, "Scanning...")
log.info("Scanning...")
scan_dir = "/srv/hfs/misc/tfm_temp/scan"
scan_dir = "/srv/share/hfs/misc/tfm_temp/scan"
files = []
for file in os.listdir(scan_dir):
new_file = {"name": file}
@ -127,7 +127,11 @@ def scan(message):
if not os.path.isfile(file):
continue
new_file["path"] = file
exif = ljson(os.popen(f"exiftool -json \"{file}\"").read())[0]
try:
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"]
if "SubSecDateTimeOriginal" in exif.keys():
dt = exif["SubSecDateTimeOriginal"]
@ -140,9 +144,13 @@ def scan(message):
dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S.%f"))
else:
try:
dt = datetime.strptime(dt, "%Y:%m:%d %H:%M:%S%z")
try:
dt = datetime.strptime(dt, "%Y:%m:%d %H:%M:%S%z")
except:
dt = TZ.localize(datetime.strptime(dt[:19], "%Y:%m:%d %H:%M:%S"))
except:
dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S"))
log.error("Broken date: %s\t%s" % (new_file, dt))
continue
new_file["datetime"] = dt
files.append(new_file)
tfm_tb.reply_to(message, f"{len(files)} files found.")

View File

@ -75,7 +75,7 @@ $(window).on("load", 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();
}
});

View File

@ -1,2 +1,11 @@
<?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>

View File

@ -7,6 +7,7 @@
"scope": "/",
"display": "standalone",
"theme_color": "#615880",
"background_color": "#312F45",
"icons": [
{
"src": "\/images\/android-icon-36x36.png",

View File

@ -434,7 +434,7 @@ def thumb(file_id=None):
raise RuntimeError("File does not exist")
return send_file(
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:
abort(404)
@ -453,7 +453,7 @@ def preview(file_id=None):
raise RuntimeError("File does not exist")
return send_file(
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:
abort(404)