diff --git a/scripts/daily_plot.py b/scripts/daily_plot.py index 6762393..e2147b0 100755 --- a/scripts/daily_plot.py +++ b/scripts/daily_plot.py @@ -12,7 +12,7 @@ userDir = os.path.expanduser('~') conn = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db') df = pd.read_sql_query("SELECT * from detections", conn) cursor = conn.cursor() -cursor.execute('SELECT * FROM detections') +cursor.execute('SELECT * FROM detections WHERE Date = DATE(\'now\', \'localtime\')') table_rows = cursor.fetchall() diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 8ef7cff..399cca6 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -320,7 +320,7 @@ install_chart_viewer_service() { Description=BirdNET-Pi Chart Viewer Service [Service] Restart=always -RestartSec=300 +RestartSec=60 Type=simple User=$USER ExecStart=/usr/local/bin/daily_plot.py diff --git a/scripts/overview.php b/scripts/overview.php index c622faa..2af64f8 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -1,5 +1,4 @@ execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); + + +if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isset($_GET['previous_detection_identifier'])) { + if($_GET['previous_detection_identifier'] != $filename || $_GET['previous_detection_identifier'] == "undefined") { + // check to make sure the image actually exists, sometimes it takes a minute to be created + if (isset($_SERVER['HTTPS']) && + ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || + isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $protocol = 'https://'; + } + else { + $protocol = 'http://'; + } + $headers = @get_headers($protocol.$_SERVER['HTTP_HOST'].$filename.".png"); + if(strpos($headers[0],'200')) { + ?> + +
| + | + +
No Detections For Today
"; } ?> +| - | - -
+";
+?>
+
+