mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-27 01:16:36 +00:00
26 lines
673 B
Python
26 lines
673 B
Python
# Generated by Django 3.2.12 on 2022-04-06 06:19
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations
|
|
|
|
|
|
def fix_media_file(apps, schema_editor):
|
|
Media = apps.get_model('sync', 'Media')
|
|
for media in Media.objects.filter(downloaded=True):
|
|
download_dir = str(settings.DOWNLOAD_ROOT)
|
|
|
|
if media.media_file.name.startswith(download_dir):
|
|
media.media_file.name = media.media_file.name[len(download_dir) + 1:]
|
|
media.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('sync', '0012_alter_media_downloaded_format'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(fix_media_file)
|
|
]
|