本文整理汇总了Python中util.logDebug函数的典型用法代码示例。如果您正苦于以下问题:Python logDebug函数的具体用法?Python logDebug怎么用?Python logDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clientAction
def clientAction(self, client, move):
"""violation: player may not say mah jongg"""
move.player.popupMsg(self)
move.player.mayWin = False
if Debug.originalCall:
logDebug('%s: cleared mayWin' % move.player)
return client.ask(move, [Message.OK])
示例2: switchUser
def switchUser(self, userId, pin):
if not self.authenticationToken: return False
url = MyPlexService.SWITCHUSER_URL % (userId, pin)
http = self.plexManager.buildPlexHttpRequest()
http.SetHttpHeader('X-Plex-Token',self.authenticationToken)
data = http.Post(url)
if not data:
if http.ResultUnauthorised() and pin != '':
util.logDebug("User switch failed PIN invalid");
return PlexManager.ERR_USER_PIN_FAILED
util.logDebug("Error failed to access users %s HttpCode: %d" % (url, http.code));
return PlexManager.ERR_USER_OTHER
tree = ElementTree.fromstring(data)
token = None
for child in tree:
if child.tag == 'authentication-token':
token = child.text
break
if token is None:
return PlexManager.ERR_USER_OTHER
#Set usertoken
self.userToken = token
#reload myplex servers
self.loadServers()
return PlexManager.SUCCESS
示例3: monitorPlayback
def monitorPlayback(self, key, offset):
progress = 0
#Whilst the file is playing back
while xbmc.Player().isPlaying():
#Get the current playback time
currentTime = int(xbmc.Player().getTime())
totalTime = int(xbmc.Player().getTotalTime())
try:
progress = int(( float(currentTime) / float(totalTime) ) * 100)
except:
progress = 0
#If we are less than 95% complete, store resume time
if progress > 0 and progress < 95:
progress=currentTime*1000
if offset == 0:
#Clear it, likely start from beginning clicked
offset = 1
self.setMediaWatched(key)
self.setMediaPlayedPosition(key, progress)
#Otherwise, mark as watched
elif progress >= 95:
self.setMediaWatched(key)
break
xbmc.sleep(5000)
#If we get this far, playback has stopped
util.logDebug("Playback Stopped (or at 95%)")
示例4: checkMovie
def checkMovie(self, movie):
imdbNumber = movie["imdbnumber"]
oldPosition = movie["top250"]
if imdbNumber == "":
util.logWarning("%(label)s: no IMDb id" % movie)
return None
if imdbNumber in self.top250:
newPosition = self.top250[imdbNumber]["position"]
self.notMissing.add(imdbNumber)
if oldPosition == newPosition:
util.logDebug("%(label)s: up to date" % movie)
return None
self.updateMovie(movie, newPosition)
if oldPosition == 0:
util.log("%s: added at position %s" % (movie["label"], newPosition))
return "added"
util.log("%s: updated from %s to %s" % (movie["label"], oldPosition, newPosition))
return "updated"
if oldPosition != 0:
util.log("%(label)s: was removed because no more in IMDb Top250" % movie)
self.updateMovie(movie, 0)
return "removed"
示例5: transaction
def transaction(self, silent=None):
"""commit and log it"""
if QSqlDatabase.transaction(self):
if not silent and Debug.sql:
logDebug('%x started transaction' % id(self))
else:
logWarning('%s cannot start transaction: %s' % (self.name, self.lastError()))
示例6: speak
def speak(self, text, angle):
"""text must be a sound filename without extension"""
fileName = self.localTextName(text, angle)
if not os.path.exists(fileName):
if Debug.sound:
logDebug('Voice.speak: fileName %s not found' % fileName)
Sound.speak(fileName)
示例7: deleteFromPlaylist
def deleteFromPlaylist(self, server, playlistId, itemId):
#Delete - DELETE http://10.1.3.200:32400/playlists/35339/items/72
url = server.getUrl("/playlists/%s/items/%s" % (playlistId, itemId))
util.logDebug("Deleting playlist item: "+url)
http = self.buildPlexHttpRequest()
http.Delete(url)
PlexManager.handleRequestError(http)
示例8: getVideoDirectStreamUrl
def getVideoDirectStreamUrl(self, manager, mediaKey, mediaIndex, partIndex, offset = 0):
args = dict()
args['path']="http://127.0.0.1:"+str(self.port)+"/library/metadata/" + str(mediaKey)
args['mediaIndex']=str(mediaIndex)
args['partIndex']=str(partIndex)
#args['protocol']="http"
args['protocol']="hls"
#args['protocol']="dash"
args['offset']=str(offset)
args['fastSeek']="1"
args['directPlay']="0"
args['directStream']="1"
args['waitForSegments']="1"
args['videoQuality']="100"
args['subtitleSize']="100"
args['audioBoost']="100"
args['X-Plex-Product']=manager.xPlexProduct
args['X-Plex-Version']=manager.xPlexVersion
args['X-Plex-Client-Identifier']=manager.xPlexClientIdentifier
args['X-Plex-Platform']=manager.xPlexPlatform
args['X-Plex-Platform-Version']=manager.xPlexPlatformVersion
args['X-Plex-Device']=manager.xPlexDevice
args['Accept-Language']="en"
url = self.getUrl(PlexServer.TRANSCODE_URL, args)
util.logDebug("-->Setting direct stream: "+url)
return url
示例9: hideTableList
def hideTableList(result):
"""hide it only after player says I am ready"""
if result == Message.OK and client.tableList:
if Debug.table:
logDebug('%s hiding table list because game started' % client.name)
client.tableList.hide()
return result
示例10: start
def start(self, dummyResults='DIREKT'):
"""start the animation, returning its deferred"""
assert self.state() != QAbstractAnimation.Running
tiles = set()
for animation in self.animations:
tile = animation.targetObject()
self.debug |= tile.element in Debug.animation
tiles.add(tile)
tile.setActiveAnimation(animation)
self.addAnimation(animation)
propName = animation.pName()
animation.setStartValue(tile.getValue(propName))
if propName == 'rotation':
# change direction if that makes the difference smaller
endValue = animation.unpackEndValue()
currValue = tile.rotation
if endValue - currValue > 180:
animation.setStartValue(currValue + 360)
if currValue - endValue > 180:
animation.setStartValue(currValue - 360)
for tile in tiles:
tile.graphics.setDrawingOrder()
self.finished.connect(self.allFinished)
scene = Internal.field.centralScene
scene.disableFocusRect = True
QParallelAnimationGroup.start(self, QAbstractAnimation.DeleteWhenStopped)
if self.debug:
logDebug('Animation group %d started (%s)' % (
id(self), ','.join('A%d' % (id(x) % 10000) for x in self.animations)))
return succeed(None)
示例11: __init__
def __init__(self, hand, meld=None, idx=None, xoffset=None, yoffset=None):
if isinstance(hand, Tile):
self.element = hand.element
self.xoffset = hand.xoffset
self.yoffset = hand.yoffset
self.dark = hand.dark
self.focusable = hand.focusable
else:
self.element = meld.pairs[idx] if idx is not None else meld
self.xoffset = xoffset
self.yoffset = yoffset
player = hand.player
isScoringGame = player.game.isScoringGame()
if yoffset == 0:
self.dark = self.element.istitle()
else:
self.dark = self.element == 'Xy' or isScoringGame
self.focusable = True
if isScoringGame:
self.focusable = idx == 0
else:
self.focusable = (self.element[0] not in 'fy'
and self.element != 'Xy'
and player == player.game.activePlayer
and player == player.game.myself
and (meld.state == CONCEALED
and (len(meld) < 4 or meld.meldType == REST)))
if self.element in Debug.focusable:
logDebug('TileAttr %s:%s' % (self.element, self.focusable))
示例12: initDb
def initDb():
"""open the db, create or update it if needed.
Returns a dbHandle."""
dbhandle = QSqlDatabase("QSQLITE")
if InternalParameters.isServer:
name = 'kajonggserver.db'
else:
name = 'kajongg.db'
dbpath = InternalParameters.dbPath or appdataDir() + name
dbhandle.setDatabaseName(dbpath)
dbExisted = os.path.exists(dbpath)
if Debug.sql:
logDebug('%s database %s' % \
('using' if dbExisted else 'creating', dbpath))
# timeout in msec:
dbhandle.setConnectOptions("QSQLITE_BUSY_TIMEOUT=2000")
if not dbhandle.open():
logError('%s %s' % (str(dbhandle.lastError().text()), dbpath))
sys.exit(1)
with Transaction(dbhandle=dbhandle):
if not dbExisted:
Query.createTables(dbhandle)
else:
Query.upgradeDb(dbhandle)
generateDbIdent(dbhandle)
return dbhandle
示例13: rollback
def rollback(self, silent=None):
"""rollback and log it"""
if QSqlDatabase.rollback(self):
if not silent and Debug.sql:
logDebug('%x rollbacked transaction' % id(self))
else:
logWarning('%s cannot rollback: %s' % (self.name, self.lastError()))
示例14: getData
def getData(self, url, args = None):
if not args is None:
url = util.buildUrl(url, args)
util.logDebug("Retrieving data from: %s" % url)
http = util.Http()
data = http.Get(url)
PlexManager.handleRequestError(http)
return data
示例15: setEndValue
def setEndValue(self, endValue):
"""wrapper with debugging code"""
tile = self.targetObject()
if tile.element in Debug.animation:
pName = self.pName()
logDebug('%s: change endValue for %s: %s->%s %s' % (self.ident(), pName, self.formatValue(self.endValue()),
self.formatValue(endValue), str(tile)))
QPropertyAnimation.setEndValue(self, endValue)