migliorie test, possibile fix adesso in onda

This commit is contained in:
marco
2020-07-15 23:01:54 +02:00
parent bafa08166f
commit 46101d972b
6 changed files with 74 additions and 72 deletions
+2 -2
View File
@@ -37,13 +37,13 @@ def download(item=None):
def extract():
import zipfile
from platformcode.updater import fixZipGetHash, fOpen
from platformcode.updater import fixZipGetHash
support.log('Estraggo Elementum in:', elementum_path)
try:
hash = fixZipGetHash(filename)
support.log(hash)
with zipfile.ZipFile(fOpen(filename, 'rb')) as zip_ref:
with zipfile.ZipFile(filetools.file_open(filename, 'rb', vfs=False)) as zip_ref:
zip_ref.extractall(xbmc.translatePath(addon_path))
except Exception as e:
+3 -4
View File
@@ -6,7 +6,6 @@ from datetime import datetime
import glob, time, gzip, xbmc
from core import filetools, downloadtools, support, scrapertools
from core.item import Item
from platformcode import logger
host = "http://epg-guide.com/kltv.gz"
blacklisted_genres = ['attualita', 'scienza', 'religione', 'cucina', 'notiziario', 'altro', 'soap opera', 'viaggi', 'economia', 'tecnologia', 'magazine', 'show', 'reality show', 'lifestyle', 'societa', 'wrestling', 'azione', 'Musica', 'real life', 'real adventure', 'dplay original', 'natura', 'news', 'food', 'sport', 'moda', 'arte e cultura', 'crime', 'box set e serie tv', 'casa', 'storia', 'talk show', 'motori', 'attualit\xc3\xa0 e inchiesta', 'documentari', 'musica', 'spettacolo', 'medical', 'talent show', 'sex and love', 'beauty and style', 'news/current affairs', "children's/youth programmes", 'leisure hobbies', 'social/political issues/economics', 'education/science/factual topics', 'undefined content', 'show/game show', 'music/ballet/dance', 'sports', 'arts/culture', 'biografico', 'informazione', 'documentario']
@@ -28,7 +27,7 @@ def getEpg():
fileName = support.config.get_temp_file('guidatv-') + now.strftime('%Y %m %d')
archiveName = fileName + '.gz'
xmlName = fileName + '.xml'
if not filetools.exists(archiveName):
if not filetools.exists(xmlName):
support.log('downloading epg')
# cancello quelli vecchi
for f in glob.glob(support.config.get_temp_file('guidatv-') + '*'):
@@ -36,8 +35,8 @@ def getEpg():
# inmemory = io.BytesIO(httptools.downloadpage(host).data)
downloadtools.downloadfile(host, archiveName)
support.log('opening gzip and writing xml')
fStream = gzip.GzipFile(archiveName, mode='rb')
guide = fStream.read().replace('\n', ' ').replace('><', '>\n<')
with gzip.GzipFile(fileobj=filetools.file_open(archiveName, mode='rb', vfs=False)) as f:
guide = f.read().replace('\n', ' ').replace('><', '>\n<')
with open(xmlName, 'w') as f:
f.write(guide)
# else: