Now use import job everywhere, even for direct file imports

This commit is contained in:
Eliot Berriot 2017-12-27 20:29:26 +01:00
parent 5d2dbbc828
commit 2e616282fd
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
9 changed files with 318 additions and 66 deletions

View file

@ -8,7 +8,7 @@ from funkwhale_api.providers.acoustid import get_acoustid_client
from funkwhale_api.music import models, metadata
def import_metadata_without_musicbrainz(path):
def import_track_data_from_path(path):
data = metadata.Metadata(path)
artist = models.Artist.objects.get_or_create(
name__iexact=data.get('artist'),
@ -53,7 +53,7 @@ def from_path(path):
result = client.get_best_match(path)
acoustid_track_id = result['id']
except acoustid.WebServiceError:
track = import_metadata_without_musicbrainz(path)
track = import_track_data_from_path(path)
except (TypeError, KeyError):
track = import_metadata_without_musicbrainz(path)
else: