def add(isFolder, content_type, name, thumb, uri): p, cat, module, page, args, info, art = decode(uri) if opath.exists(kodi_favxml): res = dom.read(kodi_favxml) else: res = minidom.parseString("<favourites></favourites>") favs = res.getElementsByTagName("favourites")[0] newnode = res.createElement("favourite") newnode.setAttribute("name", name) newnode.setAttribute("thumb", thumb) link = "plugin://plugin.program.ump/?%s" % urlencode( { "module": module, "page": page, "args": json.dumps(args).encode("base64"), "info": json.dumps(info).encode("base64"), "art": json.dumps(art).encode("base64"), "content_type": content_type }) if isFolder: str = 'ActivateWindow(%d,"%s",return)' % (WID[content_type], link) else: str = 'RunPlugin("%s")' % link favs.appendChild(newnode) newnode.appendChild(res.createTextNode(str)) dom.write(kodi_favxml, res) dialog = xbmcgui.Dialog() dialog.ok('UMP', '%s added to bookmarks' % name)
def set_setting_attrs(attrs): ret=False res=dom.read(addon_setxml) for name,set,val in attrs: for setting in res.getElementsByTagName("setting"): if setting.getAttribute("id") == name: setting.setAttribute(set,val) ret=True break if ret: dom.write(addon_setxml,res) return ret
def force(mode): mode=str(mode) if path.exists(setxml): res=dom.read(setxml) adv=getchild(res,res,"advancedsettings") nw=getchild(res,adv,"network") bm=getchild(res,nw,"buffermode") for text in bm.childNodes: bm.removeChild(text) bm.appendChild(res.createTextNode(mode)) else: res=minidom.parseString("<advancedsettings><network><buffermode>%s</buffermode></network></advancedsettings>"%mode) dom.write(setxml,res) dialog = Dialog() dialog.ok('UMP', 'LibCurl Buffering Mode set to %s'%mode,logs[mode],"YOU NEED TO RESTART KODI TO CHANGES TAKE AFFECT")
def force(mode): mode = str(mode) if path.exists(setxml): res = dom.read(setxml) adv = getchild(res, res, "advancedsettings") nw = getchild(res, adv, "network") bm = getchild(res, nw, "buffermode") for text in bm.childNodes: bm.removeChild(text) bm.appendChild(res.createTextNode(mode)) else: res = minidom.parseString( "<advancedsettings><network><buffermode>%s</buffermode></network></advancedsettings>" % mode) dom.write(setxml, res) dialog = Dialog() dialog.ok('UMP', 'LibCurl Buffering Mode set to %s' % mode, logs[mode], "YOU NEED TO RESTART KODI TO CHANGES TAKE AFFECT")
def ren(name, thumb, data): res, favs = load() mfavs = res.getElementsByTagName("favourites")[0] dialog = xbmcgui.Dialog() for fav in res.getElementsByTagName("favourite"): fname = fav.getAttribute("name").encode("utf-8") fthumb = fav.getAttribute("thumb").encode("utf-8") fdata = fav.lastChild.data.replace(""", '"') if name == fname and fthumb == thumb and fdata == data: kb = xbmc.Keyboard('default', 'Rename Bookmark', True) kb.setDefault(name) kb.setHiddenInput(False) kb.doModal() newname = kb.getText() if not newname == name or newname == "": fav.setAttribute("name", newname) dom.write(kodi_favxml, res) xbmc.executebuiltin("Container.Refresh") dialog.ok('UMP', '%s has been to %s' % (name, newname)) break
def ren(name,thumb,data): res,favs=load() mfavs=res.getElementsByTagName("favourites")[0] dialog = xbmcgui.Dialog() for fav in res.getElementsByTagName("favourite"): fname=fav.getAttribute("name").encode("utf-8") fthumb=fav.getAttribute("thumb").encode("utf-8") fdata=fav.lastChild.data.replace(""",'"') if name==fname and fthumb==thumb and fdata==data: kb = xbmc.Keyboard('default', 'Rename Bookmark', True) kb.setDefault(name) kb.setHiddenInput(False) kb.doModal() newname=kb.getText() if not newname==name or newname=="": fav.setAttribute("name", newname) dom.write(kodi_favxml,res) xbmc.executebuiltin("Container.Refresh") dialog.ok('UMP', '%s has been to %s'%(name,newname)) break
def add(isFolder,content_type,name,thumb,uri): p,cat,module,page,args,info,art=decode(uri) if opath.exists(kodi_favxml): res=dom.read(kodi_favxml) else: res=minidom.parseString("<favourites></favourites>") favs=res.getElementsByTagName("favourites")[0] newnode = res.createElement("favourite") newnode.setAttribute("name", name) newnode.setAttribute("thumb", thumb) link="plugin://plugin.program.ump/?%s"%urlencode({"module":module,"page":page,"args":json.dumps(args).encode("base64"),"info":json.dumps(info).encode("base64"),"art":json.dumps(art).encode("base64"),"content_type":content_type}) if isFolder: str='ActivateWindow(%d,"%s",return)'%(WID[content_type],link) else: str='RunPlugin("%s")'%link favs.appendChild(newnode) newnode.appendChild(res.createTextNode(str)) dom.write(kodi_favxml,res) dialog = xbmcgui.Dialog() dialog.ok('UMP', '%s added to bookmarks'%name)
def rem(name, thumb, data): res, favs = load() found = False mfavs = res.getElementsByTagName("favourites")[0] dialog = xbmcgui.Dialog() for fav in res.getElementsByTagName("favourite"): fname = fav.getAttribute("name").encode("utf-8") fthumb = fav.getAttribute("thumb").encode("utf-8") fdata = fav.lastChild.data.replace(""", '"') if name == fname and fthumb == thumb and fdata == data: found = True if dialog.yesno("UMP", "Are you sure you want to remove?", name): mfavs.removeChild(fav) dialog.ok('UMP', '%s has been removed from bookmarks' % name) break if found: dom.write(kodi_favxml, res) xbmc.executebuiltin("Container.Refresh") else: dialog.ok('UMP', '%s can not be found in bookmarks!' % name) res.unlink()
def rem(name,thumb,data): res,favs=load() found=False mfavs=res.getElementsByTagName("favourites")[0] dialog = xbmcgui.Dialog() for fav in res.getElementsByTagName("favourite"): fname=fav.getAttribute("name").encode("utf-8") fthumb=fav.getAttribute("thumb").encode("utf-8") fdata=fav.lastChild.data.replace(""",'"') if name==fname and fthumb==thumb and fdata==data: found=True if dialog.yesno("UMP", "Are you sure you want to remove?",name): mfavs.removeChild(fav) dialog.ok('UMP', '%s has been removed from bookmarks'%name) break if found: dom.write(kodi_favxml,res) xbmc.executebuiltin("Container.Refresh") else: dialog.ok('UMP', '%s can not be found in bookmarks!'%name) res.unlink()