2020-04-15 20:29:59 +02:00
|
|
|
from django.dispatch import receiver
|
2020-04-26 19:46:58 +02:00
|
|
|
from rtmp.signals import stream_active
|
2020-04-15 20:29:59 +02:00
|
|
|
from .models import RestreamConfig
|
2020-04-23 21:08:39 +02:00
|
|
|
from rtmp.models import Stream
|
2020-04-26 19:46:58 +02:00
|
|
|
from concierge.models import Task
|
2020-04-20 14:51:44 +02:00
|
|
|
|
2020-04-15 20:29:59 +02:00
|
|
|
|
2020-04-26 19:46:58 +02:00
|
|
|
@receiver(stream_active)
|
|
|
|
def create_tasks(sender, **kwargs):
|
|
|
|
stream = Stream.objects.get(stream=kwargs['stream'])
|
2020-04-23 21:08:39 +02:00
|
|
|
configs = RestreamConfig.objects.filter(stream=stream)
|
2020-04-15 20:29:59 +02:00
|
|
|
for config in configs:
|
2020-04-26 19:46:58 +02:00
|
|
|
task = Task(stream=stream, type='restream', configuration='{}')
|
|
|
|
task.save()
|