well, it is not really more code:
Code:
import urllib,re,xbmcplugin,xbmcgui,os, sys
def CATEGORIES(test):
#addDir(test,'',1,'')
#addDir(test,'',1,'')
addLink(test,'/home/Serenity.avi','')
def addLink(name,url,iconimage):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
return ok
CATEGORIES("test string")
xbmcplugin.endOfDirectory(int(sys.argv[1]))
edit:
my current workings:
Code:
import urllib,re,xbmcplugin,xbmcgui,os,sys
from xml.dom.minidom import parse
__language__ = xbmc.Language( os.getcwd() ).getLocalizedString
def getResults(film):
notWantedKeywords = ["720p", "1080p", "Bluray", "Blueray"]
unwantedKeywordFound = 0
found = 0
film = film.replace(" ", "+")
filmUrl = "http://search.student.utwente.nl/api/search?q=" + film + "&page=0&dirsonly=yes&n=500"
try:
feed = urllib.urlopen(filmUrl)
dom = parse(feed)
#check through all the <result>
for node in dom.getElementsByTagName('result'):
#only take those which are online!
if node.getElementsByTagName('online')[0].firstChild.nodeValue == 'yes':
# we dont want bluray or any orther HD movie, the xbox cannot play it!
for keyword in notWantedKeywords:
if node.getElementsByTagName('full_path')[0].firstChild.nodeValue.find(keyword) != -1:
unwantedKeywordFound = 1
# okay, everything seems clear, now lets get rid of the directories, we only want the files!
if unwantedKeywordFound == 0:
# check if there is a file ending
#if node.getElementsByTagName('name')[0].firstChild.nodeValue[len(node.getElementsByTagName('name')[0].firstChild.nodeValue) - 4] == ".":
addDir(node.getElementsByTagName('name')[0].firstChild.nodeValue, node.getElementsByTagName('full_path')[0].firstChild.nodeValue,1, '')
found = 1
unwantedKeywordFound = 0;
if found != 1:
message("nothing found!")
except Exception:
message("Could not reach CampusSearch!")
#search for something
def GUIEditExportName(name):
exit = True
while (exit):
kb = xbmc.Keyboard('default', 'heading', True)
kb.setDefault(name)
kb.setHeading(__language__(33223))
kb.setHiddenInput(False)
kb.doModal()
if (kb.isConfirmed()):
name_confirmed = kb.getText()
name = name_confirmed
exit = False
#name_correct = name_confirmed.count(' ')
#if (name_correct):
# GUIInfo(2,__language__(33224))
#else:
# name = name_confirmed
# exit = False
else:
GUIInfo(2,__language__(33225))
return(name)
def message(text):
dialog = xbmcgui.Dialog()
dialog.ok("Error", text)
def addLink(name,url,iconimage):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
return ok
def addDir(name,url,mode,iconimage):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=True)
return ok
requestedMovie = ""
requestedMovie = GUIEditExportName(requestedMovie)
getResults(requestedMovie)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
it nearly works. it lists all the directory with the found movies, but as soon as i enter them i cannot see any files - although they are there. they are just not displayed. i think im doing a basic error, but i dont know which one.