How to Add Search and Order Options to Video Addon? Anyone knows?
#1
This is my code

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...
Reply
#2
a search is a listing - a folder. for sort to be available you have to add the sort modes you want. it is all in the documentation, not to mention in the 100s of existing plugins implementing it ready for you to read and learn from.
Reply
#3
(2015-09-14, 09:13)ironic_monkey Wrote: a search is a listing - a folder. for sort to be available you have to add the sort modes you want. it is all in the documentation, not to mention in the 100s of existing plugins implementing it ready for you to read and learn from.

Can u send me any link?
Reply
#4
http://mirrors.kodi.tv/docs/python-docs/15.x-isengard/
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply

Logout Mark Read Team Forum Stats Members Help
How to Add Search and Order Options to Video Addon? Anyone knows?0