From 4d061f6645dbbf5ba1dd199e8d17d5c44158e56a Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 31 Jul 2020 18:17:24 +0200 Subject: [PATCH 1/3] fix login su HDmario --- platformcode/xbmc_config_menu.py | 2 +- servers/hdmario.json | 4 ++-- servers/hdmario.py | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platformcode/xbmc_config_menu.py b/platformcode/xbmc_config_menu.py index 37a557fb..c7d91adf 100644 --- a/platformcode/xbmc_config_menu.py +++ b/platformcode/xbmc_config_menu.py @@ -171,7 +171,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): if not self.list_controls: # If the channel path is in the "channels" folder, we get the controls and values using chaneltools - if os.path.join(config.get_runtime_path(), "channels") or os.path.join(config.get_runtime_path(), "specials") in channelpath: + if os.path.join(config.get_runtime_path(), "channels") in channelpath or os.path.join(config.get_runtime_path(), "specials") in channelpath: # The call is made from a channel self.list_controls, default_values = channeltools.get_channel_controls_settings(self.channel) diff --git a/servers/hdmario.json b/servers/hdmario.json index 6165244b..bb80a103 100644 --- a/servers/hdmario.json +++ b/servers/hdmario.json @@ -40,8 +40,8 @@ { "default": "", "enabled": true, - "id": "email", - "label": "email", + "id": "username", + "label": "username", "type": "text", "visible": true }, diff --git a/servers/hdmario.py b/servers/hdmario.py index 253f04ad..27bb27e9 100644 --- a/servers/hdmario.py +++ b/servers/hdmario.py @@ -52,8 +52,6 @@ def registerOrLogin(page_url, forced=False): 'password': randPsw, 'password_confirmation': randPsw}).url if rq: - from core import support - support.dbg() config.set_setting('username', randEmail, server='hdmario') config.set_setting('password', randPsw, server='hdmario') platformtools.dialog_ok('HDmario', From 20d099fcb9580ad99f9dd9722909547e17988c1d Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 31 Jul 2020 21:01:00 +0200 Subject: [PATCH 2/3] fix tests --- tests/test_generic.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_generic.py b/tests/test_generic.py index 3096774d..c9cd00c9 100644 --- a/tests/test_generic.py +++ b/tests/test_generic.py @@ -132,7 +132,7 @@ chNumRis = { servers = [] channels = [] -channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] +channel_list = channelselector.filterchannels("all")[:4] if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] ret = [] for chItem in channel_list: try: @@ -177,7 +177,7 @@ for chItem in channel_list: from specials import news dictNewsChannels, any_active = news.get_channels_list() - +print channels # only 1 server item for single server serverNames = [] serversFinal = [] @@ -208,31 +208,31 @@ class GenericChannelTest(unittest.TestCase): class GenericChannelMenuItemTest(unittest.TestCase): def test_menu(self): print 'testing ' + self.ch + ' --> ' + self.title - self.assertTrue(itemlist, 'channel ' + self.ch + ' -> ' + self.title + ' is empty') + self.assertTrue(self.itemlist, 'channel ' + self.ch + ' -> ' + self.title + ' is empty') self.assertTrue(self.serversFound, 'channel ' + self.ch + ' -> ' + self.title + ' has no servers on all results') if self.ch in chNumRis: # i know how much results should be for content in chNumRis[self.ch]: if content in self.title: - risNum = len([i for i in itemlist if not i.nextPage]) # not count nextpage + risNum = len([i for i in self.itemlist if not i.nextPage]) # not count nextpage self.assertEqual(chNumRis[self.ch][content], risNum, - 'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results\n' - + str(chNumRis[self.ch][content]) + ' but should be ' + str(risNum) + '\n' + - '\n'.join([i.title for i in itemlist if not i.nextPage])) + 'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results
' + + str(risNum) + ' but should be ' + str(chNumRis[self.ch][content]) + '
' + + '
'.join([i.title for i in self.itemlist if not i.nextPage])) break - for resIt in itemlist: + for resIt in self.itemlist: print resIt.title + ' -> ' + resIt.url self.assertLess(len(resIt.fulltitle), 110, - 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong titles\n' + resIt.fulltitle) + 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong titles
' + resIt.fulltitle) if resIt.url: self.assertIsInstance(resIt.url, str, 'channel ' + self.ch + ' -> ' + self.title + ' -> ' + resIt.title + ' contain non-string url') self.assertIsNotNone(re.match(validUrlRegex, resIt.url), - 'channel ' + self.ch + ' -> ' + self.title + ' -> ' + resIt.title + ' might contain wrong url\n' + resIt.url) + 'channel ' + self.ch + ' -> ' + self.title + ' -> ' + resIt.title + ' might contain wrong url
' + resIt.url) if 'year' in resIt.infoLabels and resIt.infoLabels['year']: - msgYear = 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong infolabels year\n' + str( + msgYear = 'channel ' + self.ch + ' -> ' + self.title + ' might contain wrong infolabels year
' + str( resIt.infoLabels['year']) self.assert_(type(resIt.infoLabels['year']) is int or resIt.infoLabels['year'].isdigit(), msgYear) @@ -244,7 +244,7 @@ class GenericChannelMenuItemTest(unittest.TestCase): self.assertTrue(nextPageItemlist, 'channel ' + self.ch + ' -> ' + self.title + ' has nextpage not working') - print '\ntest passed' + print '
test passed' @parameterized.parameterized_class(serversFinal) @@ -282,7 +282,7 @@ class GenericServerTest(unittest.TestCase): contentType = page.headers['Content-Type'] self.assert_(contentType.startswith( 'video') or 'mpegurl' in contentType or 'octet-stream' in contentType or 'dash+xml' in contentType, - self.name + ' scraper did not return valid url for link ' + page_url + '\nDirect url: ' + directUrl + '\nContent-Type: ' + contentType) + self.name + ' scraper did not return valid url for link ' + page_url + '
Direct url: ' + directUrl + '
Content-Type: ' + contentType) except: import traceback logger.error(traceback.format_exc()) From 12bdf02770be9af43fb7c333a94887bcf0025324 Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 31 Jul 2020 22:22:21 +0200 Subject: [PATCH 3/3] migliorie test --- channels/altadefinizioneclick.py | 3 +-- platformcode/logger.py | 2 +- tests/test_generic.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index 62040288..633ba333 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -22,7 +22,7 @@ from core.item import Item from platformcode import config def findhost(): - data = support.httptools.downloadpage('https://altadefinizione-nuovo.info/').data + data = support.httptools.downloadpage('https://altadefinizione-nuovo.me/').data host = support.scrapertools.find_single_match(data, '