Page 9 of 9 FirstFirst ... 789
Results 121 to 130 of 130
  1. #121
    Moderator Huevos's Avatar

    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    8,321
    Thanks
    1,642
    Thanked 3,069 Times in 2,021 Posts
    Quote Originally Posted by dsayers View Post
    For my region 113 named ITV HD
    Ok, so what is happening is 113 is getting saved to "move_dict" but we continue searching and then it finds another match at 179 and overwrites the first match. So we need to avoid that happening.

    Code:
    source = "sat_282_sky_uk"
    dest = "cable_uk_virgin"
    
    move_dict = {
    	'bbc one': {"source": None, "dest": None}, 
    	'bbc two': {"source": None, "dest": None},
    	'itv': {"source": None, "dest": None},
    	'channel 4': {"source": None, "dest": None},
    }
    
    if source in services and dest in services:
    	for key in move_dict.keys():
    		for service in range(101, 201) + range(801, 900):
    			if move_dict[key]["source"] is None and \
    				service in services[source]["video"] and \
    				services[source]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[source]["video"][service]["service_name"].lower().startswith(key) :
    				move_dict[key]["source"] = service
    			if move_dict[key]["dest"] is None and \
    				service in services[dest]["video"] and \
    				services[dest]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[dest]["video"][service]["service_name"].lower().startswith(key):
    				move_dict[key]["dest"] = service
    			if move_dict[key]["source"] and move_dict[key]["dest"]:
    				break
    
    for key in move_dict.keys():
    	if move_dict[key]["source"] and move_dict[key]["dest"]:
    		customised["video"][move_dict[key]["dest"]] = services[source]["video"][move_dict[key]["source"]]
    Last edited by Huevos; 24-06-19 at 23:42.

  2. The Following User Says Thank You to Huevos For This Useful Post:

    dsayers (25-06-19)

  3. #122
    Senior Member dsayers's Avatar

    Join Date
    Mar 2016
    Posts
    1,156
    Thanks
    315
    Thanked 387 Times in 276 Posts
    I think your getting close but it seems to add ITV2 HD to 1113

    Code:
    {'bbc one': {'dest': 108, 'source': 115}, 'itv': {'dest': 113, 'source': 118}, 'bbc two': {'dest': 102, 'source': 802}, 'channel 4': {'dest': 141, 'source': 138}}

  4. #123
    Moderator Huevos's Avatar

    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    8,321
    Thanks
    1,642
    Thanked 3,069 Times in 2,021 Posts
    Quote Originally Posted by dsayers View Post
    I think your getting close but it seems to add ITV2 HD to 1113

    Code:
    {'bbc one': {'dest': 108, 'source': 115}, 'itv': {'dest': 113, 'source': 118}, 'bbc two': {'dest': 102, 'source': 802}, 'channel 4': {'dest': 141, 'source': 138}}
    How can it add something at 1113? That is outside your range.
    Code:
    for service in range(101, 201) + range(801, 900)
    Also any channels you know that trip it up could be added to an avoid list.
    Code:
    source = "sat_282_sky_uk"
    dest = "cable_uk_virgin"
    
    move_dict = {
    	'bbc one': {"source": None, "dest": None}, 
    	'bbc two': {"source": None, "dest": None},
    	'itv': {"source": None, "dest": None},
    	'channel 4': {"source": None, "dest": None},
    }
    
    avoid_list = [ # lower case
    	"itv2 hd",
    ]
    
    if source in services and dest in services:
    	for key in move_dict.keys():
    		for service in range(101, 201) + range(801, 900):
    			if move_dict[key]["source"] is None and \
    				service in services[source]["video"] and \
    				services[source]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[source]["video"][service]["service_name"].lower().startswith(key) and \
    				services[source]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["source"] = service
    			if move_dict[key]["dest"] is None and \
    				service in services[dest]["video"] and \
    				services[dest]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[dest]["video"][service]["service_name"].lower().startswith(key) and \
    				services[dest]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["dest"] = service
    			if move_dict[key]["source"] and move_dict[key]["dest"]:
    				break
    
    for key in move_dict.keys():
    	if move_dict[key]["source"] and move_dict[key]["dest"]:
    		customised["video"][move_dict[key]["dest"]] = services[source]["video"][move_dict[key]["source"]]

  5. The Following User Says Thank You to Huevos For This Useful Post:

    dsayers (26-06-19)

  6. #124
    Moderator Huevos's Avatar

    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    8,321
    Thanks
    1,642
    Thanked 3,069 Times in 2,021 Posts
    TBH, the whole idea of matching by channel name is pretty fragile. Where SkyUK is the source you could be using "channel_id".

  7. #125
    Moderator abu baniaz's Avatar

    Join Date
    Sep 2010
    Location
    East London
    Posts
    18,807
    Thanks
    4,933
    Thanked 7,357 Times in 4,961 Posts
    Quote Originally Posted by Huevos View Post
    TBH, the whole idea of matching by channel name is pretty fragile. Where SkyUK is the source you could be using "channel_id".
    That is not going to work as the file is being used for more than one area

  8. #126
    Moderator Huevos's Avatar

    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    8,321
    Thanks
    1,642
    Thanked 3,069 Times in 2,021 Posts
    Quote Originally Posted by abu baniaz View Post
    That is not going to work as the file is being used for more than one area
    Should work because we are looking for the first instance. So you are just checking:
    Code:
    if channel_id in channel_id_list:

  9. #127
    Senior Member dsayers's Avatar

    Join Date
    Mar 2016
    Posts
    1,156
    Thanks
    315
    Thanked 387 Times in 276 Posts
    Quote Originally Posted by Huevos View Post
    How can it add something at 1113? That is outside your range.
    Code:
    for service in range(101, 201) + range(801, 900)
    Sorry that was a typo it added source 118 ITV2 HD TO 113.

    This maybe getting over complected as we have other regional names i.e STV.
    Last edited by dsayers; 25-06-19 at 18:07.

  10. #128
    Senior Member dsayers's Avatar

    Join Date
    Mar 2016
    Posts
    1,156
    Thanks
    315
    Thanked 387 Times in 276 Posts
    Quote Originally Posted by Huevos View Post
    Also any channels you know that trip it up could be added to an avoid list.
    Code:
    source = "sat_282_sky_uk"
    dest = "cable_uk_virgin"
    
    move_dict = {
    	'bbc one': {"source": None, "dest": None}, 
    	'bbc two': {"source": None, "dest": None},
    	'itv': {"source": None, "dest": None},
    	'channel 4': {"source": None, "dest": None},
    }
    
    avoid_list = [ # lower case
    	"itv2 hd",
    ]
    
    if source in services and dest in services:
    	for key in move_dict.keys():
    		for service in range(101, 201) + range(801, 900):
    			if move_dict[key]["source"] is None and \
    				service in services[source]["video"] and \
    				services[source]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[source]["video"][service]["service_name"].lower().startswith(key) and \
    				services[source]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["source"] = service
    			if move_dict[key]["dest"] is None and \
    				service in services[dest]["video"] and \
    				services[dest]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[dest]["video"][service]["service_name"].lower().startswith(key) and \
    				services[dest]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["dest"] = service
    			if move_dict[key]["source"] and move_dict[key]["dest"]:
    				break
    
    for key in move_dict.keys():
    	if move_dict[key]["source"] and move_dict[key]["dest"]:
    		customised["video"][move_dict[key]["dest"]] = services[source]["video"][move_dict[key]["source"]]
    I had to add

    avoid_list = [ # lower case
    "itv2 hd",
    "itv3 hd",
    "itv4 hd",
    ]

    So now I have

    Code:
    source = "sat_282_sky_uk"
    dest = "cable_uk_virgin"
    
    move_dict = {
    	'bbc one': {"source": None, "dest": None}, 
    	'bbc two': {"source": None, "dest": None},
    	'itv': {"source": None, "dest": None},
    	'channel 4': {"source": None, "dest": None},
    }
    
    avoid_list = [ # lower case
    	"itv2 hd",
    	"itv3 hd",
    	"itv4 hd",
    ]
    
    if source in services and dest in services:
    	for key in move_dict.keys():
    		for service in range(101, 201) + range(801, 900):
    			if move_dict[key]["source"] is None and \
    				service in services[source]["video"] and \
    				services[source]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[source]["video"][service]["service_name"].lower().startswith(key) and \
    				services[source]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["source"] = service
    			if move_dict[key]["dest"] is None and \
    				service in services[dest]["video"] and \
    				services[dest]["video"][service]["service_type"] in DvbScanner.HD_ALLOWED_TYPES and \
    				services[dest]["video"][service]["service_name"].lower().startswith(key) and \
    				services[dest]["video"][service]["service_name"].lower() not in avoid_list:
    				move_dict[key]["dest"] = service
    			if move_dict[key]["source"] and move_dict[key]["dest"]:
    				break
    
    for key in move_dict.keys():
    	if move_dict[key]["source"] and move_dict[key]["dest"]:
    		customised["video"][move_dict[key]["dest"]] = services[source]["video"][move_dict[key]["source"]]

  11. #129
    Moderator Huevos's Avatar

    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    8,321
    Thanks
    1,642
    Thanked 3,069 Times in 2,021 Posts
    No, it is not over complicated. You just add "stv" or "utv" to your move dict. Then if you are in Scotland and your cable has "STV" and you pick Sky Scotland, it will do the swap.

    Main point is to try to write an algorithm that works fo all cases. That way you can just make changes to the dict to add new channels.
    Last edited by Huevos; 25-06-19 at 18:36.

  12. The Following 2 Users Say Thank You to Huevos For This Useful Post:

    Andy_Hazza (26-06-19),dsayers (25-06-19)

  13. #130
    Senior Member dsayers's Avatar

    Join Date
    Mar 2016
    Posts
    1,156
    Thanks
    315
    Thanked 387 Times in 276 Posts
    Changes made here for regional issues thanks to @Huevos https://github.com/davesayers2014/Cu...64c8de8f427d8e users please report any issues and ill try to amend as soon as possible. Thanks

  14. The Following 2 Users Say Thank You to dsayers For This Useful Post:

    Andy_Hazza (26-06-19),Ashley69 (26-06-19)

Page 9 of 9 FirstFirst ... 789

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.