From 3f8c7d427cceb6ffcb94492c31a595ab8b7647c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Tue, 31 Aug 2021 22:48:21 +0200
Subject: [PATCH] Automaticky nahravat vsechno

---
 .gitlab-ci.yml         |  2 +-
 nginx.conf             |  6 ++++++
 templates/live.html.ep | 40 +---------------------------------------
 3 files changed, 8 insertions(+), 40 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 30c510f..3dfe9d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:19.03.12
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  IMAGE_VER: 1.10.0
+  IMAGE_VER: 2.0.0
 
 services:
   - docker:19.03.12-dind
diff --git a/nginx.conf b/nginx.conf
index 0460dd1..fa8f8b6 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -24,6 +24,12 @@ rtmp {
             hls_path /tmp/hls;
             hls_fragment 15s;
 
+            record all;
+            record_suffix -%Y%m%d-%H%M%S.flv;
+            record_path /records;
+            record_unique on;
+            record_max_size 8000m;
+
             recorder all {
                 record all manual;
                 record_suffix -%Y%m%d-%H%M%S.flv;
diff --git a/templates/live.html.ep b/templates/live.html.ep
index 4b360ad..2278146 100644
--- a/templates/live.html.ep
+++ b/templates/live.html.ep
@@ -11,7 +11,6 @@
       <th data-field="id" data-visible="false">ID</th>
       <th data-field="name" data-width="60" data-width-unit="%">Stream</th>
       <th data-field="publish_user_name" data-width="30" data-width-unit="%">Vysílá</th>
-      <th data-field="recording" data-width="10" data-width-unit="%" data-formatter="formatterRecording">Nahrávání</th>
     </tr>
   </thead>
 </table>
@@ -19,39 +18,11 @@
 <script>
 $('#Streams').bootstrapTable({
     onClickCell: function (field, value, row, $element) {
-        if ( field == 'recording' ) {
-            if ( row.is_recordable ) {
-                $.ajax({
-                    method: 'put',
-                    url: '/streams/' + row.id + '/recording',
-                    data: { action: (value ? 'stop':'start') },
-                    success: function(rc) {
-                        $('#Streams').bootstrapTable('updateByUniqueId', {
-                            id: row.id,
-                            row: rc
-                        });
-                    }
-                });
-            }
-        }
-        else {
-            window.location.href = '/play/' + row.key;
-        }
+        window.location.href = '/play/' + row.key;
     },
     formatNoMatches: function() { return '<p class="text-4xl">Aktuálně neprobíhá žádné živé vysílání</p>' },
 });
 
-function formatterRecording(value, row) {
-    if ( value == 0 ) {
-        var title = row.is_recordable ? 'Zapnout nahrávání':'Vypnuto';
-        return '<i class="fa fa-toggle-off text-3xl" title="'+title+'"></i>';
-    }
-    else {
-        var title = row.is_recordable ? 'Vypnout nahrávání':'Zapnuto';
-        return '<i class="fa fa-toggle-on text-3xl" title="'+title+'"></i>';
-    }
-}
-
 function rowStyle(row, index) {
     return {
         css: {
@@ -63,15 +34,6 @@ function rowStyle(row, index) {
 function connect() {
   var ws = new WebSocket('<%= $c->config->{ws_url} %>');
 
-/*
-  ws.onopen = function() {
-    // subscribe to some channels
-    ws.send(JSON.stringify({
-        //.... some message the I must send when I connect ....
-    }));
-  };
-*/
-
   ws.onmessage = function (event) {
     console.log(event.data);
     $('#Streams').bootstrapTable('refresh', {silent: true})
-- 
GitLab