EPG auto import

Set EPG to import channels and channel id's automatically once the EPG is added.
This commit is contained in:
Dispatcharr 2025-03-19 13:12:48 -05:00
parent a6f2ae5d9f
commit 8669be5c0a
2 changed files with 14 additions and 0 deletions

View file

@ -4,3 +4,7 @@ class EpgConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.epg'
verbose_name = "EPG Management"
def ready(self):
# Import signals to ensure they get registered
import apps.epg.signals

10
apps/epg/signals.py Normal file
View file

@ -0,0 +1,10 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import EPGSource
from .tasks import refresh_epg_data
@receiver(post_save, sender=EPGSource)
def trigger_refresh_on_new_epg_source(sender, instance, created, **kwargs):
# Trigger refresh only if the source is newly created and active
if created and instance.is_active:
refresh_epg_data.delay()