# Generated by Django 5.1.6 on 2025-03-01 14:10

from django.db import migrations
from django.utils.text import slugify


def add_dvr_defaults(apps, schema_editor):
    CoreSettings = apps.get_model("core", "CoreSettings")

    defaults = [
        (slugify("DVR TV Template"), "DVR TV Template", "Recordings/TV_Shows/{show}/S{season:02d}E{episode:02d}.mkv"),
        (slugify("DVR Movie Template"), "DVR Movie Template", "Recordings/Movies/{title} ({year}).mkv"),
        (slugify("DVR TV Fallback Template"), "DVR TV Fallback Template", "Recordings/TV_Shows/{show}/{start}.mkv"),
        (slugify("DVR Movie Fallback Template"), "DVR Movie Fallback Template", "Recordings/Movies/{start}.mkv"),
        (slugify("DVR Comskip Enabled"), "DVR Comskip Enabled", "false"),
    ]

    for key, name, value in defaults:
        CoreSettings.objects.get_or_create(key=key, defaults={"name": name, "value": value})


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0014_default_proxy_settings"),
    ]

    operations = [
        migrations.RunPython(add_dvr_defaults),
    ]
