Dispatcharr/core/migrations/0024_outputprofile.py
SergeantPanda 8ac0aa4f5f
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
fix: update default output profiles to include additional ffmpeg parameters for improved processing speed.
2026-05-17 12:33:37 -05:00

85 lines
3 KiB
Python

# Generated by Django 6.0.4 on 2026-05-08 13:51
from django.db import migrations, models
def create_default_output_profiles(apps, schema_editor):
OutputProfile = apps.get_model('core', 'OutputProfile')
OutputProfile.objects.get_or_create(
name='Media Server (AC3 Audio)',
defaults={
'command': 'ffmpeg',
'parameters': (
'-fflags +discardcorrupt+genpts+nobuffer '
'-probesize 512K '
'-analyzeduration 0 '
'-i pipe:0 '
'-map 0 '
'-c:v copy '
'-c:a ac3 '
'-b:a 384k '
'-max_muxing_queue_size 4096 '
'-flush_packets 1 '
'-mpegts_flags +pat_pmt_at_frames+resend_headers+initial_discontinuity '
'-f mpegts pipe:1'
),
'locked': True,
'is_active': True,
},
)
OutputProfile.objects.get_or_create(
name='Web Player (AAC Audio)',
defaults={
'command': 'ffmpeg',
'parameters': (
'-fflags +discardcorrupt+genpts+nobuffer '
'-probesize 512K '
'-analyzeduration 0 '
'-i pipe:0 '
'-map 0 '
'-c:v copy '
'-c:a aac '
'-b:a 192k '
'-ac 2 '
'-max_muxing_queue_size 4096 '
'-flush_packets 1 '
'-mpegts_flags +pat_pmt_at_frames+resend_headers+initial_discontinuity '
'-f mpegts pipe:1'
),
'locked': True,
'is_active': True,
},
)
def remove_default_output_profiles(apps, schema_editor):
OutputProfile = apps.get_model('core', 'OutputProfile')
OutputProfile.objects.filter(
name__in=['Media Server (AC3 Audio)', 'Web Player (AAC Audio)'],
locked=True,
).delete()
class Migration(migrations.Migration):
dependencies = [
('core', '0023_alter_systemevent_event_type'),
]
operations = [
migrations.CreateModel(
name='OutputProfile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Display name for this output profile', max_length=255, unique=True)),
('command', models.CharField(help_text="Executable to run (e.g. 'ffmpeg')", max_length=255)),
('parameters', models.TextField(help_text='Command-line parameters. Must read from pipe:0 (stdin) and write to pipe:1 (stdout).')),
('locked', models.BooleanField(default=False, help_text="Protected - can't be deleted or modified")),
('is_active', models.BooleanField(default=True, help_text='Whether this profile is available for use')),
],
),
migrations.RunPython(
create_default_output_profiles,
remove_default_output_profiles,
),
]