Use detection time instead of origin audio file time in DB
This commit is contained in:
committed by
Nachtzuster
parent
7bac0d7ebe
commit
3bc2c63a1f
@@ -42,9 +42,14 @@ def get_settings(settings_path='/etc/birdnet/birdnet.conf', force_reload=False):
|
||||
|
||||
|
||||
class Detection:
|
||||
def __init__(self, start_time, stop_time, species, confidence):
|
||||
def __init__(self, file_date, start_time, stop_time, species, confidence):
|
||||
self.start = float(start_time)
|
||||
self.stop = float(stop_time)
|
||||
self.datetime = file_date + datetime.timedelta(seconds=self.start)
|
||||
self.date = self.datetime.strftime("%Y-%m-%d")
|
||||
self.time = self.datetime.strftime("%H:%M:%S")
|
||||
self.iso8601 = self.datetime.astimezone(get_localzone()).isoformat()
|
||||
self.week = self.datetime.isocalendar()[1]
|
||||
self.confidence = round(float(confidence), 4)
|
||||
self.confidence_pct = round(self.confidence * 100)
|
||||
self.species = species
|
||||
@@ -66,16 +71,6 @@ class ParseFileName:
|
||||
ident_match = re.search("RTSP_[0-9]+-", file_name)
|
||||
self.RTSP_id = ident_match.group() if ident_match is not None else ""
|
||||
|
||||
@property
|
||||
def date(self):
|
||||
current_date = self.file_date.strftime("%Y-%m-%d")
|
||||
return current_date
|
||||
|
||||
@property
|
||||
def time(self):
|
||||
current_time = self.file_date.strftime("%H:%M:%S")
|
||||
return current_time
|
||||
|
||||
@property
|
||||
def iso8601(self):
|
||||
current_iso8601 = self.file_date.astimezone(get_localzone()).isoformat()
|
||||
|
||||
Reference in New Issue
Block a user