PDA

View Full Version : [ABM-DVB-S/S2] How to do multiple hacks to CustomMix.xml



Bodmass
28-12-16, 21:25
Hi,

I fancy using more than one of the stickied CustomMix hacks at the same time and assume I can, but....

Is there a specific layout or something I should be using to have more than one hack in the file? Do I just leave a single blank line between hacks or something?

(Have pity, I've never seen Python or FireZilla before this month & a ZX81 was cutting edge when I left school :confused: )

Bod

Huevos
29-12-16, 02:16
The hacks were just examples. Pretty much anything is possible but you need to be able to write some simple python code. Which hacks did you want to combine?

Bodmass
29-12-16, 13:33
I've successfully downloaded and installed the Timeshift bouquet from the .zip file & was thinking of adding the ITV regions one - to be honest, as much to learn how as for actual use.

...Then thinking of moving on to playing with a Favourites folder (If I can do so whilst keeping original Sky numbering in place).

To be honest, if it involves more than a blank line or simple bit of linking text I can live without it. I'm mostly just playing around to see what I can do/learn with ABM that's safely within my capabilities :)

Huevos
29-12-16, 23:35
No, you can't just put one after the other. You would need to rewrite it so they work together. There is no support for this function. It is there for people that know some Python.

Bodmass
30-12-16, 14:48
OK - understood.

Thanks for coming back to me anyway :)

Bod

lincsat
30-12-16, 16:28
I've successfully downloaded and installed the Timeshift bouquet from the .zip file & was thinking of adding the ITV regions one - to be honest, as much to learn how as for actual use.

...Then thinking of moving on to playing with a Favourites folder (If I can do so whilst keeping original Sky numbering in place).

To be honest, if it involves more than a blank line or simple bit of linking text I can live without it. I'm mostly just playing around to see what I can do/learn with ABM that's safely within my capabilities :)

That's pretty much what I did. If you use my code, note the non-standard naming of the xml files - sat_282_sky_uk_alt.xml & sat_282_sky_uk_alt_CustomMix.xml


<custommix>
<hacks>
<![CDATA[

# Make ITV regions bouquet

ITVs = []
ITVsPlusOne = []
rest = []
last_section = max(sections.keys())
last_section_name = sections[last_section]

for service in sorted(services["sat_282_sky_uk_alt"]["video"].keys()):
if service in range(last_section, 1450) or service in [103, 133, 178]:
# ITV regions
if 'interactive_name' in services["sat_282_sky_uk_alt"]["video"][service] and (service in [103,178] or (service in range(last_section, 1450) and '+1' not in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] and ('ITV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] or 'STV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] or 'UTV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"]))):
ITVs.append(services["sat_282_sky_uk_alt"]["video"][service])

# ITV +1 regions
elif 'interactive_name' in services["sat_282_sky_uk_alt"]["video"][service] and (service in [133] or (service in range(last_section, 1450) and '+1' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] and ('ITV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] or 'STV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"] or 'UTV' in services["sat_282_sky_uk_alt"]["video"][service]["interactive_name"]))):
ITVsPlusOne.append(services["sat_282_sky_uk_alt"]["video"][service])

else:
rest.append(services["sat_282_sky_uk_alt"]["video"][service])

i = last_section
sections[i] = "ITV Regions"

sort_list = []
for x in ITVs:
sort_list.append((x, re.sub('^(?![a-z])', 'zzzzz', x['interactive_name'].lower())))
sort_list = sorted(sort_list, key=lambda listItem: listItem[1])
for service in sort_list:
customised["video"][i] = service[0]
i += 1

sort_list = []
for x in ITVsPlusOne:
sort_list.append((x, re.sub('^(?![a-z])', 'zzzzz', x['interactive_name'].lower())))
sort_list = sorted(sort_list, key=lambda listItem: listItem[1])
for service in sort_list:
customised["video"][i] = service[0]
i += 1

sections[i] = last_section_name
sort_list = []
for x in rest:
sort_list.append((x, re.sub('^(?![a-z])', 'zzzzz', x['service_name'].lower())))
sort_list = sorted(sort_list, key=lambda listItem: listItem[1])
for service in sort_list:
customised["video"][i] = service[0]
i += 1

################################################## ##########################################

# make a timeshift bouquet

timeshift = []
rest = []
last_section = max(sections.keys())
last_section_name = sections[last_section]

for service in sorted(services["sat_282_sky_uk_alt"]["video"].keys()):
if service in range(last_section, 1450):
rest.append(services["sat_282_sky_uk_alt"]["video"][service])
elif service < 1000 and ("+1" in services["sat_282_sky_uk_alt"]["video"][service]["service_name"] or "+2" in services["sat_282_sky_uk_alt"]["video"][service]["service_name"]):
timeshift.append(services["sat_282_sky_uk_alt"]["video"][service])

i = last_section
sections[i] = "Timeshifted Channels"

sort_list = []
for x in timeshift:
sort_list.append((x, re.sub('^(?![a-z])', 'zzzzz', x['service_name'].lower())))
sort_list = sorted(sort_list, key=lambda listItem: listItem[1])
for service in sort_list:
customised["video"][i] = service[0]
i += 1

sections[i] = last_section_name
sort_list = []
for x in rest:
sort_list.append((x, re.sub('^(?![a-z])', 'zzzzz', x['service_name'].lower())))
sort_list = sorted(sort_list, key=lambda listItem: listItem[1])
for service in sort_list:
customised["video"][i] = service[0]
i += 1


################################################## ##########################################

# make a csv file in tmp



csv = ["Service ref, Name, LCN, CHID, CA, Provider\r\n"]

for number in sorted(customised["video"].keys()):
csv.append("1:0:%x:%x:%x:%x:%x:0:0:0:, %s, %d, %d, %d, %s\r\n" % (
customised["video"][number]["service_type"],
customised["video"][number]["service_id"],
customised["video"][number]["transport_stream_id"],
customised["video"][number]["original_network_id"],
customised["video"][number]["namespace"],
customised["video"][number]["service_name"],
number,
customised["video"][number]["channel_id"],
customised["video"][number]["free_ca"],
customised["video"][number]["provider_name"]
))

with open("/tmp/skyuk.csv", "w") as csv_file:
csv_file.write(''.join(csv))

]]>
</hacks>
</custommix>