mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-07-07 19:21:27 +02:00
added non-rec stream types for iptv
This commit is contained in:
@@ -15,6 +15,8 @@ MARKER_FORMAT = " 1:64:{}:0:0:0:0:0:0:0::{}\n#DESCRIPTION {}\n"
|
||||
class StreamType(Enum):
|
||||
DVB_TS = "1"
|
||||
NONE_TS = "4097"
|
||||
NONE_REC_1 = "5001"
|
||||
NONE_REC_2 = "5002"
|
||||
|
||||
|
||||
def parse_m3u(path, profile):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Dmitriy Yefremov
|
||||
Copyright (c) 2018-2019 Dmitriy Yefremov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@ Author: Dmitriy Yefremov
|
||||
<!-- interface-license-type mit -->
|
||||
<!-- interface-name DemonEditor -->
|
||||
<!-- interface-description Enigma2 channel and satellites list editor for GNU/Linux. -->
|
||||
<!-- interface-copyright 2018 Dmitriy Yefremov -->
|
||||
<!-- interface-copyright 2018-2019 Dmitriy Yefremov -->
|
||||
<!-- interface-authors Dmitriy Yefremov -->
|
||||
<object class="GtkDialog" id="search_unavailable_streams_dialog">
|
||||
<property name="use-header-bar">1</property>
|
||||
@@ -192,6 +192,12 @@ Author: Dmitriy Yefremov
|
||||
<row>
|
||||
<col id="0">non-TS</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">none-REC1</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">none-REC2</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkDialog" id="iptv_dialog">
|
||||
|
||||
@@ -25,6 +25,17 @@ def is_data_correct(elems):
|
||||
return True
|
||||
|
||||
|
||||
def get_stream_type(box):
|
||||
active = box.get_active()
|
||||
if active == 0:
|
||||
return StreamType.DVB_TS.value
|
||||
elif active == 1:
|
||||
return StreamType.NONE_TS.value
|
||||
elif active == 2:
|
||||
return StreamType.NONE_REC_1.value
|
||||
return StreamType.NONE_REC_2.value
|
||||
|
||||
|
||||
class IptvDialog:
|
||||
|
||||
def __init__(self, transient, view, services, bouquet, profile=Profile.ENIGMA_2, action=Action.ADD):
|
||||
@@ -116,7 +127,21 @@ class IptvDialog:
|
||||
data = data.split(":")
|
||||
if len(data) < 11:
|
||||
return
|
||||
self._stream_type_combobox.set_active(0 if StreamType(data[0].strip()) is StreamType.DVB_TS else 1)
|
||||
|
||||
s_type = data[0].strip()
|
||||
try:
|
||||
stream_type = StreamType(s_type)
|
||||
if stream_type is StreamType.DVB_TS:
|
||||
self._stream_type_combobox.set_active(0)
|
||||
elif stream_type is StreamType.NONE_TS:
|
||||
self._stream_type_combobox.set_active(1)
|
||||
elif stream_type is StreamType.NONE_REC_1:
|
||||
self._stream_type_combobox.set_active(2)
|
||||
elif stream_type is StreamType.NONE_REC_2:
|
||||
self._stream_type_combobox.set_active(3)
|
||||
except ValueError:
|
||||
show_dialog(DialogType.ERROR, "Unknown stream type {}".format(s_type))
|
||||
|
||||
self._srv_type_entry.set_text(data[2])
|
||||
self._sid_entry.set_text(str(int(data[3], 16)))
|
||||
self._tr_id_entry.set_text(str(int(data[4], 16)))
|
||||
@@ -140,7 +165,7 @@ class IptvDialog:
|
||||
int(self._namespace_entry.get_text())))
|
||||
|
||||
def get_type(self):
|
||||
return 1 if self._stream_type_combobox.get_active() == 0 else 4097
|
||||
return get_stream_type(self._stream_type_combobox)
|
||||
|
||||
def on_entry_changed(self, entry):
|
||||
if _PATTERN.search(entry.get_text()):
|
||||
@@ -409,10 +434,10 @@ class IptvListConfigurationDialog:
|
||||
data = data.split(":")
|
||||
|
||||
if reset:
|
||||
data[0] = " 4097"
|
||||
data[0] = StreamType.NONE_TS.value
|
||||
data[2], data[3], data[4], data[5], data[6] = "10000"
|
||||
else:
|
||||
data[0] = " 4097" if self._stream_type_combobox.get_active() == 1 else "1"
|
||||
data[0] = get_stream_type(self._stream_type_combobox)
|
||||
data[2] = "1" if type_default else self._list_srv_type_entry.get_text()
|
||||
data[3] = "{:X}".format(index) if sid_auto else "0"
|
||||
data[4] = "0" if tid_default else "{:X}".format(int(self._list_tid_entry.get_text()))
|
||||
@@ -431,7 +456,7 @@ class IptvListConfigurationDialog:
|
||||
@run_idle
|
||||
def update_reference(self):
|
||||
if is_data_correct(self._digit_elems):
|
||||
stream_type = "4097" if self._stream_type_combobox.get_active() == 1 else "1"
|
||||
stream_type = get_stream_type(self._stream_type_combobox)
|
||||
self._reference_label.set_text(
|
||||
_ENIGMA2_REFERENCE.format(stream_type, *[int(elem.get_text()) for elem in self._digit_elems]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user