xbmc小结

1.xbmc帮助文档XBMC.chm,在线帮助http://wiki.xbmc.org/index.php?title=XBMC_Online_Manual

 

2.中文显示。将系统中文字体ttf,随便一个拷贝到xbmc/media文件夹下.通过界面菜单system-appearence-font选择字体

 

3.脚本开发python,给一个例子channel.py加载xml例子

 #==================================== import xbmc, xbmcgui import sys, re, time, os from os import path, listdir from string import replace, split, upper, lower, capwords, join,zfill from datetime import date from threading import Thread import math import encodings, encodings.latin_1 from shutil import copy import gc from xml.dom import minidom DIR_HOME = os.getcwd().replace( ";", "" ) DIR_EPG_DATA_HOME = xbmc.translatePath('special://xbmc/epgdata/xml/') DIR_CHANNEL_ICON_PATH = xbmc.translatePath('special://xbmc/epgdata/poster/') filepath = os.path.join(DIR_EPG_DATA_HOME, "channellist.xml") # main interface class ZTE_Channel_Window(xbmcgui.WindowXML): ZTE_Channel_LISTS = 600 def __init__(self, *args, **kwargs): print "-------------__init_channel.py-------------" def onInit(self): count = len(sys.argv)-1 if count == 0:#没有传参,默认检索所有的频道 id="" tagline="" if xbmc.Player().isPlaying(): tag = xbmc.Player().getVideoInfoTag() id = tag.getVotes() tagline = tag.getTagLine() if id == "" or tagline =="":#如何从当前频道没有获取到SP则默认检索所有的频道 self.sp="all" else: self.sp = id self.vod_column = tagline else: self.sp = sys.argv[1] self.vod_column = sys.argv[2] # sp="002" # self.message(sp) self.InitialControls() xml=[] self.parseXML(filepath,xml,self.sp) self.InitChannelListData(xml) # Find GUI Controls def InitialControls(self): self.list_channels = self.getControl(self.ZTE_Channel_LISTS) def getText(self,nodelist): rc="" for node in nodelist: if node.nodeType == node.TEXT_NODE or node.nodeType == node.CDATA_SECTION_NODE: rc = rc + node.data return rc def message(self,message): dialog = xbmcgui.Dialog() dialog.ok("channel.py", message) def parseXML(self,requesturl,xml,sp): dom = minidom.parse(requesturl) if sp=="all":#检索所有的频道数据 for node_sp in dom.getElementsByTagName('sp'): for node in node_sp.getElementsByTagName('channel'): xml.append({ 'id': self.getText(node.getElementsByTagName("id")[0].childNodes), 'name': self.getText(node.getElementsByTagName("name")[0].childNodes), 'lcn':self.getText(node.getElementsByTagName("lcn")[0].childNodes), 'playurl':self.getText(node.getElementsByTagName("playurl")[0].childNodes), 'desc':self.getText(node.getElementsByTagName("desc")[0].childNodes), 'icon':self.getText(node.getElementsByTagName("icon")[0].childNodes) }) else:#检索特定的频道数据 for node_sp in dom.getElementsByTagName('sp'): if node_sp.getAttribute('id') == sp: for node in node_sp.getElementsByTagName('channel'): xml.append({ 'id': self.getText(node.getElementsByTagName("id")[0].childNodes), 'name': self.getText(node.getElementsByTagName("name")[0].childNodes), 'lcn':self.getText(node.getElementsByTagName("lcn")[0].childNodes), 'playurl':self.getText(node.getElementsByTagName("playurl")[0].childNodes), 'desc':self.getText(node.getElementsByTagName("desc")[0].childNodes), 'icon':self.getText(node.getElementsByTagName("icon")[0].childNodes) }) #放到结果 def InitChannelListData(self,xml): self.list_channels.reset() for xml_item in xml: icon_path = DIR_CHANNEL_ICON_PATH + xml_item['icon'] item = xbmcgui.ListItem(xml_item['lcn'],xml_item['name'],icon_path,icon_path) item.setProperty('playurl',xml_item['playurl']) item.setProperty('desc',xml_item['desc']) item.setProperty('name',xml_item['name']) self.list_channels.addItem(item) def onClick(self, controlID): if controlID == self.ZTE_Channel_LISTS: item = self.list_channels.getSelectedItem() #id = item.getProperty('id') playurl= item.getProperty('playurl') name = item.getProperty('name') listitem = xbmcgui.ListItem(name) #all不传 if self.sp == 'all': listitem.setInfo('video', {'Title': name, 'status':'livetv'}) else: listitem.setInfo('video', {'Title': name, 'status':'livetv','votes':self.sp,'tagline':self.vod_column}) self.PlayVideoUrl(playurl,listitem) def PlayVideoUrl(self, url,listitem): player = xbmc.Player() player.play(url,listitem) ################################################################################################################# w = ZTE_Channel_Window("custom_EpgChannel.xml", DIR_HOME, "Default") w.doModal() del w

对应的xml文件

<!-- <window type="buttonMenu" id="111"> --> <window id="8000"> <allowoverlay>yes</allowoverlay> <defaultcontrol always="true">600</defaultcontrol> <controls> <control type="group"> <include>BackgroundVideoPlaying</include> </control> <!-----scroll bar-------> <control type="scrollbar" id="700"> <animation effect="slide" start="-400,0" time="300" delay="300">WindowOpen</animation> <animation effect="slide" end="-600,0" time="400" tween="quadratic" easing="out" >WindowClose</animation> <posx>465</posx> <posy>255</posy> <width>17</width> <height>300</height> <visible>true</visible> <texturesliderbar border="2,16,2,16">special://skin/epgdata/images/vod/vod_scrolling_bar.png</texturesliderbar> <orientation>vertical</orientation> <showonepage>false</showonepage> <onup>600</onup> <ondown>600</ondown> </control> <control type="group"> <posx>100</posx> <posy>100</posy> <height>500</height> <width>400</width> <animation effect="slide" start="-400,0" time="300"delay="300">WindowOpen</animation> <animation effect="slide" end="-600,0" time="400" tween="quadratic" easing="out" >WindowClose</animation> <control type="largeimage" > <description>list background</description> <posx>0</posx> <posy>0</posy> <width>400</width> <height>500</height> <visible>true</visible> <colordiffuse>FFFFFFFF</colordiffuse> <fadetime>200</fadetime> <texture border="5" flipY="true" flipX="false">special://skin/epgdata/images/channel_list_bg.png</texture> <aspectratio>stretch</aspectratio> </control> <control type="list" id="600"> <posx>0</posx> <posy>150</posy> <height>303</height> <pagecontrol>700</pagecontrol> <width>400</width> <onup>600</onup> <ondown>600</ondown> <focusposition>0</focusposition> <scrolltime>200</scrolltime> <itemlayout width="335" height="43"> <control type="label"> <posx>30</posx> <posy>0</posy> <width>335</width> <height>43</height> <visible>true</visible> <font>DefaultFont</font> <textcolor>white</textcolor> <selectedcolor>SelectedColor</selectedcolor> <aligny>center</aligny> <align>left</align> <info>ListItem.Label</info> </control> <control type="label"> <posx>150</posx> <posy>0</posy> <width>200</width> <height>43</height> <visible>true</visible> <font>DefaultFont</font> <textcolor>white</textcolor> <selectedcolor>SelectedColor</selectedcolor> <aligny>center</aligny> <align>left</align> <info>ListItem.Label2</info> </control> <control type="image"> <posx>75</posx> <posy>5</posy> <width>50</width> <height>40</height> <visible>true</visible> <colordiffuse>FFFFFFFF</colordiffuse> <fadetime>200</fadetime> <texture border="5"></texture> <info>ListItem.Icon</info> <aspectratio>stretch</aspectratio> </control> </itemlayout> <focusedlayout width="335" height="43"> <control type="largeimage"> <description>item background</description> <width>335</width> <height>43</height> <posx>20</posx> <posy>5</posy> <visible>true</visible> <colordiffuse>FFFFFFFF</colordiffuse> <fadetime>200</fadetime> <texture border="5">special://skin/epgdata/images/channel_list_btn.png</texture> <animation effect="fade" end="100" condition="true">Conditional</animation> <aspectratio>keep</aspectratio> </control> <control type="label"> <posx>30</posx> <posy>0</posy> <width>335</width> <height>43</height> <visible>true</visible> <font>DefaultFont</font> <textcolor>white</textcolor> <selectedcolor>SelectedColor</selectedcolor> <aligny>center</aligny> <align>left</align> <info>ListItem.Label</info> </control> <control type="label"> <posx>150</posx> <posy>0</posy> <width>200</width> <height>43</height> <visible>true</visible> <font>DefaultFont</font> <textcolor>white</textcolor> <selectedcolor>SelectedColor</selectedcolor> <aligny>center</aligny> <align>left</align> <info>ListItem.Label2</info> </control> <control type="image"> <posx>75</posx> <posy>5</posy> <width>50</width> <height>40</height> <visible>true</visible> <colordiffuse>FFFFFFFF</colordiffuse> <fadetime>200</fadetime> <texture border="5"></texture> <info>ListItem.Icon</info> <aligny>center</aligny> <aspectratio>stretch</aspectratio> </control> </focusedlayout> </control> </control> </controls> </window>

你可能感兴趣的:(xml,animation,Path,import,border,delay)