本文整理匯總了Python中xbmcvfs.Stat方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmcvfs.Stat方法的具體用法?Python xbmcvfs.Stat怎麽用?Python xbmcvfs.Stat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xbmcvfs
的用法示例。
在下文中一共展示了xbmcvfs.Stat方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: images
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def images(self):
''' Return a dummy image for unwanted images requests over the webservice.
Required to prevent freezing of widget playback if the file url has no
local textures cached yet.
'''
image = xbmc.translatePath("special://home/addons/plugin.video.emby/icon.png").decode('utf-8')
self.send_response(200)
self.send_header('Content-type', 'image/png')
modified = xbmcvfs.Stat(image).st_mtime()
self.send_header('Last-Modified', "%s" % modified)
image = xbmcvfs.File(image)
size = image.size()
self.send_header('Content-Length', str(size))
self.end_headers()
self.wfile.write(image.readBytes())
image.close()
示例2: file_stat
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def file_stat(path, silent=False, vfs=True):
"""
Stat de un archivo
@param path: ruta
@type path: str
@rtype: str
@return: objeto file
"""
path = encode(path)
try:
if xbmc_vfs and vfs:
if not exists(path): return False
return xbmcvfs.Stat(path)
raise
except:
logger.error("File_Stat no soportado: %s" % path)
if not silent:
logger.error(traceback.format_exc())
return False
示例3: handle_image
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def handle_image(self, image):
'''serve image'''
if image:
# send single image
try:
ext = image.split(".")[-1]
cherrypy.response.headers['Content-Type'] = 'image/%s' % ext
modified = xbmcvfs.Stat(image).st_mtime()
cherrypy.response.headers['Last-Modified'] = "%s" % modified
image = xbmcvfs.File(image)
cherrypy.response.headers['Content-Length'] = str(image.size())
if cherrypy.request.method.upper() == 'GET':
img_data = image.readBytes()
image.close()
return str(img_data)
else:
image.close()
except Exception as exc:
log_exception(__name__, exc)
else:
raise cherrypy.HTTPError(404, "No image found matching the criteria")
示例4: stat_file
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def stat_file(path):
"""Return information about a file (using xbmcvfs)"""
from xbmcvfs import Stat
return Stat(from_unicode(path))
示例5: isUpdated
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def isUpdated(self, channelsLastUpdated, programLastUpdate):
if channelsLastUpdated is None or not xbmcvfs.exists(self.xmltvFile):
return True
stat = xbmcvfs.Stat(self.xmltvFile)
fileUpdated = datetime.datetime.fromtimestamp(stat.st_mtime())
return fileUpdated > channelsLastUpdated
示例6: _should_rotate
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def _should_rotate():
if not _exists():
return False
return xbmcvfs.Stat(_get_filepath()).st_size() > _get_maxsize()
示例7: get_stat
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def get_stat(path):
return xbmcvfs.Stat(path)
示例8: get_size
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def get_size(path):
return xbmcvfs.Stat(path).st_size()
示例9: get_mtime
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def get_mtime(path):
return xbmcvfs.Stat(path).st_mtime()
示例10: get_ctime
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def get_ctime(path):
return xbmcvfs.Stat(path).st_ctime()
示例11: get_atime
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def get_atime(path):
return xbmcvfs.Stat(path).st_atime()
示例12: stat_file
# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import Stat [as 別名]
def stat_file(path):
"""Return information about a file (using xbmcvfs)"""
from xbmcvfs import Stat
return Stat(path)