making changes to accomodate removing the pi user

This commit is contained in:
mcguirepr89
2022-04-11 10:16:54 -04:00
parent 341cc17264
commit 023b68f386
39 changed files with 167 additions and 191 deletions
+7 -8
View File
@@ -1,4 +1,3 @@
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
import socket
import threading
import os
@@ -44,7 +43,7 @@ except:
# Open most recent Configuration and grab DB_PWD as a python variable
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
with open('/home/*/BirdNET-Pi/thisrun.txt', 'r') as f:
this_run = f.readlines()
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
@@ -59,7 +58,7 @@ def loadModel():
print('LOADING TF LITE MODEL...', end=' ')
# Load TFLite model and allocate tensors.
myinterpreter = tflite.Interpreter(model_path='/home/pi/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
myinterpreter = tflite.Interpreter(model_path='/home/*/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
myinterpreter.allocate_tensors()
# Get input and output tensors.
@@ -73,7 +72,7 @@ def loadModel():
# Load labels
CLASSES = []
with open('/home/pi/BirdNET-Pi/model/labels.txt', 'r') as lfile:
with open('/home/*/BirdNET-Pi/model/labels.txt', 'r') as lfile:
for line in lfile.readlines():
CLASSES.append(line.replace('\n', ''))
@@ -233,8 +232,8 @@ def handle_client(conn, addr):
args = type('', (), {})()
args.i = '/home/pi/test.wav'
args.o = '/home/pi/test.wav.csv'
args.i = '/home/*/test.wav'
args.o = '/home/*/test.wav.csv'
args.birdweather_id = '99999'
args.include_list = 'null'
args.exclude_list = 'null'
@@ -329,7 +328,7 @@ def handle_client(conn, addr):
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
with open('/home/pi/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
with open('/home/*/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
for d in detections:
for entry in detections[d]:
if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) ):
@@ -355,7 +354,7 @@ def handle_client(conn, addr):
#Connect to SQLite Database
try:
con = sqlite3.connect('/home/pi/BirdNET-Pi/scripts/birds.db')
con = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
cur = con.cursor()
cur.execute("INSERT INTO detections VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (Date, Time, Sci_Name, Com_Name, str(score), Lat, Lon, Cutoff, Week, Sens, Overlap, File_Name))