Fixed server port being open after quit and date being 1970 if missing

Date wil be hidden if no set,
and of GEO data is also missing "Not available" will be shown under "Photo info"
This commit is contained in:
brammp committed 2026-09-07 23:35:14 +02:00
1 parent 8580faf24d
commit 3662a6efa8
2 files changed
+10 -3

No files matched your search

+1
View File
@@ -264,5 +264,6 @@ class SlideshowHandler(http.server.SimpleHTTPRequestHandler):
if __name__ == "__main__":
os.chdir(os.path.dirname(os.path.abspath(__file__)))
print(f"Serving slideshow on http://0.0.0.0:{cfg['PORT']}")
socketserver.TCPServer.allow_reuse_address = True
with socketserver.TCPServer(("", cfg['PORT']), SlideshowHandler) as httpd:
httpd.serve_forever()
+9 -3
View File
@@ -181,14 +181,20 @@
day: 'numeric'
});
if (typeof data.geo_data == 'undefined' || data.geo_data == null) {
document.getElementById('photo-GeoData').textContent = ""
document.getElementById('photo-GeoData').textContent = ""
}else if(typeof data.geo_data.GeoData.features[0].properties.name !== 'undefined' & data.geo_data.GeoData.features[0].properties.name !== null & data.geo_data.GeoData.features[0].properties.name !== 'undefined' ){
document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.name + " - " + data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country;
}else{
document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country;
document.getElementById('photo-GeoData').textContent = data.geo_data.GeoData.features[0].properties.city+ ", " + data.geo_data.GeoData.features[0].properties.country;
}
document.getElementById('photo-Date').textContent = formatted;
if((typeof data.capture_date == 'undefined' || data.capture_date == null) && (typeof data.geo_data == 'undefined' || data.geo_data == null)){
document.getElementById('photo-Date').textContent = "Not available"
}else if (typeof data.capture_date == 'undefined' || data.capture_date == null) {
document.getElementById('photo-Date').textContent = ""
}else{
document.getElementById('photo-Date').textContent = formatted;
}
}
// --- Clock ---