2015-09-14, 07:48
This is my code
I wanna add Search option and Order (descending/ascending/newest)
How to? Anyone tell me...
Code:
import sys
import urllib
import urlparse
import xbmcgui
import xbmcplugin
import YDStreamExtractor
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])
xbmcplugin.setContent(addon_handle, 'movies')
def build_url(query):
return base_url + '?' + urllib.urlencode(query)
mode = args.get('mode', None)
if mode is None:
url = build_url({'mode': 'folder1', 'foldername': 'FnCable Guide'})
li = xbmcgui.ListItem('FnCable Guide', iconImage='http://freenetcable.com/live/test/FnCableGuide.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
url = build_url({'mode': 'folder2', 'foldername': 'Folder Two'})
li = xbmcgui.ListItem('Folder Two', iconImage='DefaultFolder.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'folder1':
foldername = args['foldername'][0]
YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube
url = "https://www.youtube.com/watch?v=R93-umuKXFU" #a youtube ID will work as well and of course you could pass the url of another site
vid = YDStreamExtractor.getVideoInfo(url,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
url = stream_url
li = xbmcgui.ListItem(foldername + ' Video', iconImage='http://freenetcable.com/live/test/howto.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'folder2':
foldername = args['foldername'][0]
YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube
url = "https://www.youtube.com/watch?v=R93-umuKXFU" #a youtube ID will work as well and of course you could pass the url of another site
vid = YDStreamExtractor.getVideoInfo(url,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
url = stream_url
li = xbmcgui.ListItem(foldername + ' Video', iconImage='http://freenetcable.com/live/test/howto.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
I wanna add Search option and Order (descending/ascending/newest)
How to? Anyone tell me...