On branch new_daily_plot

Changes to be committed:
	modified:   scripts/daily_plot.py
This commit is contained in:
CaiusX
2022-02-06 15:48:22 +02:00
parent 1d67cfcbc5
commit 513339b773
+8 -5
View File
@@ -2,6 +2,7 @@
import mysql.connector as sql import mysql.connector as sql
import os import os
import configparser
import pandas as pd import pandas as pd
import seaborn as sns import seaborn as sns
@@ -11,15 +12,17 @@ from matplotlib.colors import LogNorm
from datetime import datetime from datetime import datetime
import textwrap import textwrap
BIRD_DB_PWD=os.getenv('DB_PWD') #Extract DB_PWD from thisrun.txt
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
this_run = f.readlines()
db_pwd = str(str(str([i for i in this_run if i.startswith('DB_PWD')]).split('=')[1]).split('\\')[0])
print(BIRD_DB_PWD)
db_connection = sql.connect(host='localhost', db_connection = sql.connect(host='localhost',
database='birds', database='birds',
user='birder', user='birder',
password='forms') password=db_pwd)
#password = BIRD_DB_PASSWORD)
db_cursor=db_connection.cursor(dictionary=True) db_cursor=db_connection.cursor(dictionary=True)
@@ -102,7 +105,7 @@ plt.suptitle("Last Updated: "+ str(now.strftime("%d %m %Y %H:%M")))
#Save combined plot #Save combined plot
savename='/home/pi/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%d-%m-%Y"))+'.png' savename='/home/pi/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%d-%m-%Y"))+'.png'
plt.savefig(savename) plt.savefig(savename)
#plt.show() # plt.show()
plt.close() plt.close()
#Get bottom 10 today #Get bottom 10 today