Skip to content

Commit

Permalink
Fix for whole music import failing due to one JSON parse error in list (
Browse files Browse the repository at this point in the history
  • Loading branch information
SolveSoul authored Dec 11, 2024
1 parent c989a50 commit efc7547
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions ultrasonics/official_plugins/up_local music database.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,23 @@ def get_song(self, field, value):

for song in rows:
# Convert to songs_dict format
item = {
"title": song[1],
"artists": json.loads(song[2]),
"album": song[3],
"date": song[4],
"isrc": song[5],
"location": song[0]
}

# Remove any empty fields
item = {k: v for k, v in item.items() if v}

found_songs.append(item)
try:
item = {
"title": song[1],
"artists": json.loads(song[2]),
"album": song[3],
"date": song[4],
"isrc": song[5],
"location": song[0]
}

# Remove any empty fields
item = {k: v for k, v in item.items() if v}

found_songs.append(item)
except TypeError:
log.error("Error parsing JSON, skipping song:")
log.error(song)

return found_songs

Expand Down

0 comments on commit efc7547

Please sign in to comment.