This thread is for example ABM Hacks.
Example files go in:
/usr/lib/enigma2/python/Plugins/SystemPlugins/AutoBouquetsMaker/custom
This thread is for example ABM Hacks.
Example files go in:
/usr/lib/enigma2/python/Plugins/SystemPlugins/AutoBouquetsMaker/custom
Last edited by Huevos; 24-07-15 at 12:05.
Sort channels in each section alphabetically.
This can be used for any provider but the attached file would need to be correctly named for the provider being modified. Switch "swap channels" to "no".
Code:<custommix> <hacks> <![CDATA[ section_numbers = sorted(sections.keys()) for this_section in section_numbers: if section_numbers.index(this_section)+1 < len(section_numbers):#this_section < 1000: next_section = section_numbers[section_numbers.index(this_section)+1] else: next_section = 65535 sort_list = [] for service in sorted(customised["video"].keys()): if service in range(this_section, next_section): if 'interactive_name' in customised["video"][service]: sort_list.append((customised["video"][service], re.sub('^(?![a-z])', 'zzzzz', customised["video"][service]['interactive_name'].lower()))) else: sort_list.append((customised["video"][service], re.sub('^(?![a-z])', 'zzzzz', customised["video"][service]['service_name'].lower()))) del customised["video"][service] sort_list = sorted(sort_list, key=lambda listItem: listItem[1]) i = this_section for service in sort_list: customised["video"][i] = service[0] i += 1 ]]> </hacks> </custommix>
abu baniaz (13-02-16),Bangord30 (10-07-16),Sicilian (30-07-15),sunday96 (07-08-15)
Create an ITV regions bouquet.
Hades 018+.
For use in conjunction with "Sky UK". This will create an ITV regions bouquet as the last but one bouquet. In ABM -> Configure, "Include not indexed channels" must be set to "Yes".
sat_282_sky_uk_CustomMix.xml:
grab.jpgCode:<custommix> <hacks> <![CDATA[ ITVs = [] ITVsPlusOne = [] rest = [] last_section = max(sections.keys()) last_section_name = sections[last_section] for service in sorted(services["sat_282_sky_uk"]["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"]["video"][service] and (service in [103,178] or (service in range(last_section, 1450) and '+1' not in services["sat_282_sky_uk"]["video"][service]["interactive_name"] and ('ITV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"] or 'STV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"] or 'UTV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"]))): ITVs.append(services["sat_282_sky_uk"]["video"][service]) # ITV +1 regions elif 'interactive_name' in services["sat_282_sky_uk"]["video"][service] and (service in [133] or (service in range(last_section, 1450) and '+1' in services["sat_282_sky_uk"]["video"][service]["interactive_name"] and ('ITV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"] or 'STV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"] or 'UTV' in services["sat_282_sky_uk"]["video"][service]["interactive_name"]))): ITVsPlusOne.append(services["sat_282_sky_uk"]["video"][service]) else: rest.append(services["sat_282_sky_uk"]["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 ]]> </hacks> </custommix>
Last edited by Huevos; 07-08-15 at 10:45.
Create a timeshift bouquet.
For Sky UK. Creates a bouquet with "+1", "+2" and "+24" channels. Bouquet is placed after the interactive sections so as not to interfere with numbering.
grab.jpgCode:<custommix> <hacks> <![CDATA[ timeshift = [] rest = [] last_section = max(sections.keys()) last_section_name = sections[last_section] for service in sorted(services["sat_282_sky_uk"]["video"].keys()): if service in range(last_section, 1450): rest.append(services["sat_282_sky_uk"]["video"][service]) elif service < 1000 and ("+1" in services["sat_282_sky_uk"]["video"][service]["service_name"] or "+2" in services["sat_282_sky_uk"]["video"][service]["service_name"]): timeshift.append(services["sat_282_sky_uk"]["video"][service]) i = last_section sections[i] = "Timeshift" 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 ]]> </hacks> </custommix>
For those who want number printed next to channel name.
Only 1-999 are numbered (inclusive of enforced numbers, i.e where we give a channel a number in that range. Eg Setanta sports)
This will break SNPicons
Code:<custommix> <hacks> <![CDATA[ for service in sorted(services[section_identifier]["video"].keys()): if service in range(1,1000): if "interactive_name" in services[section_identifier]["video"][service]: services[section_identifier]["video"][service]["interactive_name"] = str(services[section_identifier]["video"][service]["number"]) + " - " + services[section_identifier]["video"][service]["interactive_name"] else: services[section_identifier]["video"][service]["interactive_name"] = str(services[section_identifier]["video"][service]["number"]) + " - " + services[section_identifier]["video"][service]["service_name"] ]]> </hacks> </custommix>
To show channel numbers on Info bars:
Menu > Setup > System > User Interface > Settings > Show channel number in infobar
Change this to yes and Restart E2 for setting to be applied.
N.B
Enigma2 does not have numbering. The numbers are dynamic and based on the order in which bouquets/channels are loaded. As such not easy to do for Graphical EPG screen.
Edit: mark II version... allows swap to display the correct numbers. For use in OpenViX 4.2.001+.
Code:<custommix> <hacks> <![CDATA[ # swap channel numbers. Only swaps number. Channel swap is still done in bouquetwriter.py if providerConfig.isSwapChannels() and "swapchannels" in providers[section_identifier] and len(providers[section_identifier]["swapchannels"]) > 0 and "preferred_order" in providers[section_identifier]["swapchannels"][0]: for swaprule in providers[section_identifier]["swapchannels"][0]["preferred_order"]: if swaprule[0] in services[section_identifier]["video"] and swaprule[1] in services[section_identifier]["video"] and services[section_identifier]["video"][swaprule[1]]["service_type"] >= 17: customised["video"][swaprule[0]]["number"] = swaprule[1] customised["video"][swaprule[1]]["number"] = swaprule[0] for service in sorted(customised["video"].keys()): if service in range(1,1000): if "interactive_name" in customised["video"][service]: customised["video"][service]["interactive_name"] = str(customised["video"][service]["number"]) + " - " + customised["video"][service]["interactive_name"] else: customised["video"][service]["interactive_name"] = str(customised["video"][service]["number"]) + " - " + customised["video"][service]["service_name"] ]]> </hacks> </custommix>
Last edited by Huevos; 26-07-16 at 21:49.
Bangord30 (10-07-16),judge (11-08-15),outrage_uk (29-09-15),Sicilian (26-09-18)
These will make a csv file containing:
Interactive name
Service reference
Channel Name
Official LCN (Logical Channel Number)
EPG/Channel ID
Encryption type (some are wrong on the tables)
Provider name
IPTV link
TSID
Service type
Ocram Picon SRP value
EDIT:
These are not compatible with Python 3 images
Last edited by abu baniaz; 24-02-23 at 20:37. Reason: not python 3 compatible
This is a test provider file. It goes in the provider folder. You can sort by the Channel/EPG ID, LCN, Name
Last edited by abu baniaz; 09-03-16 at 20:02.
abu baniaz (12-07-16),Bangord30 (10-07-16),Sicilian (26-09-18)
grab1.jpgCode:<custommix> <hacks> <![CDATA[ ftv_IDs = [ 1016, # Liverpool TV 1078, # Birmingham TV 1758, # 4Music 2615, # YESTERDAY +1 5043, # Tyne & Wear TV 5090, # London Live 5315, # Bristol TV 5536, # Cardiff TV 5537, # Leeds TV ] for number in customised["video"].keys(): if customised["video"][number]["channel_id"] in ftv_IDs: customised["video"][number]["free_ca"] = 0 elif customised["video"][number]["free_ca"] == 1: del customised["video"][number] ]]> </hacks> </custommix>
grab2.jpg
grab3.jpg
grab4-jpg.jpg
Last edited by abu baniaz; 14-07-20 at 15:03. Reason: update list.
abu baniaz (10-07-16),Bangord30 (10-07-16),deltec (04-12-23),givecredit (11-07-16),Sicilian (26-09-18)
Place all News channels in the News bouquet.
N.B. You will get an "All channels" bouquet as a result of this hack.
Edit: No longer valid after 2018-05-01 changes.Code:<custommix> <hacks> <![CDATA[ exceptions = { 570:"News", 571:"News", 572:"News", 573:"News", 574:"News", 575:"News", 576:"News", 577:"News", 578:"News", 579:"News" } hacked_bouquets = {} next_lcn = max(customised["video"].keys())+1 sections_copy = {min(sections.keys()): "All channels"} for section in sections: hacked_bouquets[sections[section]] = [] for service in sorted(services[section_identifier]["video"].keys()): if service in exceptions and exceptions[service] in hacked_bouquets: hacked_bouquets[exceptions[services[section_identifier]["video"][service]["number"]]].append(services[section_identifier]["video"][service]) else: sec_list = [] for x in sections: if int(x) <= service: sec_list.append(x) section_number = max(sec_list) hacked_bouquets[sections[section_number]].append(services[section_identifier]["video"][service]) for section in sorted(sections.keys()): sections_copy[next_lcn] = sections[section] for service in hacked_bouquets[sections[section]]: customised["video"][next_lcn] = service next_lcn += 1 sections = sections_copy ]]> </hacks> </custommix>
Last edited by Huevos; 31-05-18 at 10:45. Reason: Add a comment
Rename channels based on numbers
Code:<custommix> <hacks> <![CDATA[ rename = { 101: "My name for 101", 102: "My name for 102", 103: "My name for 103" } # Rename channels for channel_number in sorted(customised["video"].keys()): if channel_number in rename: customised["video"][channel_number]["interactive_name"] = rename[channel_number] ]]> </hacks> </custommix>
Bangord30 (19-07-17),dsayers (20-07-17),outrage_uk (23-07-17),Sicilian (26-09-18)
Class that contains some tools for working on <hacks>
Tool for getting ITV channels and sorting them.Code:import re class FavTools(): def makeSpace(self, customised, sections, pos, length): # make some space part way through the channel list to insert a section. # all channels below will be shifted down and renumbered customised_tmp = {} sections_tmp = {} for sec_num in sorted(sections.keys()): sections_tmp[sec_num + (0 if sec_num < pos else length)] = sections[sec_num] sections = sections_tmp for service in sorted(customised["video"].keys()): customised_tmp[service + (0 if service < pos else length)] = customised["video"][service] customised["video"] = customised_tmp return customised, sections def getSectionNumber(self, sections, section_name): # returns section number for any given section name for section, name in sections.iteritems(): if name == section_name: return section def getNextSection(self, sections, section_name): #returns next section number when given the name of the current section thisSection = self.getSectionNumber(sections, section_name) if thisSection is None: return for section in sorted(sections.keys()): if section > thisSection: return section def getLastServiceInSection(self, services, sections, section_name): ret = None thisSection = self.getSectionNumber(sections, section_name) if thisSection is None: return nextSection = self.getNextSection(sections, section_name) lastService = 0 if nextSection is None: return max(services.keys()) for service in sorted(services.keys()): if service >= thisSection and service < nextSection: ret = service return ret def listChannelsInSection(self, services, providers, provider, section_name): # returns LCN list if provider not in services: return [] thisSection = self.getSectionNumber(sections, section_name) if thisSection is None: return [] nextSection = self.getNextSection(sections, section_name) if nextSection is none: nextSection = 65536 ret = [] for service in sorted(services[sky]["video"].keys()): if service >= thisSection and service < nextSection: ret.append(service) return ret def sortListFlatAlpha(self, services): #returns list of services in alphabetical order by service name (or interactive name if it is set). sort_list = [] for service in services: if 'interactive_name' in service: sort_list.append((service, re.sub('^(?![a-z])', 'zzzzz', service['interactive_name'].lower()))) else: sort_list.append((service, re.sub('^(?![a-z])', 'zzzzz', service['service_name'].lower()))) sort_list = sorted(sort_list, key=lambda listItem: listItem[1]) return [i[0] for i in sort_list] def sortDictFlatAlpha(self, services): # services is a dict with LCNs as keys # returns keys, sorted flat alphabetic by service name (or interactive name if it is set). sort_list = [] for lcn in services: if "interactive_name" in services[lcn]: sort_list.append((lcn, re.sub('^(?![a-z])', 'zzzzz', services[lcn]['interactive_name'].lower()))) else: sort_list.append((lcn, re.sub('^(?![a-z])', 'zzzzz', services[lcn]['service_name'].lower()))) sort_list = sorted(sort_list, key=lambda listItem: listItem[1]) return [i[0] for i in sort_list] def getHDchannelList(self, services, providers, providerConfigs, provider, skipLastSection=False): # returns LCNs HD_channels_numbers = [] last_section = 65536 if skipLastSection: last_section = max(providers[provider]["sections"].keys()) for service in sorted(services[provider]["video"].keys()): if service < last_section and services[provider]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES: HD_channels_numbers.append(service) # Apply channels-on-top hd_channels_numbers_tmp = HD_channels_numbers if providerConfigs[provider].getArea().startswith('sd'): channels_on_top = providers[provider]["sdchannelsontop"] channels_on_top_tmp = list(providers[provider]["sdchannelsontop"]) else: channels_on_top = providers[provider]["hdchannelsontop"] channels_on_top_tmp = list(providers[provider]["hdchannelsontop"]) channels_on_top_tmp = list(channels_on_top) for number in channels_on_top: if number in hd_channels_numbers_tmp: hd_channels_numbers_tmp.remove(number) else: channels_on_top_tmp.remove(number) hd_channels_numbers = channels_on_top_tmp hd_channels_numbers += hd_channels_numbers_tmp return hd_channels_numbers
Code:def SkyUKITVs(services, providers): sky = "sat_282_sky_uk" if sky not in services: return [] ITVs = [] ITVsPlusOne = [] last_sky_section = max(providers[sky]["sections"].keys()) not_indexed_itv = [] for service in sorted(services[sky]["video"].keys()): if service in range(last_sky_section, 1450) or service in [103, 133, 178]: # ITV regions if 'interactive_name' in services[sky]["video"][service] and (service in [103,178] or (service in range(last_sky_section, 1450) and '+1' not in services[sky]["video"][service]["interactive_name"] and ('ITV' in services[sky]["video"][service]["interactive_name"] or 'STV' in services[sky]["video"][service]["interactive_name"] or 'UTV' in services[sky]["video"][service]["interactive_name"]))): ITVs.append(services[sky]["video"][service]) if service >= last_sky_section: not_indexed_itv.append(service) # ITV +1 regions elif 'interactive_name' in services[sky]["video"][service] and (service in [133] or (service in range(last_sky_section, 1450) and '+1' in services[sky]["video"][service]["interactive_name"] and ('ITV' in services[sky]["video"][service]["interactive_name"] or 'STV' in services[sky]["video"][service]["interactive_name"] or 'UTV' in services[sky]["video"][service]["interactive_name"]))): ITVsPlusOne.append(services[sky]["video"][service]) if service >= last_sky_section: not_indexed_itv.append(service) ITVs = FavTools().sortListFlatAlpha(ITVs) ITVs += FavTools().sortListFlatAlpha(ITVsPlusOne) return ITVs, not_indexed_itv
That is the default behaviour. If there is not a simulcast HD channel available ABM will select the substitute HD channel provided by the broadcaster. More on that here: ITV HD channel scanned by ABM doesn't match local region.
If you want to override that behaviour and only swap the simulcast versions of BBC/ITV, not the substitutes, you can try the following:
ABM-config.jpgCode:<custommix> <hacks> <![CDATA[ # this hack prevents non-similcast services between 101 and 103 from swapping. Based on the premise that a service is only similcast if it is in the 800's. if providerConfig.isSwapChannels(): providerConfig.unsetSwapChannels() swapDict = {} for swaprule in providers[section_identifier]["swapchannels"]: if swaprule[0] in services[section_identifier]["video"] and swaprule[1] in services[section_identifier]["video"] and services[section_identifier]["video"][swaprule[1]]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and services[section_identifier]["video"][swaprule[0]]["service_type"] not in DvbScanner.HD_ALLOWED_TYPES: conditional = len(swaprule) > 2 and swaprule[2] or None if not conditional or eval(conditional, {}, {'service_sd': services[section_identifier]["video"][swaprule[0]], 'service_hd': services[section_identifier]["video"][swaprule[1]]}): if swaprule[0] in range(101,104) and swaprule[1] not in range(801,804): continue swapDict[swaprule[0]] = swaprule[1] swapDict[swaprule[1]] = swaprule[0] for number in swapDict: customised["video"][number] = services[section_identifier]["video"][swapDict[number]] ]]> </hacks> </custommix>
ABM-main.jpg
ABM-HD.jpg
Last edited by Huevos; 31-05-18 at 11:19.
CH 4 HD is no longer part of Freesat but as long as it exists in lamedb it can be inserted into the Freesat line up without needing to scan other providers.
The channel will be added to 126, so enable swap to place it into 104
Code:<custommix> <hacks> <![CDATA[ customised["video"][126] = {'service_type': 0x19, 'service_id': 0x52d0, 'transport_stream_id': 0x0814, 'original_network_id': 0x0002, 'namespace': 0x011a0000, 'free_ca': 0x0} # CH 4 HD ]]> </hacks> </custommix>
Last edited by abu baniaz; 08-07-20 at 18:45. Reason: 126, swap, attach xml
abu baniaz (10-07-18),dsayers (10-07-18),Sicilian (12-07-18),Valiant (10-07-18),Willo3092 (10-07-18)
Delete some services that cannot be received. Particularly useful for users in Freeview light areas
Code:<custommix> <deletes> <!-- Delete channels that do not work --> <delete target="8"></delete> <delete target="9"></delete> <delete target="11"></delete> <delete target="12"></delete> <delete target="16"></delete> <delete target="17"></delete> <delete target="18"></delete> <delete target="19"></delete> <delete target="20"></delete> <delete target="21"></delete> <delete target="22"></delete> <delete target="23"></delete> <delete target="25"></delete> <delete target="26"></delete> <delete target="27"></delete> <delete target="29"></delete> <delete target="30"></delete> <delete target="31"></delete> <delete target="32"></delete> <delete target="34"></delete> <delete target="35"></delete> <delete target="36"></delete> <delete target="37"></delete> <delete target="38"></delete> <delete target="39"></delete> <delete target="40"></delete> <delete target="41"></delete> <delete target="42"></delete> <delete target="43"></delete> <delete target="44"></delete> <delete target="46"></delete> <delete target="47"></delete> <delete target="48"></delete> <delete target="49"></delete> <delete target="50"></delete> <delete target="54"></delete> <delete target="57"></delete> <delete target="58"></delete> <delete target="59"></delete> <delete target="60"></delete> <delete target="61"></delete> <delete target="62"></delete> <delete target="63"></delete> <delete target="64"></delete> <delete target="65"></delete> <delete target="66"></delete> <delete target="68"></delete> <delete target="70"></delete> <delete target="71"></delete> <delete target="72"></delete> <delete target="74"></delete> <delete target="77"></delete> <delete target="79"></delete> <delete target="80"></delete> <delete target="81"></delete> <delete target="83"></delete> <delete target="85"></delete> <delete target="203"></delete> <delete target="206"></delete> <delete target="207"></delete> <delete target="208"></delete> <delete target="233"></delete> <delete target="234"></delete> <delete target="672"></delete> <delete target="673"></delete> <delete target="674"></delete> <delete target="675"></delete> <delete target="678"></delete> <delete target="679"></delete> </deletes> <hacks> <![CDATA[ ]]> </hacks> </custommix>
Andy_Hazza (25-09-18),Sicilian (26-09-18)
Please be advised that some of these are not compatible with python3 images.
cactikid (24-02-23)