OpenELEC系统中自动循环播放视频的XBMC脚本

XBMC单个视频播放脚本 /storage/.xbmc/userdata/autoexec.py 如下:

#! /usr/bin/env python
import xbmc
xbmc.executebuiltin( "PlayMedia(/storage/videos/korobeniki.mp4)" )

改成使用播放列表的机制就可以实现循环功能了:

#! /usr/bin/env python
import xbmc
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
playlist.add("/storage/videos/korobeniki.mp4")
xbmc.Player().play(playlist)
xbmc.executebuiltin("PlayerControl(RepeatOne)")

本文内容来自 http://segmentfault.com/q/1010000000495024 并受 CC-BY 3.0 (中国大陆) 协议约束