Add priority for providers so VOD's can be auto selected based on the priority.

This commit is contained in:
SergeantPanda 2025-08-20 17:38:21 -05:00
parent fa2b3fbe3e
commit 24f876d09f
8 changed files with 72 additions and 14 deletions

View file

@ -18,6 +18,7 @@ class M3UAccountAdmin(admin.ModelAdmin):
"server_url",
"server_group",
"max_streams",
"priority",
"is_active",
"user_agent_display",
"uploaded_file_link",

View file

@ -0,0 +1,18 @@
# Generated by Django 5.2.4 on 2025-08-20 22:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('m3u', '0015_alter_m3ufilter_options_m3ufilter_custom_properties'),
]
operations = [
migrations.AddField(
model_name='m3uaccount',
name='priority',
field=models.PositiveIntegerField(default=0, help_text='Priority for VOD provider selection (higher numbers = higher priority). Used when multiple providers offer the same content.'),
),
]

View file

@ -94,6 +94,10 @@ class M3UAccount(models.Model):
default=7,
help_text="Number of days after which a stream will be removed if not seen in the M3U source.",
)
priority = models.PositiveIntegerField(
default=0,
help_text="Priority for VOD provider selection (higher numbers = higher priority). Used when multiple providers offer the same content.",
)
def __str__(self):
return self.name

View file

@ -1,5 +1,5 @@
from core.utils import validate_flexible_url
from rest_framework import serializers
from rest_framework import serializers, status
from rest_framework.response import Response
from .models import M3UAccount, M3UFilter, ServerGroup, M3UAccountProfile
from core.models import UserAgent
@ -113,6 +113,7 @@ class M3UAccountSerializer(serializers.ModelSerializer):
"username",
"password",
"stale_stream_days",
"priority",
"status",
"last_message",
"enable_vod",