本文整理汇总了Python中xbmc.abortRequested方法的典型用法代码示例。如果您正苦于以下问题:Python xbmc.abortRequested方法的具体用法?Python xbmc.abortRequested怎么用?Python xbmc.abortRequested使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmc
的用法示例。
在下文中一共展示了xbmc.abortRequested方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def list(uri):
# Create instance of Engine
engine = Engine(uri)
files = []
# Ensure we'll close engine on exception
with closing(engine):
# Start engine
engine.start()
# Wait until files received
while not files and not xbmc.abortRequested:
# Will list only video files in torrent
files = engine.list(media_types=[MediaType.VIDEO])
# Check if there is loading torrent error and raise exception
engine.check_torrent_error()
xbmc.sleep(200)
return files
示例2: sop_sleep
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def sop_sleep(time, spsc_pid):
counter = 0
increment = 200
path = "/proc/%s" % str(spsc_pid)
try:
while counter < time and spsc_pid > 0 and not xbmc.abortRequested:
counter += increment
xbmc.sleep(increment)
except:
return True
if counter < time:
return False
else:
return True
# dirty hack to break sopcast.exe player codec to avoid double sound
示例3: run
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def run(self):
LogToXBMC('Start SockThread')
while self.active and not self.error and not xbmc.abortRequested:
try:
xbmc.sleep(32)
self.lastRecv = self.lastRecv + self.sock.recv(self.buffer)
if self.lastRecv.find('\r\n') > -1:
cmds = self.lastRecv.split('\r\n')
for cmd in cmds:
if cmd.replace(' ', '').__len__() > 0:
#LogToXBMC('RUN Получена комманда = ' + cmd)
self._constructMsg(cmd)
self.lastRecv = ''
except Exception, e:
self.isRecv = True
self.active = False
self.error = e
LogToXBMC('RECV THREADING %s' % e, 2)
_msg = TSMessage()
_msg.type = TSMessage.ERROR
_msg.params = 'Ошибка соединения с TS'
self.state_method(_msg)
#self.owner.end()
#self.owner.connectToTS()
#self.owner.parent.close()
示例4: play_url_ind
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def play_url_ind(self, index=0, title='', icon='', thumb=''):
self.log.out('play')
lnk=self.get_link(index,title,icon,thumb)
if not lnk: return False
self.player.link=lnk
self.player.vod=True
if self.progress:self.progress.close()
item = xbmcgui.ListItem(title,thumb,icon,path=lnk)
if self.local:
xbmc.Player().play(lnk,item)
else:
self.player.play(lnk,item)
while self.player.active and not self.local:
self.loop()
xbmc.sleep(300)
if xbmc.abortRequested:
self.log.out("XBMC is shutting down")
break
self.log.out('ended play')
示例5: play_url_ind
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def play_url_ind(self, index=0, title='', icon='', thumb=''):
self.log.out('play')
self.player=_TSPlayer()
lnk=self.get_link(index,title,icon,thumb)
if not lnk: return False
self.player.link=lnk
self.player.vod=True
if self.progress:self.progress.close()
item = xbmcgui.ListItem(title,thumb,icon,path=lnk)
if self.local:
xbmcvfs.rename(lnk,lnk)
xbmc.Player().play(lnk,item)
else:
self.player.play(lnk,item)
while self.player.active and not self.local:
self.loop()
xbmc.sleep(300)
if xbmc.abortRequested:
self.log.out("XBMC is shutting down")
break
self.log.out('ended play')
示例6: start
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def start(self):
enable_updates
class Monitor(xbmc.Monitor):
def onSettingsChanged(self):
global enable_updates
enable_updates = kodi.get_setting('enable_updates') == 'true'
monitor = Monitor()
kodi.log("Service Starting...")
if is_depricated:
while not xbmc.abortRequested:
kodi.sleep(1000)
self.update()
else:
while not monitor.abortRequested():
if monitor.waitForAbort(10):
break
self.update()
self.shutdown()
示例7: onSourceProgressUpdate
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def onSourceProgressUpdate(self, percentageComplete):
control = self.getControl(self.C_MAIN_LOADING_PROGRESS)
if percentageComplete < 1:
if control:
control.setPercent(1)
self.progressStartTime = datetime.datetime.now()
self.progressPreviousPercentage = percentageComplete
elif percentageComplete != self.progressPreviousPercentage:
if control:
control.setPercent(percentageComplete)
self.progressPreviousPercentage = percentageComplete
delta = datetime.datetime.now() - self.progressStartTime
if percentageComplete < 20:
self.setControlLabel(self.C_MAIN_LOADING_TIME_LEFT, strings(CALCULATING_REMAINING_TIME))
else:
secondsLeft = int(delta.seconds) / float(percentageComplete) * (100.0 - percentageComplete)
if secondsLeft > 30:
secondsLeft -= secondsLeft % 10
self.setControlLabel(self.C_MAIN_LOADING_TIME_LEFT, strings(TIME_LEFT) % secondsLeft)
return not xbmc.abortRequested and not self.isClosing
示例8: updateTimebar
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def updateTimebar(self, scheduleTimer=True):
# move timebar to current time
timeDelta = datetime.datetime.today() - self.viewStartDate
control = self.getControl(self.C_MAIN_TIMEBAR)
if control:
(x, y) = control.getPosition()
try:
# Sometimes raises:
# exceptions.RuntimeError: Unknown exception thrown from the call "setVisible"
control.setVisible(timeDelta.days == 0)
except:
pass
control.setPosition(self._secondsToXposition(timeDelta.seconds), y)
if scheduleTimer and not xbmc.abortRequested and not self.isClosing:
threading.Timer(1, self.updateTimebar).start()
示例9: _fetch_recommended_episodes
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def _fetch_recommended_episodes(self):
# First we get a list of all the in-progress TV shows.
json_query_string = self.json_query("VideoLibrary.GetTVShows", unplayed=True,
properties=self.tvshow_properties,
sort={"order": "descending",
"method": "lastplayed"},
query_filter=self.inprogress_filter)
json_query = json.loads(json_query_string)
# If we found any, find the oldest unwatched show for each one.
if "result" in json_query and 'tvshows' in json_query['result']:
for item in json_query['result']['tvshows']:
if xbmc.abortRequested:
break
json_query2 = self.json_query("VideoLibrary.GetEpisodes", unplayed=True,
include_specials=True,
properties=self.tvepisode_properties,
sort={"method": "episode"}, limit=1,
params={"tvshowid": item['tvshowid']})
self.WINDOW.setProperty("recommended-episodes-data-%d"
% item['tvshowid'], json_query2)
return json_query_string
示例10: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def __init__(self):
log("version %s started" % ADDON_VERSION)
xbmc.executebuiltin('SetProperty(toolbox_running,True,home)')
self._init_vars()
self._parse_argv()
if self.infos:
self.StartInfoActions(self.infos, self.params)
elif not len(sys.argv) > 1:
self.selection_dialog()
xbmc.executebuiltin('ClearProperty(toolbox_running,home)')
while self.params.get("daemon", False) and not xbmc.abortRequested:
self.image_now = xbmc.getInfoLabel("Player.Art(thumb)")
if self.image_now != self.image_prev:
self.image_prev = self.image_now
image, imagecolor = Filter_Image(self.image_now, int(self.params.get("radius", 5)))
HOME.setProperty(self.params.get("prefix", "") + 'ImageFilter', image)
HOME.setProperty(self.params.get("prefix", "") + "ImageColor", imagecolor)
else:
xbmc.sleep(300)
示例11: service
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def service(self):
util.info("SOSAC Service Started")
try:
sleep_time = int(self.getSetting("start_sleep_time")) * 1000 * 60 * 60
except:
sleep_time = self.sleep_time
pass
self.sleep(sleep_time)
try:
self.last_run = float(self.cache.get("subscription.last_run"))
except:
self.last_run = time.time()
self.cache.set("subscription.last_run", str(self.last_run))
pass
if not xbmc.abortRequested and time.time() > self.last_run:
self.evalSchedules()
while not xbmc.abortRequested:
# evaluate subsciptions every 10 minutes
if(time.time() > self.last_run + 600):
self.evalSchedules()
self.last_run = time.time()
self.cache.set("subscription.last_run", str(self.last_run))
self.sleep(self.sleep_time)
util.info("SOSAC Shutdown")
示例12: evalSchedules
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def evalSchedules(self):
if not self.scanRunning() and not self.isPlaying():
notified = False
util.info("SOSAC Loading subscriptions")
subs = self.get_subs()
new_items = False
for url, sub in subs.iteritems():
if xbmc.abortRequested:
util.info("SOSAC Exiting")
return
if sub['type'] == sosac.LIBRARY_TYPE_TVSHOW:
if self.scanRunning() or self.isPlaying():
self.cache.delete("subscription.last_run")
return
refresh = int(sub['refresh'])
if refresh > 0:
next_check = sub['last_run'] + (refresh * 3600 * 24)
if next_check < time.time():
if not notified:
self.showNotification(
'Subscription', 'Chcecking')
notified = True
util.debug("SOSAC Refreshing " + url)
new_items |= self.run_custom({
'action': sosac.LIBRARY_ACTION_ADD,
'type': sosac.LIBRARY_TYPE_TVSHOW,
'update': True,
'url': url,
'name': sub['name'],
'refresh': sub['refresh']
})
self.sleep(3000)
else:
n = (next_check - time.time()) / 3600
util.debug("SOSAC Skipping " + url +
" , next check in %dh" % n)
if new_items:
xbmc.executebuiltin('UpdateLibrary(video)')
notified = False
else:
util.info("SOSAC Scan skipped")
示例13: sleep
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def sleep(sleep_time):
while not xbmc.abortRequested and sleep_time > 0:
sleep_time -= 1
xbmc.sleep(1)
示例14: _trackPosition
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def _trackPosition(self):
while self._playback_lock.isSet() and not xbmc.abortRequested:
try:
self._last_pos = player.getTime()
except:
self._playback_lock.clear()
log('Inside Player. Tracker time = %s' % self._last_pos)
xbmc.sleep(250)
log('Position tracker ending with last_pos = %s' % self._last_pos)
示例15: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import abortRequested [as 别名]
def __init__(self):
xbmc.Player().stop()
self.log=Logger("TSEngine")
self.push=Logger('OUT')
self.alive=True
self.progress = xbmcgui.DialogProgress()
self.player=None
self.files={}
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._sock.settimeout(3)
self.progress.create(translate(30000),translate(30043))
self.tsserv =None
self.conn=False
self.title=None
self.filename=None
self.mode=None
self.url=None
self.local=False
self.saved=False
self.canceled = False
self.pos=[25,50,75,100]
l=False
while xbmc.Player().isPlaying():
l=True
if xbmc.abortRequested:
self.log.out("XBMC asked to abort request")
return False
if self.progress.iscanceled():
self.canceled = True
return False
xbmc.sleep(300)
settings.setSetting('active','1')
if l: xbmc.sleep(500)