Skip to content

Commit fbf877d

Browse files
committed
DVB-S mux support added
1 parent c2f26a6 commit fbf877d

File tree

2 files changed

+129
-4
lines changed

2 files changed

+129
-4
lines changed

addon.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<addon id="script.module.tvh2kodi"
33
name="Tvheadend Setup for Kodi"
4-
version="1.2"
4+
version="1.3"
55
provider-name="edit4ever">
66
<requires>
77
<import addon="xbmc.python" version="2.6.0"/>
@@ -16,9 +16,8 @@
1616
<summary>Kodi interface for Tvheadend setup (Tvh2Kodi)</summary>
1717
<description>Tvh2Kodi gives access to the basic Tvheadend settings directly from the Kodi interface. This can be used in place of the Tvheadend web interface to get your Tvheadend backend server configured and running. It is also provides an easy way to scan for new services and channels and to configure your channel EPG sources.
1818

19-
v1.2
20-
- fix error in network parameters load
21-
- fix wrong epg parameter selection
19+
v1.3
20+
- add support for DVB-S mux editing
2221

2322
</description>
2423
<disclaimer>Copyright (C) 2017 edit4ever - edit4ever@gmail.com</disclaimer>
@@ -32,6 +31,10 @@ v1.2
3231
<screenshot>resources/screenshot-03.jpg</screenshot>
3332
</assets>
3433
<news>
34+
v1.2
35+
- fix error in network parameters load
36+
- fix wrong epg parameter selection
37+
3538
v1.1
3639
- add triggers for OTA and internal grabbers
3740

default.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,128 @@ def mux_param_edit_dvbt(mux_uuid_sel, mux_info_list, mux_plp_id, mux_fec_lo, mux
530530
param_save = requests.get(param_url)
531531
mux_param_load_dvbt(mux_uuid_sel)
532532

533+
def mux_param_load_dvbs(mux_uuid_sel):
534+
mux_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/load?uuid=' + mux_uuid_sel
535+
mux_load = requests.get(mux_url).json()
536+
mux_name = mux_load['entries'][0]['text']
537+
mux_enabled, mux_enabled_key, mux_enabled_val = find_param_dict(mux_load, 'enabled', 'enum')
538+
mux_delsys, mux_delsys_list = find_param_list(mux_load, 'delsys', 'enum')
539+
mux_frequency = find_param(mux_load, 'frequency')
540+
mux_symbolrate = find_param(mux_load, 'symbolrate')
541+
mux_polarization, mux_polarization_key, mux_polarization_val = find_param_dict(mux_load, 'polarisation', 'enum')
542+
mux_modulation, mux_modulation_key, mux_modulation_val = find_param_dict(mux_load, 'modulation', 'enum')
543+
mux_fec, mux_fec_key, mux_fec_val = find_param_dict(mux_load, 'fec', 'enum')
544+
mux_scanstate, mux_scanstate_key, mux_scanstate_val = find_param_dict(mux_load, 'scan_state', 'enum')
545+
mux_rolloff, mux_rolloff_key, mux_rolloff_val = find_param_dict(mux_load, 'rolloff', 'enum')
546+
mux_pilot, mux_pilot_key, mux_pilot_val = find_param_dict(mux_load, 'pilot', 'enum')
547+
mux_sidfilter = find_param(mux_load, 'sid_filter')
548+
mux_streamid = find_param(mux_load, 'stream_id')
549+
mux_plsmode, mux_plsmode_key, mux_plsmode_val = find_param_dict(mux_load, 'pls_mode', 'enum')
550+
mux_plscode = find_param(mux_load, 'pls_code')
551+
mux_services = find_param(mux_load, 'num_svc')
552+
mux_channels = find_param(mux_load, 'num_chn')
553+
mux_info_list = ["Enabled: " + str(mux_enabled), "Delivery System: " + str(mux_delsys), "Frequency: " + str(mux_frequency), "Symbol Rate: " + str(mux_symbolrate), "Polarization: " + str(mux_polarization), "Modulation: " + str(mux_modulation), "FEC: " + str(mux_fec), "Rolloff: " + str(mux_rolloff), "Pilot: " + str(mux_pilot), "Service ID: " + str(mux_sidfilter), "ISI Stream ID: " + str(mux_streamid), "PLS Mode: " + str(mux_plsmode), "PLS Code: " + str(mux_plscode), "Scan Status: " + str(mux_scanstate), "Number of Services: " + str(mux_services), "Number of Channels: " + str(mux_channels), "DELETE THE MUX"]
554+
mux_param_edit_dvbs(mux_uuid_sel, mux_info_list, mux_sidfilter, mux_streamid, mux_polarization, mux_polarization_key, mux_polarization_val, mux_symbolrate, mux_plscode, mux_fec, mux_fec_key, mux_fec_val, mux_plsmode, mux_plsmode_key, mux_plsmode_val, mux_pilot, mux_pilot_key, mux_pilot_val, mux_scanstate, mux_scanstate_key, mux_scanstate_val, mux_frequency, mux_rolloff, mux_rolloff_key, mux_rolloff_val, mux_modulation, mux_modulation_key, mux_modulation_val, mux_enabled, mux_enabled_key, mux_enabled_val, mux_delsys, mux_delsys_list, mux_name, mux_services, mux_channels)
555+
556+
def mux_param_edit_dvbs(mux_uuid_sel, mux_info_list, mux_sidfilter, mux_streamid, mux_polarization, mux_polarization_key, mux_polarization_val, mux_symbolrate, mux_plscode, mux_fec, mux_fec_key, mux_fec_val, mux_plsmode, mux_plsmode_key, mux_plsmode_val, mux_pilot, mux_pilot_key, mux_pilot_val, mux_scanstate, mux_scanstate_key, mux_scanstate_val, mux_frequency, mux_rolloff, mux_rolloff_key, mux_rolloff_val, mux_modulation, mux_modulation_key, mux_modulation_val, mux_enabled, mux_enabled_key, mux_enabled_val, mux_delsys, mux_delsys_list, mux_name, mux_services, mux_channels):
557+
if mux_scanstate == "ACTIVE":
558+
sel_param = dialog.select(str(mux_name) + ' - Select parameter to edit', list=mux_info_list, autoclose=4000)
559+
mux_param_load_dvbs(mux_uuid_sel)
560+
sel_param = dialog.select(str(mux_name) + ' - Select parameter to edit', list=mux_info_list)
561+
if sel_param < 0:
562+
muxes()
563+
if sel_param >= 0:
564+
param_update = ""
565+
if sel_param == 0:
566+
sel_enabled = dialog.select('Enable or disable the mux', list=mux_enabled_val)
567+
if sel_enabled <0:
568+
mux_param_load_dvbs(mux_uuid_sel)
569+
if sel_enabled >= 0:
570+
mux_enabled = mux_enabled_key[sel_enabled]
571+
param_update = '"enabled":' + str(mux_enabled)
572+
if sel_param == 1:
573+
sel_enabled = dialog.select('Select the mux delivery system', list=mux_delsys_list)
574+
if sel_enabled <0:
575+
mux_param_load_dvbs(mux_uuid_sel)
576+
if sel_enabled >= 0:
577+
mux_delsys = mux_delsys_list[sel_enabled]
578+
param_update = '"delsys":"' + str(mux_delsys + '"')
579+
if sel_param == 2:
580+
sel_mux_frequency = dialog.input('Edit the mux frequency', defaultt=str(mux_frequency),type=xbmcgui.INPUT_NUMERIC)
581+
param_update = '"frequency":' + sel_mux_frequency
582+
if sel_param == 3:
583+
sel_mux_frequency = dialog.input('Edit the mux symbol rate', defaultt=str(mux_symbolrate),type=xbmcgui.INPUT_NUMERIC)
584+
param_update = '"symbolrate":' + sel_mux_symbolrate
585+
if sel_param == 4:
586+
sel_mux_polarization = dialog.select('Select the polarization of the mux', list=mux_polarization_val)
587+
if sel_mux_polarization <0:
588+
mux_param_load_dvbs(mux_uuid_sel)
589+
if sel_mux_polarization >= 0:
590+
mux_polarization = mux_polarization_key[sel_mux_polarization]
591+
param_update = '"polarisation":"' + str(mux_polarization) + '"'
592+
if sel_param == 5:
593+
sel_mux_modulation = dialog.select('Select the modulation of the mux', list=mux_modulation_val)
594+
if sel_mux_modulation <0:
595+
mux_param_load_dvbs(mux_uuid_sel)
596+
if sel_mux_modulation >= 0:
597+
mux_modulation = mux_modulation_key[sel_mux_modulation]
598+
param_update = '"modulation":"' + str(mux_modulation) + '"'
599+
if sel_param == 6:
600+
sel_mux_fec = dialog.select('Select the mux forward error correction', list=mux_fec_val)
601+
if sel_mux_fec <0:
602+
mux_param_load_dvbs(mux_uuid_sel)
603+
if sel_mux_fec >= 0:
604+
mux_fec = mux_fec_key[sel_mux_fec]
605+
param_update = '"fec":"' + str(mux_fec) + '"'
606+
if sel_param == 7:
607+
sel_mux_rolloff = dialog.select('Select the mux rolloff', list=mux_rolloff_val)
608+
if sel_mux_rolloff <0:
609+
mux_param_load_dvbs(mux_uuid_sel)
610+
if sel_mux_rolloff >= 0:
611+
mux_rolloff = mux_rolloff_key[sel_mux_rolloff]
612+
param_update = '"rolloff":"' + str(mux_rolloff) + '"'
613+
if sel_param == 8:
614+
sel_mux_pilot = dialog.select('Select the mux pilot', list=mux_pilot_val)
615+
if sel_mux_pilot <0:
616+
mux_param_load_dvbs(mux_uuid_sel)
617+
if sel_mux_pilot >= 0:
618+
mux_pilot = mux_pilot_key[sel_mux_pilot]
619+
param_update = '"pilot":"' + str(mux_pilot) + '"'
620+
if sel_param == 9:
621+
sel_mux_sidfilter = dialog.input('Edit the mux Service ID - filter out others', defaultt=str(mux_sidfilter),type=xbmcgui.INPUT_ALPHANUM)
622+
param_update = '"sid_filter":' + sel_mux_sidfilter
623+
if sel_param == 10:
624+
sel_mux_streamid = dialog.input('Edit the mux Stream ID', defaultt=str(mux_streamid),type=xbmcgui.INPUT_ALPHANUM)
625+
param_update = '"stream_id":' + sel_mux_streamid
626+
if sel_param == 11:
627+
sel_mux_plsmode = dialog.select('Select the mux bandwidth', list=mux_plsmode_val)
628+
if sel_mux_plsmode <0:
629+
mux_param_load_dvbs(mux_uuid_sel)
630+
if sel_mux_plsmode >= 0:
631+
mux_plsmode = mux_plsmode_key[sel_mux_plsmode]
632+
param_update = '"pls_mode":"' + str(mux_plsmode) + '"'
633+
if sel_param == 12:
634+
sel_mux_plscode = dialog.input('Edit the mux PLS Code', defaultt=str(mux_plscode),type=xbmcgui.INPUT_ALPHANUM)
635+
param_update = '"pls_code":' + sel_mux_plscode
636+
if sel_param == 13:
637+
sel_mux_scanstate = dialog.select('Set the scan state of the mux', list=mux_scanstate_val)
638+
if sel_mux_scanstate <0:
639+
mux_param_load_(mux_uuid_sel)
640+
if sel_mux_scanstate >= 0:
641+
mux_scanstate = mux_scanstate_key[sel_mux_scanstate]
642+
param_update = '"scan_state":' + str(mux_scanstate)
643+
if sel_param == 14:
644+
confirm_del = dialog.yesno('Confirm mux delete', 'Are you sure want to delete the ' + mux_name + ' mux?')
645+
if not confirm_del:
646+
return
647+
delete_mux_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/delete?uuid=["' + mux_uuid_sel +'"]'
648+
delete_mux = requests.get(delete_mux_url)
649+
muxes()
650+
if param_update != "":
651+
param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/save?node={' + param_update + ',"uuid":"' + mux_uuid_sel + '"}'
652+
param_save = requests.get(param_url)
653+
mux_param_load_dvbs(mux_uuid_sel)
654+
533655
def mux_new():
534656
new_mux_net_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/load?class=mpegts_network'
535657
new_mux_net_load = requests.get(new_mux_net_url).json()

0 commit comments

Comments
 (0)