Skip to content

Commit

Permalink
- Fixed showing of categories with image
Browse files Browse the repository at this point in the history
- preview of TV Programm
changes % string format to string.format
  • Loading branch information
fayer3 committed Jul 6, 2019
1 parent 53930d4 commit 92a12cd
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 27 deletions.
15 changes: 3 additions & 12 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.zappntv" name="Zappn TV" version="1.0.1" provider-name="fayer3">
<addon id="plugin.video.zappntv" name="Zappn TV" version="1.0.2" provider-name="fayer3">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.routing" version="0.2.0"/>
Expand All @@ -23,17 +23,8 @@
<website>https://zappn.tv/</website>
<email>fb4472 (at) aon.at</email>
<source>https://github.com/fayer3/plugin.video.zappntv</source>
<news>Features von realvito hinzugefügt:
- Directories (Folder+Not Folder) auf setcontent- tvshows gesetzt (so hat man mehr verschiedene Ansichten in jedem Skin)
- fanart für Episoden hinzugefügt (da der thumb in dieser Sektion gross genug ist)
- thumb und fanart für Clips, Bonus und Ganze Folgen repariert
- Mediathek: bei den jeweiligen Sendungen - Plot mit letztem Eintragsdatum hinzugefügt
- Mediathek: bei den Episoden der Sendungen - Austrahlungsdatum im Plot hinzugefügt
- Deine Sortiermethode nur noch bei den Episoden eingesetzt und zus. Auswahl = Standard, Name, Dauer, Datum
- dementsprechend die Übersetzungen angepasst

- Kodi Favoriten repariert, Ordner und Videos können jetzt mit Vorschaubild zu den Kodi Favoriten hinzugefügt werden
- Icons für Livestreams aus Deutschland und Schweiz hinzugefügt</news>
<news>- Categorien mit blidern repariert
- Erste Version des TV Programms</news>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.png</fanart>
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ v1.0.1
- adapted translation for changes
- fixed Kodi Favorites: Folders and Videos added now have a thumbnail and are now selectable
- added Icons for livestreams from germany and switzerland
v1.0.2
- Fixed showing of categories with image
- preview of TV Programm
8 changes: 6 additions & 2 deletions resources/lib/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@

overview_url="https://admin.applicaster.com/v12/accounts/357.json?&include_voucher_templates=false&api[store]=android&api[ver]=1.2&api[bundle]=at.zappn&api[bver]=1.0.10"

collections_request_url = "https://admin.applicaster.com/v12/accounts/357/broadcasters/410/collections/%s/items.json?&page=%s"
categories_request_url = "https://admin.applicaster.com/v12/accounts/357/broadcasters/410/categories/%s.json?&api[ver]=1.2&api[bundle]=at.zappn&api[bver]=1.0.10&api[os_type]=android&api[os_version]=25&api[store]=android"
collections_request_url = "https://admin.applicaster.com/v12/accounts/357/broadcasters/410/collections/{id}/items.json?&page={page}"
categories_request_url = "https://admin.applicaster.com/v12/accounts/357/broadcasters/410/categories/{id}.json?&api[ver]=1.2&api[bundle]=at.zappn&api[bver]=1.0.10&api[os_type]=android&api[os_version]=25&api[store]=android"

epg_request_url = "http://admin.applicaster.com/v12/accounts/357/channels/{channel_id}/programs.json?date={date}" #date=YYYYMMDD

#from https://admin.applicaster.com/v12/accounts/357/broadcasters/410/collections.json
icon_id = "7617" #Bottom Tab Navigation Collection - Android
Expand All @@ -98,6 +100,8 @@
tv_programm_id = "97407"
search_id = "80740"

epg_id = "7263"

config_cache = {}
config_tag = {}

Expand Down
76 changes: 63 additions & 13 deletions resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import locale
import time
from datetime import datetime, timedelta
from datetime import date, datetime, timedelta
import hashlib
import json
import gzip
Expand All @@ -62,7 +62,7 @@

@plugin.route('/')
def index():
icon = get_url(ids.collections_request_url % (ids.icon_id, "1"))
icon = get_url(ids.collections_request_url.format(id=ids.icon_id, page="1"))
live_icon = ""
highlights_icon = ""
highlights_id = ids.highlights_id
Expand All @@ -89,7 +89,7 @@ def index():
tv_programm_icon = image_json["menu_icon"]
else:
kodiutils.notification("ERROR getting URL", "using saved values")
icon_search = get_url(ids.collections_request_url % (ids.search_icon_id, "1"))
icon_search = get_url(ids.collections_request_url.format(id=ids.search_icon_id, page="1"))
search_icon = ""
settings_icon = ""
if icon_search != "":
Expand Down Expand Up @@ -239,11 +239,61 @@ def show_category(category_id):
listitem.setArt({'icon': favorites[item]["icon"], 'thumb':favorites[item]["icon"], 'fanart' : favorites[item]["fanart"]})
addDirectoryItem(plugin.handle, url=item,
listitem=listitem, isFolder=True)
elif category_id == "tvprogramm":
channels = get_url(ids.collections_request_url.format(id=ids.epg_id, page = "1"), critical=True)
channels_json = json.loads(channels)
xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL)
for channel in channels_json["results"]:
listitem = ListItem(channel["name"])
if listitem.getLabel() != "Puls4 TV":
listitem.setLabel(listitem.getLabel().replace("Puls4 ", ""))
images = json.loads(channel["images_json"])
if "image_base" in images and images["image_base"]:
listitem.setArt({'icon':images["image_base"], 'thumb':images["image_base"]})
else:
listitem.setArt({'icon':images["icon_1"], 'thumb':images["icon_1"]})
addDirectoryItem(plugin.handle, url=plugin.url_for(
show_epg, channel["id"]), listitem=listitem, isFolder=True)

else:
addDirectoryItem(plugin.handle, "", ListItem(kodiutils.get_string(32004)), False)
endOfDirectory(plugin.handle)

@plugin.route('/category/mediathek/id=<mediathek_id>')
@plugin.route('/category/epg/id=<channel_id>/')
def show_epg(channel_id):
today = date.today()
# show epg from today
show_epg_programm(channel_id, today.strftime("%Y%m%d"))
endOfDirectory(plugin.handle)

@plugin.route('/category/epg/id=<channel_id>/date=<>date/')
def show_epg_programm(channel_id, date):
setContent(plugin.handle, 'tvshows')
programs = json.loads(get_url(ids.epg_request_url.format(channel_id=channel_id, date=date), critical=True))
for program in programs["programs"]:
startDATES = datetime(*(time.strptime(program['starts_at'].split(' +')[0], '%Y/%m/%d %H:%M:%S')[0:6])) # 2019/06/23 14:10:00 +0000
LOCALstart = utc_to_local(startDATES)
startTIMES = LOCALstart.strftime('%H:%M')
goDATE = LOCALstart.strftime('%d.%m.%Y')

endDATES = datetime(*(time.strptime(program['ends_at'].split(' +')[0], '%Y/%m/%d %H:%M:%S')[0:6])) # 2019/06/23 14:10:00 +0000
LOCALend = utc_to_local(endDATES)
endTIMES = LOCALend.strftime('%H:%M')

if '\n' in program["name"]:
name = program["name"].split('\n')[1]
else:
name = program["name"]

listitem = ListItem(startTIMES+": "+program["name"].replace("\n", ": "))
listitem.setInfo(type='Video', infoLabels={'Title': name, 'Plot': startTIMES+" - "+endTIMES+'[CR]'+program["description"], 'mediatype': 'video', 'TvShowTitle': program["name"].split('\n')[0], 'Date': goDATE})
images = json.loads(program["images_json"])
if "image_base" in images:
listitem.setArt({'icon': images["image_base"], 'thumb': images["image_base"], 'fanart': images["image_base"]})
addDirectoryItem(plugin.handle, url=None, listitem=listitem)
endOfDirectory(plugin.handle)

@plugin.route('/category/mediathek/id=<mediathek_id>/')
def show_mediathek(mediathek_id):
get_by_collection(mediathek_id, "1")
endOfDirectory(plugin.handle)
Expand All @@ -253,10 +303,10 @@ def show_search():
query = xbmcgui.Dialog().input(kodiutils.get_string(32001))
if query != "":
search_id = ids.search_id
channels = json.loads(get_url(ids.categories_request_url % search_id, critical=True))
channels = json.loads(get_url(ids.categories_request_url.format(id=search_id), critical=True))
shows = {}
for channel in channels["category"]["children"]:
channel_shows = json.loads(get_url(ids.categories_request_url % channel["id"], critical=True))
channel_shows = json.loads(get_url(ids.categories_request_url.format(id=channel["id"]), critical=True))
for show in channel_shows["category"]["children"]:
shows.update({show["name"]+" | "+show["top_level_category"]["name"] : show})
result = {}
Expand Down Expand Up @@ -427,7 +477,7 @@ def play_video(video_id, channel):

@plugin.route('/category/by_category/<category_id>/')
def get_by_category(category_id):
dir = get_url(ids.categories_request_url % category_id, critical=True)
dir = get_url(ids.categories_request_url.format(id=category_id), critical=True)
dir_json = json.loads(dir)
special = ['ganze folgen', 'clips', 'bonus']
if "children" in dir_json["category"]:
Expand All @@ -449,10 +499,10 @@ def get_by_category(category_id):
fanart_child = ""
if "images_json" in child:
images_child = json.loads(child["images_json"])
if "image_base" in images:
icon_child = images["image_base"]
if "image_show_big" in images:
fanart_child = images["image_show_big"]
if "image_base" in images_child:
icon_child = images_child["image_base"]
if "image_show_big" in images_child:
fanart_child = images_child["image_show_big"]
listitem = ListItem(name)
listitem.setArt({'icon': icon_child, 'thumb': icon_child, 'fanart': fanart_child})
plot = ""
Expand Down Expand Up @@ -513,7 +563,7 @@ def get_by_collection(collection_id, page):


def add_directories(id, page = "1", recursive=False, prefix=""):
dir = get_url(ids.collections_request_url % (id, page), critical=True)
dir = get_url(ids.collections_request_url.format(id=id, page=page), critical=True)
dir_json = json.loads(dir)
for item in dir_json["results"]:
setContent(plugin.handle, 'tvshows')
Expand Down Expand Up @@ -691,7 +741,7 @@ def get_listitem(name="", icon="", fanart="", channel={}, no_puls4=True):
listitem.setArt({'icon':images["icon_1"], 'thumb':images["icon_1"]})
if "next_program" in channel:
#'Title': channel["name"]
listitem.setInfo(type='Video', infoLabels={'Title': channel["name"], 'Plot': channel["next_program"]["name"]+'[CR]'+channel["next_program"]["description"], 'mediatype': 'video'})
listitem.setInfo(type='Video', infoLabels={'Title': listitem.getLabel(), 'Plot': channel["next_program"]["name"]+'[CR]'+channel["next_program"]["description"], 'mediatype': 'video'})
program_images = json.loads(channel["next_program"]["images_json"])
if program_images:
listitem.setArt({'fanart' : program_images["image_base"]})
Expand Down

0 comments on commit 92a12cd

Please sign in to comment.