Skip to content

Commit

Permalink
#168 if a DOTe json is assigned to a podlove json file attribute -> r…
Browse files Browse the repository at this point in the history
…eturn an empty list of transcriptions
  • Loading branch information
ephes committed Nov 17, 2024
1 parent f284586 commit 4847c19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cast/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ def get_transcripts(instance: Audio) -> list[dict]:
with transcript.podlove.open("r") as file:
try:
data = json.load(file) # assumes the file content is JSON
return data["transcripts"]
try:
transcripts = data["transcripts"]
except KeyError:
# maybe DOTe instead of Podlove -> empty list
transcripts = []
return transcripts
except json.JSONDecodeError:
return []

Expand Down

0 comments on commit 4847c19

Please sign in to comment.