XBMC插件python代码保存到收藏夹favourites.xml

首先favourites.xml的位置在userdata目录http://wiki.xbmc.org/?title=Userdata,在Python中设定xbmc.translatePath(“special://profile//favourites.xml”)

收藏夹文件favourites.xml的内容例子见http://wiki.xbmc.org/index.php?title=Favourites.xml

在python中保存此文件

from xml.dom.minidom import Document

doc = Document()
favourites = doc.createElement(‘favourites’)
doc.appendChild(favourites)
for each in favtree.findAll(‘favourite’):
favourite = doc.createElement(‘favourite’)
favourite.setAttribute(‘name’,’名字’)
favourite.setAttribute(‘thumb’,’TestThumb’)
favourite_text = doc.createTextNode(‘PlayMedia(“播放地址””)’)
favourite.appendChild(favourite_text)
favourites.appendChild(favourite)
f = open(FAVORITES_SAVETO, “w”)
f.write(doc.toprettyxml(indent = ”))
f.close()

另外也可以调用接口去改,不过貌似没找到,只找到一个Json的接口,待跟进

Loading



微信扫描下方的二维码阅读本文

作者 arcko

新长征路上的码农下班买菜中

在 “XBMC插件python代码保存到收藏夹favourites.xml” 有 1 条评论

发表回复

此站点使用 Akismet 来减少垃圾评论。了解我们如何处理您的评论数据