本文整理汇总了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)