From 18dcb3cf19c89228c8937ad988e8e3a505997012 Mon Sep 17 00:00:00 2001 From: topilski Date: Fri, 11 Oct 2019 06:28:56 -0400 Subject: [PATCH] Vod refactoring --- app/common | 2 +- app/provider/view.py | 2 +- app/service/service.py | 8 ++++---- app/templates/stream/catchup/base.html | 4 ---- app/templates/stream/cod_encode/add.html | 2 +- app/templates/stream/cod_encode/base.html | 8 -------- app/templates/stream/cod_encode/edit.html | 2 +- app/templates/stream/cod_relay/add.html | 2 +- app/templates/stream/cod_relay/base.html | 4 ---- app/templates/stream/cod_relay/edit.html | 2 +- app/templates/stream/encode/base.html | 4 ---- app/templates/stream/proxy/base.html | 4 ---- app/templates/stream/relay/base.html | 4 ---- app/templates/stream/test_life/base.html | 4 ---- app/templates/stream/timeshift_player/base.html | 4 ---- app/templates/stream/timeshift_recorder/base.html | 4 ---- app/templates/stream/vod_encode/add.html | 2 +- app/templates/stream/vod_encode/base.html | 4 ---- app/templates/stream/vod_encode/edit.html | 2 +- app/templates/stream/vod_relay/add.html | 2 +- app/templates/stream/vod_relay/base.html | 4 ---- app/templates/stream/vod_relay/edit.html | 2 +- 22 files changed, 14 insertions(+), 62 deletions(-) diff --git a/app/common b/app/common index cd20fd1..640242e 160000 --- a/app/common +++ b/app/common @@ -1 +1 @@ -Subproject commit cd20fd187f49fae0e25c2fe75042d3a5eb7a7bef +Subproject commit 640242e6bc79f01b553b4fdadf181aad2b34c4b7 diff --git a/app/provider/view.py b/app/provider/view.py index 498e051..0f60dc1 100644 --- a/app/provider/view.py +++ b/app/provider/view.py @@ -17,7 +17,7 @@ class ProviderView(FlaskView): streams = server.get_streams() front_streams = [] for stream in streams: - front_streams.append(stream.to_front()) + front_streams.append(stream.to_dict()) role = server.get_user_role_by_id(current_user.id) return render_template('provider/dashboard.html', streams=front_streams, service=server, servers=current_user.servers, role=role) diff --git a/app/service/service.py b/app/service/service.py index 23ea029..f9a11b3 100644 --- a/app/service/service.py +++ b/app/service/service.py @@ -246,7 +246,7 @@ class Service(IStreamHandler): self._settings.streams.remove(stream) break - def to_front(self) -> dict: + def to_dict(self) -> dict: return {ServiceFields.ID: str(self.id), ServiceFields.CPU: self._cpu, ServiceFields.GPU: self._gpu, ServiceFields.LOAD_AVERAGE: self._load_average, ServiceFields.MEMORY_TOTAL: self._memory_total, ServiceFields.MEMORY_FREE: self._memory_free, ServiceFields.HDD_TOTAL: self._hdd_total, @@ -295,7 +295,7 @@ class Service(IStreamHandler): stream = self.find_stream_by_id(sid) if stream: stream.update_runtime_fields(params) - self.__notify_front(Service.STREAM_DATA_CHANGED, stream.to_front()) + self.__notify_front(Service.STREAM_DATA_CHANGED, stream.to_dict()) def on_stream_sources_changed(self, params: dict): pass @@ -303,14 +303,14 @@ class Service(IStreamHandler): def on_service_statistic_received(self, params: dict): # nid = params['id'] self.__refresh_stats(params) - self.__notify_front(Service.SERVICE_DATA_CHANGED, self.to_front()) + self.__notify_front(Service.SERVICE_DATA_CHANGED, self.to_dict()) def on_quit_status_stream(self, params: dict): sid = params['id'] stream = self.find_stream_by_id(sid) if stream: stream.reset() - self.__notify_front(Service.STREAM_DATA_CHANGED, stream.to_front()) + self.__notify_front(Service.STREAM_DATA_CHANGED, stream.to_dict()) def on_client_state_changed(self, status: ClientStatus): if status == ClientStatus.ACTIVE: diff --git a/app/templates/stream/catchup/base.html b/app/templates/stream/catchup/base.html index 19accef..56b3870 100644 --- a/app/templates/stream/catchup/base.html +++ b/app/templates/stream/catchup/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/cod_encode/add.html b/app/templates/stream/cod_encode/add.html index 0997d12..8e7e01f 100644 --- a/app/templates/stream/cod_encode/add.html +++ b/app/templates/stream/cod_encode/add.html @@ -1,4 +1,4 @@ -{% extends 'stream/encode/base.html' %} +{% extends 'stream/cod_encode/base.html' %} {% block title %} Add cod encode stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/cod_encode/base.html b/app/templates/stream/cod_encode/base.html index 95d05e1..db00d45 100644 --- a/app/templates/stream/cod_encode/base.html +++ b/app/templates/stream/cod_encode/base.html @@ -34,16 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/cod_encode/edit.html b/app/templates/stream/cod_encode/edit.html index 77d1a6b..06e34f3 100644 --- a/app/templates/stream/cod_encode/edit.html +++ b/app/templates/stream/cod_encode/edit.html @@ -1,4 +1,4 @@ -{% extends 'stream/encode/base.html' %} +{% extends 'stream/cod_encode/base.html' %} {% block title %} Edit cod encode stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/cod_relay/add.html b/app/templates/stream/cod_relay/add.html index 252d507..b02bfab 100644 --- a/app/templates/stream/cod_relay/add.html +++ b/app/templates/stream/cod_relay/add.html @@ -1,4 +1,4 @@ -{% extends 'stream/relay/base.html' %} +{% extends 'stream/cod_relay/base.html' %} {% block title %} Add cod relay stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/cod_relay/base.html b/app/templates/stream/cod_relay/base.html index f0559e8..faae3e3 100644 --- a/app/templates/stream/cod_relay/base.html +++ b/app/templates/stream/cod_relay/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/cod_relay/edit.html b/app/templates/stream/cod_relay/edit.html index 6ac2039..f407095 100644 --- a/app/templates/stream/cod_relay/edit.html +++ b/app/templates/stream/cod_relay/edit.html @@ -1,4 +1,4 @@ -{% extends 'stream/relay/base.html' %} +{% extends 'stream/cod_relay/base.html' %} {% block title %} Edit cod relay stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/encode/base.html b/app/templates/stream/encode/base.html index 29bb384..db00d45 100644 --- a/app/templates/stream/encode/base.html +++ b/app/templates/stream/encode/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/proxy/base.html b/app/templates/stream/proxy/base.html index 0c5d6e5..3985830 100644 --- a/app/templates/stream/proxy/base.html +++ b/app/templates/stream/proxy/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_form(form.output) }}
{{ render_bootstrap_form(form.price) }} diff --git a/app/templates/stream/relay/base.html b/app/templates/stream/relay/base.html index f0559e8..faae3e3 100644 --- a/app/templates/stream/relay/base.html +++ b/app/templates/stream/relay/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/test_life/base.html b/app/templates/stream/test_life/base.html index 2cbc43f..9b35631 100644 --- a/app/templates/stream/test_life/base.html +++ b/app/templates/stream/test_life/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/timeshift_player/base.html b/app/templates/stream/timeshift_player/base.html index 00dfa1f..4ccdefb 100644 --- a/app/templates/stream/timeshift_player/base.html +++ b/app/templates/stream/timeshift_player/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/timeshift_recorder/base.html b/app/templates/stream/timeshift_recorder/base.html index 29028cf..954830f 100644 --- a/app/templates/stream/timeshift_recorder/base.html +++ b/app/templates/stream/timeshift_recorder/base.html @@ -34,12 +34,8 @@
{{ render_bootstrap_field(form.tvg_logo) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.avformat) }}
{{ render_bootstrap_field(form.audio_select) }} diff --git a/app/templates/stream/vod_encode/add.html b/app/templates/stream/vod_encode/add.html index 7eecd52..a1c6c91 100644 --- a/app/templates/stream/vod_encode/add.html +++ b/app/templates/stream/vod_encode/add.html @@ -1,4 +1,4 @@ -{% extends 'stream/encode/base.html' %} +{% extends 'stream/vod_encode/base.html' %} {% block title %} Add vod encode stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/vod_encode/base.html b/app/templates/stream/vod_encode/base.html index d3a919f..8d9c0e2 100644 --- a/app/templates/stream/vod_encode/base.html +++ b/app/templates/stream/vod_encode/base.html @@ -36,14 +36,10 @@
{{ render_bootstrap_field(form.preview_icon) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
{{ render_bootstrap_field(form.description) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/vod_encode/edit.html b/app/templates/stream/vod_encode/edit.html index 30b7186..592e677 100644 --- a/app/templates/stream/vod_encode/edit.html +++ b/app/templates/stream/vod_encode/edit.html @@ -1,4 +1,4 @@ -{% extends 'stream/encode/base.html' %} +{% extends 'stream/vod_encode/base.html' %} {% block title %} Edit vod encode stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/vod_relay/add.html b/app/templates/stream/vod_relay/add.html index 17e0c9a..ad4fd0f 100644 --- a/app/templates/stream/vod_relay/add.html +++ b/app/templates/stream/vod_relay/add.html @@ -1,4 +1,4 @@ -{% extends 'stream/relay/base.html' %} +{% extends 'stream/vod_relay/base.html' %} {% block title %} Add vod relay stream {% endblock %} \ No newline at end of file diff --git a/app/templates/stream/vod_relay/base.html b/app/templates/stream/vod_relay/base.html index 2abb1ba..f0559e8 100644 --- a/app/templates/stream/vod_relay/base.html +++ b/app/templates/stream/vod_relay/base.html @@ -36,14 +36,10 @@
{{ render_bootstrap_field(form.preview_icon) }}
- {{ render_bootstrap_field(form.preview_icon) }} -
{{ render_bootstrap_field(form.group_title) }}
{{ render_bootstrap_field(form.description) }}
- {{ render_bootstrap_field(form.description) }} -
{{ render_bootstrap_field(form.audio_select) }}
{{ render_bootstrap_field(form.have_video) }} diff --git a/app/templates/stream/vod_relay/edit.html b/app/templates/stream/vod_relay/edit.html index ba8f435..d3642e6 100644 --- a/app/templates/stream/vod_relay/edit.html +++ b/app/templates/stream/vod_relay/edit.html @@ -1,4 +1,4 @@ -{% extends 'stream/relay/base.html' %} +{% extends 'stream/vod_relay/base.html' %} {% block title %} Edit vod relay stream {% endblock %} \ No newline at end of file