Skip to content

Commit

Permalink
Catch some errors without exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
wsanchez committed Nov 6, 2023
1 parent 87aa544 commit 831ea12
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions src/transmissions/indexer/_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,15 @@ async def _addDuration(
self.log.info(
"Computing duration for {transmission}", transmission=transmission
)
duration = await deferToThread(self._duration, transmission.path)
try:
duration = await deferToThread(self._duration, transmission.path)
except Exception as e:
self.log.error(
"Unable to compute duration for "
"transmission {transmission}: {error}",
transmission=transmission,
error=e,
)
await store.setTransmissionDuration(
eventID=transmission.eventID,
system=transmission.system,
Expand Down Expand Up @@ -328,9 +336,16 @@ async def _addTranscription(
"Computing transcription for {transmission}",
transmission=transmission,
)
transcription = await deferToThread(
self._transcription, transmission.path
)
try:
transcription = await deferToThread(
self._transcription, transmission.path
)
except Exception as e:
self.log.error(
"Unable to transcribe transmission {transmission}: {error}",
transmission=transmission,
error=e,
)
await store.setTransmissionTranscription(
eventID=transmission.eventID,
system=transmission.system,
Expand Down
2 changes: 1 addition & 1 deletion src/transmissions/run/_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def filterTable(self, row: TransmissionTableRowItems, key: str) -> bool:
if not transcription:
return False

for term in query.split(" "):
for term in query.split():
if term:
term = term.lower()
if transcription.lower().find(term) != -1:
Expand Down

0 comments on commit 831ea12

Please sign in to comment.