Skip to content

Commit

Permalink
fix limit of 25 tvshows
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Jul 29, 2019
1 parent 9e951d8 commit 292fbae
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
4 changes: 2 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.joyn_app" name="Joyn" version="0.1.0" provider-name="fayer3">
<addon id="plugin.video.joyn_app" name="Joyn" version="0.1.1" provider-name="fayer3">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.routing" version="0.2.0"/>
Expand All @@ -22,7 +22,7 @@
<website>https://joyn.de/</website>
<email>fb4472 (at) aon.at</email>
<source>https://github.com/fayer3/plugin.video.zappntv</source>
<news>erster Release</news>
<news>Limit von nur 25 Sendungen behoben</news>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.png</fanart>
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ v0.0.1
- Initial version
v0.1.0
- First Release
v0.1.1
- fix limit of 25 tvshows
3 changes: 2 additions & 1 deletion resources/lib/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
#tvshow_selection = '&limit=1&subType=Hauptfilm&selection={data{id,channelId,visibilities,duration,metadata{de}}}&filter=visible&type=tvShow'
tvshow_selection = '&limit=1&subType=Hauptfilm&selection=%7Bdata%7Bid%2CchannelId%2Cvisibilities%2Cduration%2Cmetadata%7Bde%7D%7D%7D&filter=visible&type=tvShow'

channel_url = 'https://middleware.p7s1.io/joyn/v1/tvshows?skip=0&selection=%7Bdata%7Bid%2CchannelId%2Cvisibilities%2Cduration%2Cmetadata%7Bde%7D%7D%7D&filter=visible&type=tvShow%2Cmovie&channelId={0}'
channel_url = 'https://middleware.p7s1.io/joyn/v1/tvshows?skip={0}&limit=5000&selection=%7Bdata%7Bid%2CchannelId%2Cvisibilities%2Cduration%2Cmetadata%7Bde%7D%7D%7D&filter=visible&type=tvShow%2Cmovie&channelId={1}'
channel_limit = 5000

video_info_url = 'https://middleware.p7s1.io/joyn/v1/metadata/video/{0}?country=de&devicetype=phone&recommendations=2'

Expand Down
33 changes: 32 additions & 1 deletion resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,13 @@ def add_livestreams():

@plugin.route('/channel/id=<channel_id>/')
def show_channel(channel_id):
content = json.loads(get_url(ids.channel_url.format(channel_id), critical=True))
current = 0
content = json.loads(get_url(ids.channel_url.format(current, channel_id), critical=True))
add_series_from_fetch(content)
while len(content['response']['data']) == ids.channel_limit:
current += ids.channel_limit
content = json.loads(get_url(ids.channel_url.format(current, channel_id), critical=True))
add_series_from_fetch(content)
endOfDirectory(plugin.handle)

@plugin.route('/seasons/id=<show_id>/')
Expand Down Expand Up @@ -627,6 +632,19 @@ def get_url(url, headers={}, cache=False, critical=False):
log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} ##########".format(url, failure))
elif hasattr(e, 'reason'):
log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} ##########".format(url, failure))
try:
data = ''
if e.info().get('Content-Encoding') == 'gzip':
# decompress content
buffer = StringIO(e.read())
deflatedContent = gzip.GzipFile(fileobj=buffer)
data = deflatedContent.read()
else:
data = e.read()
log('Error: ' + data.decode('utf-8'))
except:
log('couldn\'t read Error content')
pass
if critical:
kodiutils.notification("ERROR GETTING URL", failure)
return sys.exit(0)
Expand Down Expand Up @@ -659,6 +677,19 @@ def post_url(url, postdata, headers={}, json = False, critical=False):
log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} === {2} ##########".format(url, postdata, failure))
elif hasattr(e, 'reason'):
log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} === {2} ##########".format(url, postdata, failure))
try:
data = ''
if e.info().get('Content-Encoding') == 'gzip':
# decompress content
buffer = StringIO(e.read())
deflatedContent = gzip.GzipFile(fileobj=buffer)
data = deflatedContent.read()
else:
data = e.read()
log('Error: ' + data.decode('utf-8'))
except:
log('couldn\'t read Error content')
pass
if critical:
if hasattr(e, 'code') and getattr(e, 'code') == 422:
kodiutils.notification("ERROR GETTING URL", kodiutils.get_string(32003))
Expand Down

0 comments on commit 292fbae

Please sign in to comment.