From bb79d454af800f0cfa6f978cdb48001d078ecfe4 Mon Sep 17 00:00:00 2001
From: RenonDis <renon@disroot.org>
Date: Tue, 19 Jun 2018 17:57:33 +0200
Subject: [PATCH] Bypassing cli skip for update flag

---
 api/funkwhale_api/music/models.py                      |  1 +
 .../audiofile/management/commands/import_files.py      | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/api/funkwhale_api/music/models.py b/api/funkwhale_api/music/models.py
index 8b638ce7da..16ac58dc9f 100644
--- a/api/funkwhale_api/music/models.py
+++ b/api/funkwhale_api/music/models.py
@@ -567,6 +567,7 @@ class ImportBatch(models.Model):
 
 class ImportJob(models.Model):
     uuid = models.UUIDField(unique=True, db_index=True, default=uuid.uuid4)
+    update_if_duplicate = models.BooleanField(default=False)
     batch = models.ForeignKey(
         ImportBatch, related_name="jobs", on_delete=models.CASCADE
     )
diff --git a/api/funkwhale_api/providers/audiofile/management/commands/import_files.py b/api/funkwhale_api/providers/audiofile/management/commands/import_files.py
index 8de7792308..2d1ddba1fe 100644
--- a/api/funkwhale_api/providers/audiofile/management/commands/import_files.py
+++ b/api/funkwhale_api/providers/audiofile/management/commands/import_files.py
@@ -55,6 +55,16 @@ class Command(BaseCommand):
                 "import and not much disk space available."
             ),
         )
+        parser.add_argument(
+            "--update",
+            action="store_true",
+            dest="update",
+            default=False,
+            help=(
+                "Use this flag to replace duplicates (tracks with same "
+                "musicbrainz mbid) on import with their newest version."
+            ),
+        )
         parser.add_argument(
             "--noinput",
             "--no-input",
-- 
GitLab