Skip to content

Commit

Permalink
update to Kodi 19 Matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Dec 28, 2020
1 parent e3e8c02 commit f12be55
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
14 changes: 7 additions & 7 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.zappntv" name="Zappn TV" version="1.3.4" provider-name="fayer3">
<addon id="plugin.video.zappntv" name="Zappn TV" version="1.3.4+matrix.1" provider-name="fayer3">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.routing" version="0.2.0"/>
<import addon="script.module.inputstreamhelper" version="0.3.5"/>
<import addon="script.module.pytz" version="2014.2"/>
<import addon="script.module.tzlocal" version="2.0.0"/>
<import addon="script.module.html2text" version="2015.6.21"/>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.routing" version="0.2.3+matrix.1"/>
<import addon="script.module.inputstreamhelper" version="0.5.2+matrix.1"/>
<import addon="script.module.pytz" version="2019.3.0+matrix.1"/>
<import addon="script.module.tzlocal" version="2.0.0+matrix.1"/>
<import addon="script.module.html2text" version="2020.1.16+matrix.1"/>
</requires>
<extension point="xbmc.python.pluginsource" library="main.py">
<provides>video</provides>
Expand Down
2 changes: 1 addition & 1 deletion favorite.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def log(info):
logger = logging.getLogger(xbmcaddon.Addon().getAddonInfo('id'))
kodilogging.config()

__profile__ = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
__profile__ = xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))

if not xbmcvfs.exists(__profile__):
xbmcvfs.mkdirs(__profile__)
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
logger = logging.getLogger(xbmcaddon.Addon().getAddonInfo(u'id'))

__profile__ = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo(u'profile'))
__profile__ = xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo(u'profile'))

if not xbmcvfs.exists(__profile__):
xbmcvfs.mkdirs(__profile__)
Expand Down
37 changes: 15 additions & 22 deletions resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,12 @@
except ImportError:
inputstream = False

try:
from StringIO import StringIO
except ImportError:
from io import BytesIO as StringIO
from io import BytesIO

try:
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
from urllib.parse import quote, unquote, urlparse, parse_qs, urlencode
except ImportError:
from urllib import quote, unquote, urlencode
from urllib2 import Request, urlopen, HTTPError, URLError
from urlparse import urlparse, parse_qs

from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
from urllib.parse import quote, unquote, urlparse, parse_qs, urlencode

try:
from multiprocessing.pool import ThreadPool
Expand All @@ -61,7 +54,7 @@
kodilogging.config()
plugin = routing.Plugin()

__profile__ = xbmc.translatePath(ADDON.getAddonInfo('profile'))
__profile__ = xbmcvfs.translatePath(ADDON.getAddonInfo('profile'))

if not xbmcvfs.exists(__profile__):
xbmcvfs.mkdirs(__profile__)
Expand Down Expand Up @@ -411,7 +404,7 @@ def show_mediathek_genre():
if 'data' in ui and ui['data'] != None and 'source' in ui['data'] and ui['data']['source'] != None:
query_source = get_query(ui['data']['source'])
if 'url' in query_source:
query = get_query(base64.b64decode(query_source['url'][0]).decode('WINDOWS-1252').encode('UTF-8'))
query = get_query(base64.b64decode(query_source['url'][0]).decode('WINDOWS-1252'))
if not 'genres' in query:
continue
if 'type' in query:
Expand All @@ -433,7 +426,7 @@ def show_mediathek_channel():
if 'data' in ui and ui['data'] != None and 'source' in ui['data'] and ui['data']['source'] != None:
query_source = get_query(ui['data']['source'])
if 'url' in query_source:
query = get_query(base64.b64decode(query_source['url'][0]).decode('WINDOWS-1252').encode('UTF-8'))
query = get_query(base64.b64decode(query_source['url'][0]).decode('WINDOWS-1252'))
if not 'channelId' in query:
continue
icon = get_channel_icon(query['channelId'][0])
Expand Down Expand Up @@ -511,7 +504,7 @@ def add_tvshows(add_query, sub_page = '', show_channel = False, limit = ids.api_
listitem.setArt({'icon': icon, 'thumb': thumb, 'poster': poster, 'fanart' : fanart})

plot = ''
log(tvshow['titles']['default'])
#log(tvshow['titles']['default'])
html = html2text.HTML2Text()
html.body_width = 0
if 'descriptions' in tvshow and tvshow['descriptions']['default'] and tvshow['descriptions']['default'] != None:
Expand Down Expand Up @@ -608,8 +601,8 @@ def show_tvshow_videos(id, category_query):
else:
cast.append(person['name'])

log(cast)
log(director)
#log(cast)
#log(director)
if 'visibilities' in video and video['visibilities'] != None and len(video['visibilities']) > 0:
start = None
end = None
Expand Down Expand Up @@ -670,7 +663,7 @@ def show_tvshow_videos(id, category_query):
if season != -1 or episode != -1:
video['mediatype'] = 'episode'

log('Title: '+video['titles']['default'])
#log('Title: '+video['titles']['default'])
listitem = ListItem(video['titles']['default'])

if len(video['images']) > 0:
Expand Down Expand Up @@ -745,7 +738,7 @@ def play_livestream(livestream_id):
setResolvedUrl(plugin.handle, False, ListItem(label='none'))
else:
playitem = ListItem(label=xbmc.getInfoLabel('Container.ShowTitle'), path=urls['urls']['dash'][drm_name]['url']+'|User-Agent=' + ids.user_agent_live)
playitem.setProperty('inputstreamaddon', is_helper.inputstream_addon)
playitem.setProperty('inputstream', is_helper.inputstream_addon)
playitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
playitem.setProperty('inputstream.adaptive.license_type', drm)
playitem.setProperty('inputstream.adaptive.manifest_update_parameter', 'full')
Expand Down Expand Up @@ -843,7 +836,7 @@ def play_video(video_id, channel='', disable_old_format=False):
setResolvedUrl(plugin.handle, False, ListItem(label='none'))
else:
playitem = ListItem(label=xbmc.getInfoLabel('Container.ShowTitle'), path=data['video_url']+'|User-Agent=' + ids.user_agent_video)
playitem.setProperty('inputstreamaddon', is_helper.inputstream_addon)
playitem.setProperty('inputstream', is_helper.inputstream_addon)
playitem.setProperty('inputstream.adaptive.manifest_type', data['protocol'])
if data['protected']:
log('license url: {0}?token={1}'.format(data['license_url'], data['license_token']))
Expand Down Expand Up @@ -1185,7 +1178,7 @@ def get_url(url, headers={}, cache=False, critical=False):

if request.info().get('Content-Encoding') == 'gzip':
# decompress content
buffer = StringIO(request.read())
buffer = BytesIO(request.read())
deflatedContent = gzip.GzipFile(fileobj=buffer)
data = deflatedContent.read().decode('utf-8')
else:
Expand Down

0 comments on commit f12be55

Please sign in to comment.