diff --git a/api/funkwhale_api/music/management/__init__.py b/api/funkwhale_api/music/management/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/api/funkwhale_api/music/management/commands/__init__.py b/api/funkwhale_api/music/management/commands/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/api/funkwhale_api/music/management/commands/fix_track_files.py b/api/funkwhale_api/music/management/commands/fix_track_files.py
new file mode 100644
index 0000000000000000000000000000000000000000..f68bcf1359d4661710a98ee443ff1578824f46f2
--- /dev/null
+++ b/api/funkwhale_api/music/management/commands/fix_track_files.py
@@ -0,0 +1,45 @@
+import cacheops
+import os
+
+from django.db import transaction
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+
+from funkwhale_api.music import models, utils
+
+
+class Command(BaseCommand):
+    help = 'Run common checks and fix against imported tracks'
+
+    def add_arguments(self, parser):
+        parser.add_argument(
+            '--dry-run',
+            action='store_true',
+            dest='dry_run',
+            default=False,
+            help='Do not execute anything'
+        )
+
+    def handle(self, *args, **options):
+        if options['dry_run']:
+            self.stdout.write('Dry-run on, will not commit anything')
+        self.fix_mimetypes(**options)
+        cacheops.invalidate_model(models.TrackFile)
+
+    @transaction.atomic
+    def fix_mimetypes(self, dry_run, **kwargs):
+        self.stdout.write('Fixing missing mimetypes...')
+        matching = models.TrackFile.objects.filter(
+            source__startswith='file://', mimetype=None)
+        self.stdout.write(
+            '[mimetypes] {} entries found with no mimetype'.format(
+                matching.count()))
+        for extension, mimetype in utils.EXTENSION_TO_MIMETYPE.items():
+            qs = matching.filter(source__endswith='.{}'.format(extension))
+            self.stdout.write(
+                '[mimetypes] setting {} {} files to {}'.format(
+                    qs.count(), extension, mimetype
+                ))
+            if not dry_run:
+                self.stdout.write('[mimetypes] commiting...')
+                qs.update(mimetype=mimetype)
diff --git a/changes/changelog.d/183.enhancement b/changes/changelog.d/183.enhancement
new file mode 100644
index 0000000000000000000000000000000000000000..2549db810c97283c1ea7ef246ea79dc5a4ced674
--- /dev/null
+++ b/changes/changelog.d/183.enhancement
@@ -0,0 +1 @@
+Added a fix_track_files command to run checks and fixes against library (#183)