From 6765ffbe8d38d85cb18fdc39dffd59645155ce38 Mon Sep 17 00:00:00 2001 From: David Lamkin Date: Sun, 26 Feb 2023 16:43:09 +0000 Subject: [PATCH 01/12] streamlit st.cache deprecated - use st.cache_data st.cache_resource Since streamlit 1.18.0 (Feb 14th 2023) st.cache has been deprecated: the functionality exists in two new forms st.cache_data and st.cache_resource. Use of st.cache produces a deprecation warning --- scripts/plotly_streamlit.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.py index fe8fa08..29392a8 100755 --- a/scripts/plotly_streamlit.py +++ b/scripts/plotly_streamlit.py @@ -38,8 +38,7 @@ st.markdown(""" """, unsafe_allow_html=True) -@st.cache(hash_funcs={Connection: id}) -# @st.cache(allow_output_mutation=True) +@st.cache_resource() def get_connection(path: str): return sqlite3.connect(path, check_same_thread=False) @@ -89,7 +88,7 @@ else: # end_date = datetime(2022 ,5 ,17).date() -@st.cache() +@st.cache_data() def date_filter(df, start_date, end_date): filt = (df2.index >= pd.Timestamp(start_date)) & (df2.index <= pd.Timestamp(end_date + timedelta(days=1))) df = df[filt] @@ -132,7 +131,7 @@ else: resample_time = resample_times[resample_sel] -@st.cache() +@st.cache_data() def time_resample(df, resample_time): if resample_time == 'Raw': df_resample = df['Com_Name'] From ff3c5384942386efe8d155d69cd98ad6e2584353 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:39:21 -0500 Subject: [PATCH 02/12] streamlit==1.19.0 --- requirements.txt | 2 +- scripts/update_birdnet_snippets.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0096dc5..da95e33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ pytz tzlocal pandas seaborn -streamlit==1.11.1 +streamlit==1.19.0 plotly apprise==1.2.1 paho-mqtt diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index e9c85dd..c2853f6 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -158,7 +158,7 @@ CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, EOF $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 >/dev/null -$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.11.1 >/dev/null +$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 >/dev/null if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service" From 5d9d5a52f09dab736539a8e053d95c8b01a811be Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:54:46 -0500 Subject: [PATCH 03/12] Revert "streamlit==1.19.0" This reverts commit ff3c5384942386efe8d155d69cd98ad6e2584353. --- requirements.txt | 2 +- scripts/update_birdnet_snippets.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index da95e33..0096dc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ pytz tzlocal pandas seaborn -streamlit==1.19.0 +streamlit==1.11.1 plotly apprise==1.2.1 paho-mqtt diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index c2853f6..e9c85dd 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -158,7 +158,7 @@ CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, EOF $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 >/dev/null -$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 >/dev/null +$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.11.1 >/dev/null if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service" From 515201b7bdd0d9ee81b05a9bdc1e2ae9293112a6 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:54:55 -0500 Subject: [PATCH 04/12] Revert "Merge pull request #764 from lamkin/drl/st_cache_deprecated" This reverts commit d60f59e6faa107c9bdbc8d21507f8bcc69a40bd1, reversing changes made to 502137bf787f128ad061635efa9664484efe2405. --- scripts/plotly_streamlit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.py index 29392a8..fe8fa08 100755 --- a/scripts/plotly_streamlit.py +++ b/scripts/plotly_streamlit.py @@ -38,7 +38,8 @@ st.markdown(""" """, unsafe_allow_html=True) -@st.cache_resource() +@st.cache(hash_funcs={Connection: id}) +# @st.cache(allow_output_mutation=True) def get_connection(path: str): return sqlite3.connect(path, check_same_thread=False) @@ -88,7 +89,7 @@ else: # end_date = datetime(2022 ,5 ,17).date() -@st.cache_data() +@st.cache() def date_filter(df, start_date, end_date): filt = (df2.index >= pd.Timestamp(start_date)) & (df2.index <= pd.Timestamp(end_date + timedelta(days=1))) df = df[filt] @@ -131,7 +132,7 @@ else: resample_time = resample_times[resample_sel] -@st.cache_data() +@st.cache() def time_resample(df, resample_time): if resample_time == 'Raw': df_resample = df['Com_Name'] From 6a16764897ac08ba7a2f7daf8de43b7b94e24ead Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:00:01 -0500 Subject: [PATCH 05/12] Revert "Revert "Merge pull request #764 from lamkin/drl/st_cache_deprecated"" This reverts commit 515201b7bdd0d9ee81b05a9bdc1e2ae9293112a6. --- scripts/plotly_streamlit.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.py index fe8fa08..29392a8 100755 --- a/scripts/plotly_streamlit.py +++ b/scripts/plotly_streamlit.py @@ -38,8 +38,7 @@ st.markdown(""" """, unsafe_allow_html=True) -@st.cache(hash_funcs={Connection: id}) -# @st.cache(allow_output_mutation=True) +@st.cache_resource() def get_connection(path: str): return sqlite3.connect(path, check_same_thread=False) @@ -89,7 +88,7 @@ else: # end_date = datetime(2022 ,5 ,17).date() -@st.cache() +@st.cache_data() def date_filter(df, start_date, end_date): filt = (df2.index >= pd.Timestamp(start_date)) & (df2.index <= pd.Timestamp(end_date + timedelta(days=1))) df = df[filt] @@ -132,7 +131,7 @@ else: resample_time = resample_times[resample_sel] -@st.cache() +@st.cache_data() def time_resample(df, resample_time): if resample_time == 'Raw': df_resample = df['Com_Name'] From 650b064e442f5a320d7abdb6cbb25baf66642bca Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:00:04 -0500 Subject: [PATCH 06/12] Revert "Revert "streamlit==1.19.0"" This reverts commit 5d9d5a52f09dab736539a8e053d95c8b01a811be. --- requirements.txt | 2 +- scripts/update_birdnet_snippets.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0096dc5..da95e33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ pytz tzlocal pandas seaborn -streamlit==1.11.1 +streamlit==1.19.0 plotly apprise==1.2.1 paho-mqtt diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index e9c85dd..c2853f6 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -158,7 +158,7 @@ CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, EOF $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 >/dev/null -$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.11.1 >/dev/null +$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 >/dev/null if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service" From c65f71b6a1e7e99e401d158cd6b00d8174b73bec Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:00:40 -0500 Subject: [PATCH 07/12] Update restart_services.sh --- scripts/restart_services.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/restart_services.sh b/scripts/restart_services.sh index 4996da2..aba21d8 100755 --- a/scripts/restart_services.sh +++ b/scripts/restart_services.sh @@ -13,7 +13,8 @@ services=(chart_viewer.service icecast2.service extraction.service birdnet_recording.service - birdnet_log.service) + birdnet_log.service + birdnet_stats.service) for i in "${services[@]}";do sudo systemctl restart "${i}" From a9c7ed9fe6dd9ef3d0afa38d3153d18a50baead0 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 4 Mar 2023 16:37:58 -0500 Subject: [PATCH 08/12] Update write_config.sh --- scripts/write_config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/write_config.sh b/scripts/write_config.sh index 6d66b2a..05d4267 100755 --- a/scripts/write_config.sh +++ b/scripts/write_config.sh @@ -11,3 +11,4 @@ sed -i s/'^BIRDWEATHER_ID=$'/"BIRDWEATHER_ID=${birdweather_id}"/g ${birders_conf sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf} sed -i s/'^WEBTERMINAL_URL=$'/"WEBTERMINAL_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf} sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf} + From 9beafa8ecf043dd10a5c63e8fd736e6b5408f308 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 4 Mar 2023 16:43:40 -0500 Subject: [PATCH 09/12] Update update_birdnet.sh --- scripts/update_birdnet.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh index 0b82e31..1410f5a 100755 --- a/scripts/update_birdnet.sh +++ b/scripts/update_birdnet.sh @@ -50,6 +50,9 @@ sudo_with_user git -C $HOME/BirdNET-Pi fetch $remote $branch # Switches git to specified branch sudo_with_user git -C $HOME/BirdNET-Pi switch -C $branch --track $remote/$branch +# Prints out changes +sudo_with_user git -C $HOME/BirdNET-Pi diff --stat HEAD^ HEAD + sudo systemctl daemon-reload sudo ln -sf $my_dir/* /usr/local/bin/ From 8fa2ec9ef962941dcf9511870fd244dc7f411b19 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 4 Mar 2023 17:01:32 -0500 Subject: [PATCH 10/12] make updates faster by only updating pip packages if needed --- scripts/update_birdnet_snippets.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index c2853f6..7f8cd3d 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -157,8 +157,11 @@ CREATE INDEX IF NOT EXISTS "detections_Com_Name" ON "detections" ("Com_Name"); CREATE INDEX IF NOT EXISTS "detections_Date_Time" ON "detections" ("Date" DESC, "Time" DESC); EOF -$HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 >/dev/null -$HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 >/dev/null +apprise_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show apprise 2>/dev/null | grep Version | awk '{print $2}') +streamlit_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show streamlit 2>/dev/null | grep Version | awk '{print $2}') + +[[ $apprise_version == "1.2.1" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 +[[ $streamlit_version == "1.19.0" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service" From bbaca21d772a3214a83679f97bbfa365e48469c3 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 4 Mar 2023 17:03:58 -0500 Subject: [PATCH 11/12] make apprise versioning consistent across all pip commands --- scripts/update_birdnet_snippets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 7f8cd3d..cd778d1 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -66,7 +66,7 @@ fi apprise_installation_status=$(~/BirdNET-Pi/birdnet/bin/python3 -c 'import pkgutil; print("installed" if pkgutil.find_loader("apprise") else "not installed")') if [[ "$apprise_installation_status" = "not installed" ]];then $HOME/BirdNET-Pi/birdnet/bin/pip3 install -U pip - $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise + $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 fi [ -f $HOME/BirdNET-Pi/apprise.txt ] || sudo -E -ucaddy touch $HOME/BirdNET-Pi/apprise.txt if ! which lsof &>/dev/null;then From eb9a6ea61dec213ac91d5dc52e1d402b387d8097 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 4 Mar 2023 17:05:22 -0500 Subject: [PATCH 12/12] wrong comparator --- scripts/update_birdnet_snippets.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index cd778d1..281e889 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -160,8 +160,8 @@ EOF apprise_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show apprise 2>/dev/null | grep Version | awk '{print $2}') streamlit_version=$($HOME/BirdNET-Pi/birdnet/bin/pip3 show streamlit 2>/dev/null | grep Version | awk '{print $2}') -[[ $apprise_version == "1.2.1" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 -[[ $streamlit_version == "1.19.0" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 +[[ $apprise_version != "1.2.1" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install apprise==1.2.1 +[[ $streamlit_version != "1.19.0" ]] && $HOME/BirdNET-Pi/birdnet/bin/pip3 install streamlit==1.19.0 if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then sudo -E sed -i '/\[Service\]/a RuntimeMaxSec=3600' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"