summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@cohens.org.il>2017-10-31 21:19:18 +0200
committerTzafrir Cohen <tzafrir@cohens.org.il>2017-10-31 22:21:15 +0200
commit5194acf7bb0c144adee2928b21540f9840d974f0 (patch)
tree987a3d0f345f56341d7240d7962b91b6a2c4447d
parentf43da74782afc89420bc29e96592ff013d71886e (diff)
Skeleton video content menu
-rw-r--r--addon.py52
1 files 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)