Skip to content

Commit d2ba75f

Browse files
committed
added Tvh base config parameters
1 parent 7fc37e6 commit d2ba75f

File tree

1 file changed

+94
-7
lines changed

1 file changed

+94
-7
lines changed

default.py

Lines changed: 94 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ def dvr_param_edit(dvr_uuid_sel, dvr_info_list, dvr_keep_key, dvr_keep_val, dvr_
155155
param_update = ""
156156
if sel_param == 0:
157157
sel_dvr_name = dialog.input('Edit the DVR profile name', defaultt=dvr_name,type=xbmcgui.INPUT_ALPHANUM)
158-
param_update = '"name":"' + sel_dvr_name + '"'
158+
if sel_dvr_name == "":
159+
dvr_param_load(dvr_uuid_sel)
160+
else:
161+
param_update = '"name":"' + sel_dvr_name + '"'
159162
if sel_param == 1:
160163
sel_enabled = dialog.select('Enable or disable the DVR profile', list=enabledisable)
161164
if sel_enabled >= 0:
@@ -516,7 +519,10 @@ def mux_param_edit_dvbt(mux_uuid_sel, mux_info_list, mux_plp_id, mux_fec_lo, mux
516519
param_update = '"fec_lo":"' + str(mux_fec_lo) + '"'
517520
if sel_param == 10:
518521
sel_mux_plp_id = dialog.input('Edit the mux PLP ID', defaultt=str(mux_plp_id),type=xbmcgui.INPUT_ALPHANUM)
519-
param_update = '"plp_id":' + sel_mux_plp_id
522+
if sel_mux_plp_id == "":
523+
return
524+
else:
525+
param_update = '"plp_id":' + sel_mux_plp_id
520526
if sel_param == 11:
521527
sel_mux_scanstate = dialog.select('Set the scan state of the mux', list=mux_scanstate_val)
522528
if sel_mux_scanstate <0:
@@ -625,10 +631,16 @@ def mux_param_edit_dvbs(mux_uuid_sel, mux_info_list, mux_sidfilter, mux_streamid
625631
param_update = '"pilot":"' + str(mux_pilot) + '"'
626632
if sel_param == 9:
627633
sel_mux_sidfilter = dialog.input('Edit the mux Service ID - filter out others', defaultt=str(mux_sidfilter),type=xbmcgui.INPUT_ALPHANUM)
628-
param_update = '"sid_filter":' + sel_mux_sidfilter
634+
if sel_mux_sidfilter == "":
635+
mux_param_load_dvbs(mux_uuid_sel)
636+
else:
637+
param_update = '"sid_filter":' + sel_mux_sidfilter
629638
if sel_param == 10:
630639
sel_mux_streamid = dialog.input('Edit the mux Stream ID', defaultt=str(mux_streamid),type=xbmcgui.INPUT_ALPHANUM)
631-
param_update = '"stream_id":' + sel_mux_streamid
640+
if sel_mux_streamid == "":
641+
mux_param_load_dvbs(mux_uuid_sel)
642+
else:
643+
param_update = '"stream_id":' + sel_mux_streamid
632644
if sel_param == 11:
633645
sel_mux_plsmode = dialog.select('Select the mux bandwidth', list=mux_plsmode_val)
634646
if sel_mux_plsmode <0:
@@ -638,7 +650,10 @@ def mux_param_edit_dvbs(mux_uuid_sel, mux_info_list, mux_sidfilter, mux_streamid
638650
param_update = '"pls_mode":"' + str(mux_plsmode) + '"'
639651
if sel_param == 12:
640652
sel_mux_plscode = dialog.input('Edit the mux PLS Code', defaultt=str(mux_plscode),type=xbmcgui.INPUT_ALPHANUM)
641-
param_update = '"pls_code":' + sel_mux_plscode
653+
if sel_mux_plscode == "":
654+
mux_param_load_dvbs(mux_uuid_sel)
655+
else:
656+
param_update = '"pls_code":' + sel_mux_plscode
642657
if sel_param == 13:
643658
sel_mux_scanstate = dialog.select('Set the scan state of the mux', list=mux_scanstate_val)
644659
if sel_mux_scanstate <0:
@@ -732,7 +747,10 @@ def ch_param_edit(ch_uuid_sel, ch_info_list, ch_enabled, ch_autoname, ch_name, c
732747
param_update = ""
733748
if sel_param == 0:
734749
sel_ch_name = dialog.input('Edit the channel name', defaultt=ch_name,type=xbmcgui.INPUT_ALPHANUM)
735-
param_update = '"name":"' + sel_ch_name + '"'
750+
if sel_ch_name == "":
751+
ch_param_load(ch_uuid_sel)
752+
else:
753+
param_update = '"name":"' + sel_ch_name + '"'
736754
if sel_param == 1:
737755
sel_ch_number = dialog.input('Edit the channel number', defaultt=ch_number,type=xbmcgui.INPUT_NUMERIC)
738756
param_update = '"number":"' + sel_ch_number + '"'
@@ -748,7 +766,10 @@ def ch_param_edit(ch_uuid_sel, ch_info_list, ch_enabled, ch_autoname, ch_name, c
748766
param_update = '"autoname":' + ch_autoname
749767
if sel_param == 4:
750768
sel_ch_icon = dialog.input('Edit the channel icon URL', defaultt=ch_icon,type=xbmcgui.INPUT_ALPHANUM)
751-
param_update = '"icon":"' + sel_ch_icon + '"'
769+
if sel_ch_name == "":
770+
ch_param_load(ch_uuid_sel)
771+
else:
772+
param_update = '"icon":"' + sel_ch_icon + '"'
752773
if sel_param == 5:
753774
epg_grid_url = 'http://' + tvh_url + ':' + tvh_port + '/api/epggrab/channel/grid?sort=names&dir=ASC&all=1'
754775
epg_grid_load = requests.get(epg_grid_url).json()
@@ -1567,6 +1588,66 @@ def wizard():
15671588
else:
15681589
wizard_start()
15691590

1591+
@plugin.route('/yvh')
1592+
def tvh():
1593+
tvh_config_url = 'http://' + tvh_url + ':' + tvh_port + '/api/config/load'
1594+
tvh_config_load = requests.get(tvh_config_url).json()
1595+
dvb_scan_path = find_param(tvh_config_load, 'muxconfpath')
1596+
prefer_picon = find_param(tvh_config_load, 'prefer_picon')
1597+
ch_icon_path = find_param(tvh_config_load, 'chiconpath')
1598+
ch_icon_scheme, ch_icon_scheme_key, ch_icon_scheme_val = find_param_dict(tvh_config_load, 'chiconscheme', 'enum')
1599+
picon_path = find_param(tvh_config_load, 'piconpath')
1600+
picon_scheme, picon_scheme_key, picon_scheme_val = find_param_dict(tvh_config_load, 'piconscheme', 'enum')
1601+
tvh_config_info_list = ["DVB scan path: " + str(dvb_scan_path), "Prefer picon: " + str(prefer_picon), "Channel icon path: " + str(ch_icon_path), "Channel icon scheme: " + str(ch_icon_scheme), "Picon path: " + str(picon_path), "Picon scheme: " + str(picon_scheme)]
1602+
# tvh_config_param_edit(dvb_scan_path, prefer_picon, ch_icon_path, ch_icon_scheme, picon_path, picon_scheme)
1603+
sel_tvh = dialog.select('Select a Tvh configuration parameter to edit', list=tvh_config_info_list)
1604+
if sel_tvh < 0:
1605+
return
1606+
if sel_tvh == 0:
1607+
sel_dvb_scan_path = dialog.input('Edit the DVB scan files path', defaultt=dvb_scan_path,type=xbmcgui.INPUT_ALPHANUM)
1608+
if sel_dvb_scan_path == "":
1609+
return
1610+
else:
1611+
param_update = '"muxconfpath":"' + sel_dvb_scan_path + '"'
1612+
if sel_tvh == 1:
1613+
sel_prefer_picon = dialog.select('Enable or disable to prefer picons over channel name', list=enabledisable)
1614+
if sel_prefer_picon <0:
1615+
return
1616+
if sel_prefer_picon >= 0:
1617+
prefer_picon = truefalse[sel_prefer_picon]
1618+
param_update = '"prefer_picon":' + prefer_picon
1619+
if sel_tvh == 2:
1620+
sel_ch_icon_path = dialog.input('Edit the channel icons path', defaultt=ch_icon_path,type=xbmcgui.INPUT_ALPHANUM)
1621+
if sel_ch_icon_path == "":
1622+
return
1623+
else:
1624+
param_update = '"chiconpath":"' + sel_ch_icon_path + '"'
1625+
if sel_tvh == 3:
1626+
sel_ch_icon_scheme = dialog.select('Select the channel icon name scheme', list=ch_icon_scheme_val)
1627+
if sel_ch_icon_scheme <0:
1628+
return
1629+
if sel_ch_icon_scheme >= 0:
1630+
ch_icon_scheme = ch_icon_scheme_key[sel_ch_icon_scheme]
1631+
param_update = '"chiconscheme":"' + str(ch_icon_scheme) + '"'
1632+
if sel_tvh == 4:
1633+
sel_picon_path = dialog.input('Edit the channel icons path', defaultt=picon_path,type=xbmcgui.INPUT_ALPHANUM)
1634+
if sel_picon_path == "":
1635+
return
1636+
else:
1637+
param_update = '"piconpath":"' + sel_picon_path + '"'
1638+
if sel_tvh == 5:
1639+
sel_picon_scheme = dialog.select('Select the channel icon name scheme', list=picon_scheme_val)
1640+
if sel_picon_schem <0:
1641+
return
1642+
if sel_picon_scheme >= 0:
1643+
picon_scheme = ch_icon_scheme_key[sel_ch_icon_scheme]
1644+
param_update = '"piconscheme":"' + str(picon_scheme) + '"'
1645+
if param_update != "":
1646+
param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/config/save?node={' + param_update + '}'
1647+
param_save = requests.get(param_url)
1648+
tvh()
1649+
1650+
15701651
@plugin.route('/tvhclient')
15711652
def tvhclient():
15721653
plugin.open_settings()
@@ -1624,6 +1705,12 @@ def index():
16241705
'thumbnail':get_icon_path('dvr'),
16251706
})
16261707
items.append(
1708+
{
1709+
'label': 'Tvh Base Configuration',
1710+
'path': plugin.url_for(u'tvh'),
1711+
'thumbnail':get_icon_path('settings'),
1712+
})
1713+
items.append(
16271714
{
16281715
'label': 'Start Wizard',
16291716
'path': plugin.url_for(u'wizard'),

0 commit comments

Comments
 (0)