XBMC插件开发

  • 介绍
本文介绍如何开发 XBMC插件。 Python库手册:http://mirrors.xbmc.org/docs/python-docs/stable/。 这里有一篇来自wiki的英文介绍:http://kodi.wiki/view/HOW-TO_write_Python_Scripts_for_XBMC#XBMC_Python_Scripting_Tutorial
  • 目录结构
~/.xbmc/addons/ 在这个目录下通常会有三个文件:addon.xml、hello.py、icon.png 分别是插件描述文件、主程序、图标文件(256x256) 下面是addon.xml一个示例: [codesyntax lang="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.suren.system.fan"
	name="AutoFan"
	version="0.0.1"
	provider-name="http://surenpi.com">
	<extension point="xbmc.python.pluginsource" library="suren.py">
		<provides>Video</provides>
	</extension>
	
	<extension point="xbmc.addon.metadata">
		<platform>all</platform>
		<summary>suren hello world plugin</summary>
		<summary lang="zh">suren hello world plugin</summary>
		<description>plugin desc information</description>
		<description lang="zh">plugin desc information</description>
		<disclaimer>disclaimer</disclaimer>
	</extension>
</addon>
[/codesyntax] 从上面的例子可以看到,对于插件的多语言是直接支持的。按照上面的目录结构打包成zip文件后即可发行。
  • API
先从一个例子说起: [codesyntax lang="python"]
# -*- coding: utf-8 -*-
# suren.py

import xbmcplugin, xbmcgui

url='http://surenpi.com'

handle=int(sys.argv[1])
listitem=xbmcgui.ListItem('Hello, World!')
xbmcplugin.addDirectoryItem(handle, url, listitem)
xbmcplugin.endOfDirectory(handle)
[/codesyntax]
  • 参考
http://bbs.htpc1.com/thread-198731-1-1.html http://blog.csdn.net/jerry_zhanghui/article/details/7335132

转载于:https://my.oschina.net/surenpi/blog/605461

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值