mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
EPG auto import
Set EPG to import channels and channel id's automatically once the EPG is added.
This commit is contained in:
parent
a6f2ae5d9f
commit
8669be5c0a
2 changed files with 14 additions and 0 deletions
|
|
@ -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
10
apps/epg/signals.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue