select between flv/mpegts format in restream

This commit is contained in:
Jan Koppe 2021-12-14 18:35:58 +01:00
parent 0d9a60c6ff
commit ab729dcb7c
Signed by: thunfisch
GPG Key ID: BE935B0735A2129B
7 changed files with 30 additions and 6 deletions

View File

@ -31,7 +31,7 @@ msgstr "Stream der als Quelle für die Weiterleitung verwendet wird"
#: restream/models.py:12
msgid "restreamconfig_target_help"
msgstr "RTMP Ziel URL an die der Stream weitergeleitet wird"
msgstr "Ziel URL an die der Stream weitergeleitet wird, inklusive Schema (z.B. rtmp://)"
#: restream/models.py:13
msgid "restreamconfig_name_help"

View File

@ -31,7 +31,7 @@ msgstr "Stream that's being used as source for the restreaming"
#: restream/models.py:12
msgid "restreamconfig_target_help"
msgstr "RTMP target url that the stream is being restreamed to"
msgstr "Target url that the stream is being restreamed to, including schema (e.g. rtmp://)"
#: restream/models.py:13
msgid "restreamconfig_name_help"

View File

@ -4,7 +4,7 @@ from .models import RestreamConfig
class RestreamConfigAdmin(GuardedModelAdmin):
fields = ['name', 'active', 'stream', 'target']
fields = ['name', 'active', 'stream', 'format', 'target']
admin.site.register(RestreamConfig, RestreamConfigAdmin)

View File

@ -6,7 +6,7 @@ from . import models
class RestreamConfigFilteredStreamForm(ModelForm):
class Meta:
model = models.RestreamConfig
fields = ['name', 'stream', 'target', 'active']
fields = ['name', 'stream', 'target', 'format', 'active']
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.13 on 2021-12-14 17:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restream', '0002_auto_20200501_1302'),
]
operations = [
migrations.AddField(
model_name='restreamconfig',
name='format',
field=models.CharField(choices=[('flv', 'flv (RTMP)'), ('mpegts', 'mpegts (SRT)')], default='flv', help_text='restreamconfig_format_help', max_length=6),
),
]

View File

@ -9,10 +9,15 @@ from rtmp.models import Stream
class RestreamConfig(models.Model):
FORMATS = (
('flv', 'flv (RTMP)'),
('mpegts', 'mpegts (SRT)'),
)
stream = models.ForeignKey(Stream, on_delete=models.CASCADE, help_text=_('restreamconfig_stream_help'))
target = models.CharField(max_length=500, help_text=_('restreamconfig_target_help'))
name = models.CharField(max_length=100, help_text=_('restreamconfig_name_help'))
active = models.BooleanField(help_text=_('restreamconfig_activate_help'))
format = models.CharField(max_length=6, choices=FORMATS, default='flv', help_text=_('restreamconfig_format_help'))
class Meta:
verbose_name = _('restreamconfig_verbose_name')
@ -32,7 +37,8 @@ class RestreamConfig(models.Model):
'name': self.name,
'app': self.stream.application.name,
'stream': str(self.stream.stream),
'target': self.target
'target': self.target,
'format': self.format
}
return json.dumps(config)

View File

@ -33,7 +33,7 @@
<h6>{% trans "how_to_configure_your_encoder_header" %}</h6>
<hr class="my-4">
<p>{% trans "set_this_stream_server_in_encoder" %}</p>
<p class="mb-4"><code>rtmp://TODO TODO SERVER BASE URL/{{ object.application }}/</code></p>
<p class="mb-4"><code>rtmp://ingest.chaoswest.tv:1935/{{ object.application }}/</code></p>
<p>{% trans "set_this_stream_id_in_encoder" %}</p>
<div class="input-group mb-4" id="show_hide_stream_key">
<input readonly class="form-control" type="password" value="{{ object.stream }}">