本文整理汇总了Python中resources.lib.settings.Settings.getTimeForClock方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getTimeForClock方法的具体用法?Python Settings.getTimeForClock怎么用?Python Settings.getTimeForClock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resources.lib.settings.Settings
的用法示例。
在下文中一共展示了Settings.getTimeForClock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onPlayBackStarted
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getTimeForClock [as 别名]
def onPlayBackStarted(self):
# The first item in a playlist will have already had it's start time
# set correctly if it is a clock
if self.initialStart is True:
self.initialStart = False
log("onPlayBackStarted received for initial video")
return
if self.isPlayingVideo():
# Get the currently playing file
filename = self.getPlayingFile()
log("onPlayBackStarted received for file %s" % filename)
duration = self._getVideoDuration(filename)
log("onPlayBackStarted: Duration is %d for file %s" % (duration, filename))
startTime = Settings.getTimeForClock(filename, duration)
# Set the clock start time
if startTime > 0 and duration > 10:
self.seekTime(startTime)
else:
log("onPlayBackStarted received, but not playing video file")
xbmc.Player.onPlayBackStarted(self)
示例2: _updatePlaylistForSettings
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getTimeForClock [as 别名]
def _updatePlaylistForSettings(self, playlist):
if playlist.size() < 1:
return playlist
filename = playlist[0].getfilename()
duration = self._getVideoDuration(filename)
log("Duration is %d for file %s" % (duration, filename))
startTime = 0
# Check if we have a random start time
if Settings.isRandomStart():
startTime = random.randint(0, int(duration * 0.75))
clockStart = Settings.getTimeForClock(filename, duration)
if clockStart > 0:
startTime = clockStart
# Set the random start
if (startTime > 0) and (duration > 10):
listitem = xbmcgui.ListItem()
# Record if the theme should start playing part-way through
listitem.setProperty('StartOffset', str(startTime))
log("Setting start of %d for %s" % (startTime, filename))
# Remove the old item from the playlist
playlist.remove(filename)
# Add the new item at the start of the list
playlist.add(filename, listitem, 0)
return playlist