Skip to content

Commit 5119e9b

Browse files
committed
fix muxes error - bump release for iptv
1 parent 795c7ba commit 5119e9b

File tree

2 files changed

+42
-27
lines changed

2 files changed

+42
-27
lines changed

addon.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* minimum version of Tvheadend is 4.2
2020
v1.8
2121
- add support for IPTV Networks
22+
- fix error in muxes when 0 muxes available
2223
v1.7
2324
- add support for Tvh username-password
2425
v1.6

default.py

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -356,31 +356,35 @@ def muxes_load(net_uuid_sel):
356356
muxes_enabled = []
357357
muxes_network = []
358358
muxes_frequency = []
359-
for mux_n in muxes['entries']:
360-
muxes_name.append(mux_n['name'])
361-
for mux_u in muxes['entries']:
362-
muxes_uuid.append(mux_u['uuid'])
363-
for mux_w in muxes['entries']:
364-
muxes_network.append(" in " + mux_w['network'])
365-
try:
366-
for mux_f in muxes['entries']:
367-
muxes_frequency.append(mux_f['frequency'])
368-
except:
369-
for mux_f in muxes['entries']:
370-
muxes_frequency.append(mux_f['channel_number'])
371-
muxes_full = zip(muxes_name, muxes_network,)
372-
muxes_list = ["%s %s" % x for x in muxes_full]
373-
muxes_frequency, muxes_list, muxes_uuid = zip(*sorted(zip(muxes_frequency, muxes_list, muxes_uuid)))
374-
create_mux = "CREATE NEW MUX"
375-
muxes_list = list(muxes_list)
376-
muxes_list.insert(0,create_mux)
377-
muxes_list = tuple(muxes_list)
378-
muxes_frequency = list(muxes_frequency)
379-
muxes_frequency.insert(0,create_mux)
380-
muxes_frequency = tuple(muxes_frequency)
381-
muxes_uuid = list(muxes_uuid)
382-
muxes_uuid.insert(0,create_mux)
383-
muxes_uuid = tuple(muxes_uuid)
359+
muxes_total = muxes['total']
360+
if muxes_total > 0:
361+
for mux_n in muxes['entries']:
362+
muxes_name.append(mux_n['name'])
363+
for mux_u in muxes['entries']:
364+
muxes_uuid.append(mux_u['uuid'])
365+
for mux_w in muxes['entries']:
366+
muxes_network.append(" in " + mux_w['network'])
367+
try:
368+
for mux_f in muxes['entries']:
369+
muxes_frequency.append(mux_f['frequency'])
370+
except:
371+
for mux_f in muxes['entries']:
372+
muxes_frequency.append(mux_f['channel_number'])
373+
muxes_full = zip(muxes_name, muxes_network,)
374+
muxes_list = ["%s %s" % x for x in muxes_full]
375+
muxes_frequency, muxes_list, muxes_uuid = zip(*sorted(zip(muxes_frequency, muxes_list, muxes_uuid)))
376+
create_mux = "CREATE NEW MUX"
377+
muxes_list = list(muxes_list)
378+
muxes_list.insert(0,create_mux)
379+
muxes_list = tuple(muxes_list)
380+
muxes_frequency = list(muxes_frequency)
381+
muxes_frequency.insert(0,create_mux)
382+
muxes_frequency = tuple(muxes_frequency)
383+
muxes_uuid = list(muxes_uuid)
384+
muxes_uuid.insert(0,create_mux)
385+
muxes_uuid = tuple(muxes_uuid)
386+
else:
387+
muxes_list = ['CREATE NEW MUX']
384388
sel_mux = dialog.select('Select a mux to configure', list=muxes_list)
385389
if sel_mux == 0:
386390
if net_class == "iptv_network" or net_class == "iptv_auto_network":
@@ -1264,7 +1268,7 @@ def network_new():
12641268
net_create = requests.get(net_create_url).json()
12651269
net_uuid_sel = net_create['uuid']
12661270
return net_uuid_sel
1267-
if sel_net_type == 5 or sel_net_type == 6:
1271+
if sel_net_type == 5:
12681272
net_type = net_type_name[sel_net_type]
12691273
net_class = net_type_class[sel_net_type]
12701274
new_net_name = dialog.input('Name of the network', defaultt=net_type,type=xbmcgui.INPUT_ALPHANUM)
@@ -1276,6 +1280,16 @@ def network_new():
12761280
net_create = requests.get(net_create_url).json()
12771281
net_uuid_sel = net_create['uuid']
12781282
return net_uuid_sel
1283+
if sel_net_type == 6:
1284+
net_type = net_type_name[sel_net_type]
1285+
net_class = net_type_class[sel_net_type]
1286+
new_net_name = dialog.input('Name of the network', defaultt=net_type,type=xbmcgui.INPUT_ALPHANUM)
1287+
if new_net_name == "":
1288+
new_net_name = net_type
1289+
net_create_url = 'http://' + tvh_url + ':' + tvh_port + '/api/mpegts/network/create?class=' + net_class + '&conf={"networkname":"' + new_net_name + '","bouquet":false}'
1290+
net_create = requests.get(net_create_url).json()
1291+
net_uuid_sel = net_create['uuid']
1292+
return net_uuid_sel
12791293
if sel_net_type >= 7:
12801294
dialog.ok("Network Not Supported!", "ISDB Networks are currently not supported in this addon.", "Please use the Tvheadend web interface to configure ISDB Networks.")
12811295
net_uuid_sel = ""
@@ -1941,7 +1955,7 @@ def epg():
19411955

19421956
@plugin.route('/wizard')
19431957
def wizard():
1944-
start = dialog.yesno("TVheadend Wizard - Start", "This wizard will walk you through the initial setup for TVheadend. Running this wizard on an already configured system could cause issues.", "Do you wish to continue?")
1958+
start = dialog.yesno("TVheadend Wizard - Start", "This wizard will walk you through the initial setup for TVheadend using usb tuners. Running this wizard on an already configured system could cause issues.", "Do you wish to continue?")
19451959
if not start:
19461960
return
19471961
else:

0 commit comments

Comments
 (0)