Skip to content

Commit

Permalink
add arhicve track support
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed Aug 29, 2023
1 parent 18b4807 commit 38a2c6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions processing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ def get_algorithm_id(self, algorithm):
return r.json()["algorithmId"]
raise IOError(r.text)

def archive_track(self, recording, track):
url = self.file_url + "/{}/tracks/{}/archive".format(
recording["id"], track["id"]
)
r = self.post(url)
if r.status_code == 200:
return
raise IOError(r.text)

def update_track(self, recording, track):
url = self.file_url + "/{}/tracks/{}".format(recording["id"], track["id"])
post_data = {"data": json.dumps(track)}
Expand Down
2 changes: 1 addition & 1 deletion processing/tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_significant_tracks(tracks, conf):
for track in tracks:
track[CONFIDENCE] = 0
has_clear_prediction = False
for prediction in track[PREDICTIONS]:
for prediction in track.get(PREDICTIONS, []):
if conf.ignore_tags is not None and prediction[LABEL] in conf.ignore_tags:
continue

Expand Down
5 changes: 4 additions & 1 deletion processing/thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def track(conf, recording, api, duration, retrack, logger):
if retrack:
if "thumbnail" in track:
del track["thumbnail"]
api.update_track(recording, track)
if len(track["positions"]) == 0:
api.archive_track(recording, track)
else:
api.update_track(recording, track)
else:
track["id"] = api.add_track(
recording, track, tracking_result.tracking_algorithm
Expand Down

0 comments on commit 38a2c6a

Please sign in to comment.