Python xbmcvfs.Stat() Examples

The following are 13 code examples of xbmcvfs.Stat(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcvfs , or try the search function .
Example #1
Source File: webservice.py    From plugin.video.emby with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: filetools.py    From addon with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #3
Source File: webservice.py    From script.skin.helper.service with GNU General Public License v2.0 6 votes vote down vote up
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") 
Example #4
Source File: kodiutils.py    From script.module.inputstreamhelper with MIT License 5 votes vote down vote up
def stat_file(path):
    """Return information about a file (using xbmcvfs)"""
    from xbmcvfs import Stat
    return Stat(from_unicode(path)) 
Example #5
Source File: source.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #6
Source File: reporting.py    From script.artwork.beef with MIT License 5 votes vote down vote up
def _should_rotate():
    if not _exists():
        return False
    return xbmcvfs.Stat(_get_filepath()).st_size() > _get_maxsize() 
Example #7
Source File: vfs.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def get_stat(path):
	return xbmcvfs.Stat(path) 
Example #8
Source File: vfs.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def get_size(path):
	return xbmcvfs.Stat(path).st_size() 
Example #9
Source File: vfs.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def get_mtime(path):
	return xbmcvfs.Stat(path).st_mtime() 
Example #10
Source File: vfs.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def get_ctime(path):
	return xbmcvfs.Stat(path).st_ctime() 
Example #11
Source File: vfs.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def get_atime(path):
	return xbmcvfs.Stat(path).st_atime() 
Example #12
Source File: source.py    From FTV-Guide-Repo with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #13
Source File: kodiutils.py    From plugin.video.vrt.nu with GNU General Public License v3.0 5 votes vote down vote up
def stat_file(path):
    """Return information about a file (using xbmcvfs)"""
    from xbmcvfs import Stat
    return Stat(path)