test filmontv
This commit is contained in:
+97
-87
@@ -54,13 +54,13 @@ def getEpg():
|
|||||||
# inmemory = io.BytesIO(httptools.downloadpage(host).data)
|
# inmemory = io.BytesIO(httptools.downloadpage(host).data)
|
||||||
downloadtools.downloadfile(host, archiveName)
|
downloadtools.downloadfile(host, archiveName)
|
||||||
support.log('opening gzip and writing xml')
|
support.log('opening gzip and writing xml')
|
||||||
fStream = gzip.GzipFile(archiveName, mode='rb')
|
fStream = gzip.GzipFile(archiveName, mode='rb')
|
||||||
guide = fStream.read()
|
# guide = fStream.read()
|
||||||
with open(xmlName, 'w') as f:
|
# with open(xmlName, 'w') as f:
|
||||||
f.write(guide)
|
# f.write(guide)
|
||||||
else:
|
# else:
|
||||||
guide = open(xmlName).read()
|
# guide = open(xmlName).read()
|
||||||
return guide
|
return fStream
|
||||||
|
|
||||||
|
|
||||||
def category(item):
|
def category(item):
|
||||||
@@ -90,76 +90,79 @@ def peliculas(item, f=None, ):
|
|||||||
country = ''
|
country = ''
|
||||||
skip = False
|
skip = False
|
||||||
|
|
||||||
for i, line in enumerate(f.splitlines()):
|
f.seek(pag)
|
||||||
if i >= pag:
|
line = True
|
||||||
if '<programme' in line:
|
while line:
|
||||||
channel = scrapertools.find_single_match(line, r'channel="([^"]+)"')
|
line = f.readline()
|
||||||
if channel not in lCanali:
|
if '<programme' in line:
|
||||||
skip = True
|
channel = scrapertools.find_single_match(line, r'channel="([^"]+)"')
|
||||||
elif '<title' in line:
|
if channel not in lCanali:
|
||||||
title = scrapertools.find_single_match(line, r'>([^<]+?)(?: - 1\s*\^\s*TV)?<')
|
skip = True
|
||||||
if title in titles:
|
elif '<title' in line:
|
||||||
skip = True
|
title = scrapertools.find_single_match(line, r'>([^<]+?)(?: - 1\s*\^\s*TV)?<')
|
||||||
elif not skip and '<desc' in line:
|
if title in titles:
|
||||||
plot = scrapertools.find_single_match(line, r'>([^<]+)<')
|
skip = True
|
||||||
elif not skip and '<actor' in line:
|
elif not skip and '<desc' in line:
|
||||||
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
|
plot = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
actors.append([match[1], match[0]])
|
elif not skip and '<actor' in line:
|
||||||
elif not skip and '<director' in line:
|
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
|
||||||
director = scrapertools.find_single_match(line, r'>([^<]+)<')
|
actors.append([match[1], match[0]])
|
||||||
elif not skip and '<date' in line:
|
elif not skip and '<director' in line:
|
||||||
year = scrapertools.find_single_match(line, r'>([^<]+)<')
|
director = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif not skip and '<category' in line:
|
elif not skip and '<date' in line:
|
||||||
genres.append(scrapertools.find_single_match(line, r'>([^<]+)<'))
|
year = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif not skip and '<country' in line:
|
elif not skip and '<category' in line:
|
||||||
country = scrapertools.find_single_match(line, r'>([^<]+)<')
|
genres.append(scrapertools.find_single_match(line, r'>([^<]+)<'))
|
||||||
elif not skip and '<episode-num' in line:
|
elif not skip and '<country' in line:
|
||||||
episode = scrapertools.find_single_match(line, r'>([^<]+)<')
|
country = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
if item.contentType == 'movie':
|
elif not skip and '<episode-num' in line:
|
||||||
skip = True
|
episode = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif not skip and '<icon' in line:
|
if item.contentType == 'movie':
|
||||||
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
|
skip = True
|
||||||
elif '</programme' in line:
|
elif not skip and '<icon' in line:
|
||||||
if not skip and (actors or 'Film' in genres):
|
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
|
||||||
titles.append(title)
|
elif '</programme' in line:
|
||||||
if (item.contentType == 'movie' and (item.category in genres or item.all==True)) or (item.contentType == 'tvshow'):
|
if not skip and (actors or 'Film' in genres):
|
||||||
itemlist.append(Item(
|
titles.append(title)
|
||||||
channel=item.channel,
|
if (item.contentType == 'movie' and (item.category in genres or item.all==True)) or (item.contentType == 'tvshow' and episode):
|
||||||
action='new_search',
|
itemlist.append(Item(
|
||||||
title=support.typo(title + (' - ' + episode if episode else ''), 'bold'),
|
channel=item.channel,
|
||||||
fulltitle=title,
|
action='new_search',
|
||||||
search_text=title,
|
title=support.typo(title + (' - ' + episode if episode else ''), 'bold'),
|
||||||
mode=item.contentType,
|
fulltitle=title,
|
||||||
thumbnail=thumbnail if thumbnail else item.thumbnail,
|
search_text=title,
|
||||||
contentType=item.contentType,
|
mode=item.contentType,
|
||||||
channel_name=channel,
|
thumbnail=thumbnail if thumbnail else item.thumbnail,
|
||||||
infoLabels={
|
contentType=item.contentType,
|
||||||
'title': title,
|
channel_name=channel,
|
||||||
'plot': plot,
|
infoLabels={
|
||||||
'castandrole': actors,
|
'title': title,
|
||||||
'director': director,
|
'plot': plot,
|
||||||
'genre': genres,
|
'castandrole': actors,
|
||||||
'country': country,
|
'director': director,
|
||||||
'year': year
|
'genre': genres,
|
||||||
}
|
'country': country,
|
||||||
))
|
'year': year
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
channel = ''
|
channel = ''
|
||||||
title = ''
|
title = ''
|
||||||
episode = ''
|
episode = ''
|
||||||
plot = ''
|
plot = ''
|
||||||
thumbnail = ''
|
thumbnail = ''
|
||||||
actors = []
|
actors = []
|
||||||
director = ''
|
director = ''
|
||||||
year = ''
|
year = ''
|
||||||
genres = []
|
genres = []
|
||||||
country = ''
|
country = ''
|
||||||
skip = False
|
skip = False
|
||||||
|
|
||||||
if len(itemlist) >= 40:
|
if len(itemlist) >= 40:
|
||||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), pag= i + 1, thumbnail=support.thumb(), lastTitle=titles[-1]))
|
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), pag= f.tell(), thumbnail=support.thumb(), lastTitle=titles[-1]))
|
||||||
break
|
break
|
||||||
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
|
f.close()
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
def listaCanali(item):
|
def listaCanali(item):
|
||||||
@@ -167,8 +170,9 @@ def listaCanali(item):
|
|||||||
f = getEpg()
|
f = getEpg()
|
||||||
thumbnail = None
|
thumbnail = None
|
||||||
skip = False
|
skip = False
|
||||||
|
line = True
|
||||||
for line in f.splitlines():
|
while line:
|
||||||
|
line = f.readline()
|
||||||
if '<channel' in line:
|
if '<channel' in line:
|
||||||
channel = scrapertools.find_single_match(line, r'id="([^"]+)"')
|
channel = scrapertools.find_single_match(line, r'id="([^"]+)"')
|
||||||
if channel not in lCanali:
|
if channel not in lCanali:
|
||||||
@@ -214,31 +218,36 @@ def guidatv(item):
|
|||||||
country = ''
|
country = ''
|
||||||
start = ''
|
start = ''
|
||||||
stop = ''
|
stop = ''
|
||||||
|
skip = False
|
||||||
|
|
||||||
for line in f.splitlines():
|
line = True
|
||||||
|
while line:
|
||||||
|
line = f.readline()
|
||||||
if '<programme' in line:
|
if '<programme' in line:
|
||||||
start, stop, channel = scrapertools.find_single_match(line,r'start="([^"]*)" stop="([^"]*)" channel="([^"]+)"')
|
start, stop, channel = scrapertools.find_single_match(line,r'start="([^"]*)" stop="([^"]*)" channel="([^"]+)"')
|
||||||
elif '<title' in line:
|
if channel != item.channelName:
|
||||||
|
skip = True
|
||||||
|
elif not skip and '<title' in line:
|
||||||
title = scrapertools.find_single_match(line, r'>([^<]+?)<')
|
title = scrapertools.find_single_match(line, r'>([^<]+?)<')
|
||||||
elif '<desc' in line:
|
elif not skip and '<desc' in line:
|
||||||
plot = scrapertools.find_single_match(line, r'>([^<]+)<')
|
plot = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif '<actor' in line:
|
elif not skip and '<actor' in line:
|
||||||
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
|
match = scrapertools.find_single_match(line, r'(?:role="([^"]*)")?>([^<]+)<')
|
||||||
actors.append([match[1], match[0]])
|
actors.append([match[1], match[0]])
|
||||||
elif '<director' in line:
|
elif not skip and '<director' in line:
|
||||||
director = scrapertools.find_single_match(line, r'>([^<]+)<')
|
director = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif '<date' in line:
|
elif not skip and '<date' in line:
|
||||||
year = scrapertools.find_single_match(line, r'>([^<]+)<')
|
year = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif '<category' in line:
|
elif not skip and '<category' in line:
|
||||||
genres.append(scrapertools.find_single_match(line, r'>([^<]+)<'))
|
genres.append(scrapertools.find_single_match(line, r'>([^<]+)<'))
|
||||||
elif '<country' in line:
|
elif not skip and '<country' in line:
|
||||||
country = scrapertools.find_single_match(line, r'>([^<]+)<')
|
country = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif '<episode-num' in line:
|
elif not skip and '<episode-num' in line:
|
||||||
episode = scrapertools.find_single_match(line, r'>([^<]+)<')
|
episode = scrapertools.find_single_match(line, r'>([^<]+)<')
|
||||||
elif '<icon' in line:
|
elif not skip and '<icon' in line:
|
||||||
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
|
thumbnail = scrapertools.find_single_match(line, r'src="([^"]+)"')
|
||||||
elif '</programme' in line:
|
elif '</programme' in line:
|
||||||
if item.channelName in channel:
|
if not skip:
|
||||||
start = time.strptime(str(int(start.split(' ')[0]) + int(start.split('+')[1])), '%Y%m%d%H%M%S')
|
start = time.strptime(str(int(start.split(' ')[0]) + int(start.split('+')[1])), '%Y%m%d%H%M%S')
|
||||||
stop = time.strptime(str(int(stop.split(' ')[0]) + int(stop.split('+')[1])), '%Y%m%d%H%M%S')
|
stop = time.strptime(str(int(stop.split(' ')[0]) + int(stop.split('+')[1])), '%Y%m%d%H%M%S')
|
||||||
duration = days[start.tm_wday] + ' alle ' + str(start.tm_hour).zfill(2) + ':' + str(start.tm_min).zfill(2) + ' - ' + str(stop.tm_hour).zfill(2) + ':' + str(stop.tm_min).zfill(2) + ' - '
|
duration = days[start.tm_wday] + ' alle ' + str(start.tm_hour).zfill(2) + ':' + str(start.tm_min).zfill(2) + ' - ' + str(stop.tm_hour).zfill(2) + ':' + str(stop.tm_min).zfill(2) + ' - '
|
||||||
@@ -275,6 +284,7 @@ def guidatv(item):
|
|||||||
country = ''
|
country = ''
|
||||||
start = ''
|
start = ''
|
||||||
stop = ''
|
stop = ''
|
||||||
|
skip = False
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user