From 2354721cd91f7ea8a6f7dd4fd335444c631e0ece Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Sun, 4 Mar 2018 18:14:37 +0100 Subject: [PATCH] Fixed import crashing when no acoustid found --- api/funkwhale_api/music/tasks.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/funkwhale_api/music/tasks.py b/api/funkwhale_api/music/tasks.py index cb4a737c9..9aac55515 100644 --- a/api/funkwhale_api/music/tasks.py +++ b/api/funkwhale_api/music/tasks.py @@ -33,11 +33,10 @@ def _do_import(import_job, replace): # we try to deduce mbid from acoustid client = get_acoustid_client() match = client.get_best_match(import_job.audio_file.path) - if not match: - raise ValueError('Cannot get match') - duration = match['recordings'][0]['duration'] - mbid = match['recordings'][0]['id'] - acoustid_track_id = match['id'] + if match: + duration = match['recordings'][0]['duration'] + mbid = match['recordings'][0]['id'] + acoustid_track_id = match['id'] if mbid: track, _ = models.Track.get_or_create_from_api(mbid=mbid) else: