From 5194acf7bb0c144adee2928b21540f9840d974f0 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 31 Oct 2017 21:19:18 +0200 Subject: Skeleton video content menu --- addon.py | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/addon.py b/addon.py index bfe9304..404d1ad 100644 --- a/addon.py +++ b/addon.py @@ -1,11 +1,43 @@ -import xbmcaddon +# -*- coding: UTF-8 -*- +""" Kan Video plugin """ + +import sys +import urllib +import urlparse import xbmcgui - -addon = xbmcaddon.Addon() -addonname = addon.getAddonInfo('name') - -line1 = "Hello World!" -line2 = "We can write anything we want here" -line3 = "Using Python" - -xbmcgui.Dialog().ok(addonname, line1, line2, line3) +import xbmcplugin + +base_url = sys.argv[0] +addon_handle = int(sys.argv[1]) +args = urlparse.parse_qs(sys.argv[2][1:]) + +def build_url(query): + return base_url + '?' + urllib.urlencode(query) + +mode = args.get('mode', None) + + +if mode is None: + url = build_url({'mode': 'folder', 'foldername': 'tv-shows'}) + li = xbmcgui.ListItem(u'תוכניות טלוויזיה') + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, + listitem=li, isFolder=True) + + url = build_url({'mode': 'folder', 'foldername': 'net-shows'}) + li = xbmcgui.ListItem(u'תוכניות רשת') + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, + listitem=li, isFolder=True) + + url = build_url({'mode': 'folder', 'foldername': 'new-items'}) + li = xbmcgui.ListItem(u'קטעים חדשים') + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, + listitem=li, isFolder=True) + + xbmcplugin.endOfDirectory(addon_handle) + +elif mode[0] == 'folder': + foldername = args['foldername'][0] + url = 'http://localhost/some_video.mkv' + li = xbmcgui.ListItem(foldername + ' Video', iconImage='DefaultVideo.png') + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) + xbmcplugin.endOfDirectory(addon_handle) -- cgit v1.2.3