This commit is contained in:
Alhaziel01
2020-08-03 09:21:28 +02:00
6 changed files with 18 additions and 20 deletions

View File

@@ -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, '<div class="elementor-button-wrapper"> <a href="([^"]+)"')
return host
@@ -30,7 +30,6 @@ host = config.get_channel_url(findhost)
headers = [['Referer', host]]
@support.menu
def mainlist(item):
film = ['',

View File

@@ -45,7 +45,7 @@ def encode_log(message=""):
message = str(message)
if testMode:
message = cgi.escape(message)
message = cgi.escape(message).replace('\n', '<br>')
return message

View File

@@ -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)

View File

@@ -40,8 +40,8 @@
{
"default": "",
"enabled": true,
"id": "email",
"label": "email",
"id": "username",
"label": "username",
"type": "text",
"visible": true
},

View File

@@ -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',

View File

@@ -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,32 @@ 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.module.host, 'channel ' + self.ch + ' has not a valid hostname')
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<br>'
+ str(risNum) + ' but should be ' + str(chNumRis[self.ch][content]) + '<br>' +
'<br>'.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<br>' + 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<br>' + 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<br>' + str(
resIt.infoLabels['year'])
self.assert_(type(resIt.infoLabels['year']) is int or resIt.infoLabels['year'].isdigit(),
msgYear)
@@ -244,7 +245,7 @@ class GenericChannelMenuItemTest(unittest.TestCase):
self.assertTrue(nextPageItemlist,
'channel ' + self.ch + ' -> ' + self.title + ' has nextpage not working')
print '\ntest passed'
print '<br>test passed'
@parameterized.parameterized_class(serversFinal)
@@ -282,7 +283,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 + '<br>Direct url: ' + directUrl + '<br>Content-Type: ' + contentType)
except:
import traceback
logger.error(traceback.format_exc())