Compare commits

..

No commits in common. "fedd9ac3a077030daf359f1682014315f80f1d55" and "844ad5452e64a3b5e3279d90b801ab2d04a7acb3" have entirely different histories.

5 changed files with 8 additions and 26 deletions

View File

@ -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/share/hfs/misc/tfm_temp/scan" scan_dir = "/srv/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,11 +127,7 @@ 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"]
@ -144,13 +140,9 @@ def scan(message):
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:
dt = TZ.localize(datetime.strptime(dt[:19], "%Y:%m:%d %H:%M:%S"))
except: except:
log.error("Broken date: %s\t%s" % (new_file, dt)) dt = TZ.localize(datetime.strptime(dt, "%Y:%m:%d %H:%M:%S"))
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.")

View File

@ -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 - 100) { if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
files_load(); files_load();
} }
}); });

View File

@ -1,11 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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>#5c913b</TileColor></tile></msapplication></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,7 +7,6 @@
"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",

View File

@ -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="image/jpeg" mimetype=file["mime_name"]
) )
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="image/jpeg" mimetype=file["mime_name"]
) )
except: except:
abort(404) abort(404)