From c0c7f2bc41e6772ef8a5e823cedbf475997693c9 Mon Sep 17 00:00:00 2001 From: dekzter Date: Fri, 4 Apr 2025 10:57:33 -0400 Subject: [PATCH] migration to fix incorrect user-agent for tivimate and update streamlink default profile --- ...011_fix_stream_profiles_and_user_agents.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 core/migrations/0011_fix_stream_profiles_and_user_agents.py diff --git a/core/migrations/0011_fix_stream_profiles_and_user_agents.py b/core/migrations/0011_fix_stream_profiles_and_user_agents.py new file mode 100644 index 00000000..c582f965 --- /dev/null +++ b/core/migrations/0011_fix_stream_profiles_and_user_agents.py @@ -0,0 +1,27 @@ +# Generated by Django 5.1.6 on 2025-04-04 + +from django.db import migrations + +def fix_stream_profiles_and_user_agents(apps, schema_editor): + # Get the model + StreamProfile = apps.get_model("core", "StreamProfile") + + streamlink_profile = StreamProfile.objects.get(name="streamlink", locked=True) + streamlink_profile.parameters = "{streamUrl} --http-header User-Agent={userAgent} best --stdout" + streamlink_profile.save() + + UserAgent = apps.get_model("core", "UserAgent") + tivimate = UserAgent.objects.get(name="TiviMate", user_agent="TiviMate/5.16 (Android 12)") + if tivimate: + tivimate.user_agent = "TiviMate/5.1.6 (Android 12)" + tivimate.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0010_reload_additional_settings'), + ] + + operations = [ + migrations.RunPython(fix_stream_profiles_and_user_agents), + ]