diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index c9fc0a95..d565123f 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -4,7 +4,7 @@ # by Greko # ------------------------------------------------------------ -from core import httptools, support +from core import support from core.item import Item # def findhost(url): @@ -99,4 +99,10 @@ def newest(categoria): def findvideos(item): support.info() - return support.server(item, item.other) + itemlist = support.server(item, item.other) + # testo che tutti i link siano stati risolti + if support.logger.testMode: + if len(itemlist) < len(support.match(item.other, patron=' ' + it.title + ' --> ' + resIt.title - servers.append({'name': srv.server.lower(), 'server': srv}) - break - except: + if srv.server: + srv.foundOn = ch + ' --> ' + it.title + ' --> ' + resIt.title + servers.append({'name': srv.server.lower(), 'server': srv}) + break + menuItemlist[it.title] = itemlist + except Exception as ex: import traceback - logger.error(traceback.format_exc()) + menuItemlist[it.title] = { + 'traceback': traceback.format_exc(), + 'exception': ex + } logMenu[it.title] = logger.recordedLog logger.recordedLog = '' @@ -220,9 +228,9 @@ for chItem in channel_list: # 'menuItemlist': {k: [it.tojson() if type(it) == Item else it for it in menuItemlist[k]] for k in menuItemlist.keys()}, # 'serversFound': {k: [it.tojson() if type(it) == Item else it for it in menuItemlist[k]] for k in menuItemlist.keys()}, # 'module': str(module), 'logMenu': logMenu, 'error': error}) - channels.append( - {'ch': ch, 'hasChannelConfig': hasChannelConfig, 'mainlist': mainlist, 'menuItemlist': menuItemlist, - 'serversFound': serversFound, 'module': module, 'logMenu': logMenu, 'error': error}) + channels.append({'ch': ch, 'hasChannelConfig': hasChannelConfig, 'mainlist': mainlist, + 'menuItemlist': menuItemlist, 'serversFound': serversFound, 'module': module, + 'logMenu': logMenu, 'error': error}) logger.record = False @@ -276,6 +284,10 @@ class GenericChannelMenuItemTest(unittest.TestCase): print('testing ' + self.ch + ' --> ' + self.title) logger.info(self.log) + # returned an error + if type(self.itemlist) == dict and self.itemlist['exception']: + logger.error(self.itemlist['traceback']) + raise self.itemlist['exception'] self.assertTrue(self.module.host, 'channel ' + self.ch + ' has not a valid hostname') self.assertTrue(self.itemlist, 'channel ' + self.ch + ' -> ' + self.title + ' is empty') @@ -286,10 +298,11 @@ class GenericChannelMenuItemTest(unittest.TestCase): for content in chNumRis[self.ch]: if content in self.title: risNum = len([i for i in self.itemlist if i.title != typo(config.get_localized_string(30992), 'color kod bold')]) # not count nextpage - self.assertEqual(chNumRis[self.ch][content], risNum, - 'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results
' - + str(risNum) + ' but should be ' + str(chNumRis[self.ch][content]) + '
' + - '
'.join([html.escape(i.title) for i in self.itemlist if not i.nextPage])) + if 'Search' not in self.title: + self.assertEqual(chNumRis[self.ch][content], risNum, + 'channel ' + self.ch + ' -> ' + self.title + ' returned wrong number of results
' + + str(risNum) + ' but should be ' + str(chNumRis[self.ch][content]) + '
' + + '
'.join([html.escape(i.title) for i in self.itemlist if not i.nextPage])) break for resIt in self.itemlist: @@ -319,7 +332,7 @@ class GenericServerTest(unittest.TestCase): def test_get_video_url(self): module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name]) page_url = self.server.url - httptools.default_headers['Referer'] = self.server.referer + # httptools.default_headers['Referer'] = self.server.referer print('testing ' + page_url) print('Found on ' + self.server.foundOn) print()