mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 13:49:26 +02:00
Fixed #44: now bind track file to import job
This commit is contained in:
parent
a08bf51216
commit
e90e9dc7aa
14 changed files with 181 additions and 16 deletions
|
@ -393,6 +393,8 @@ class ImportBatch(models.Model):
|
|||
|
||||
class ImportJob(models.Model):
|
||||
batch = models.ForeignKey(ImportBatch, related_name='jobs')
|
||||
track_file = models.ForeignKey(
|
||||
TrackFile, related_name='jobs', null=True, blank=True)
|
||||
source = models.URLField()
|
||||
mbid = models.UUIDField(editable=False)
|
||||
STATUS_CHOICES = (
|
||||
|
@ -413,10 +415,12 @@ class ImportJob(models.Model):
|
|||
elif track.files.count() > 0:
|
||||
return
|
||||
|
||||
track_file = track_file or TrackFile(track=track, source=self.source)
|
||||
track_file = track_file or TrackFile(
|
||||
track=track, source=self.source)
|
||||
track_file.download_file()
|
||||
track_file.save()
|
||||
self.status = 'finished'
|
||||
self.track_file = track_file
|
||||
self.save()
|
||||
return track.pk
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue