def readlink(self, pieces): # need at least two levels for this to make sense: -2 is the movie dir, -1 is the filename if len(pieces) <= 1: raise OSError(ENOENT, '') else: movie = db.movieFromCache(pieces[-2]) # we have an actual movie selected here - just return its personal directory if not movie or movie is None: raise OSError(ENOENT, '') return os.path.abspath( self.pathbase + '/' + movie.path )
def readlink(self, pieces): # need at least two levels for this to make sense: -2 is the movie dir, -1 is the filename if len(pieces) <= 1: raise OSError(ENOENT, '') else: movie = db.movieFromCache(pieces[-2]) # we have an actual movie selected here - just return its personal directory if not movie or movie is None: raise OSError(ENOENT, '') return os.path.abspath(self.pathbase + '/' + movie.path)
def readdir(self, pieces, fh): # shouldn't happen - this is typically the case handled by inheriting classes if len(pieces) == 0: raise OSError(ENOENT, '') else: # we have an actual movie selected here - just return its personal directory movie = db.movieFromCache(pieces[-1]) if not movie or movie is None: raise OSError(ENOENT, '') return ['.', '..', os.path.basename(movie.path).replace(os.sep, ' '), 'info' ]
def readdir(self, pieces, fh): # shouldn't happen - this is typically the case handled by inheriting classes if len(pieces) == 0: raise OSError(ENOENT, '') else: # we have an actual movie selected here - just return its personal directory movie = db.movieFromCache(pieces[-1]) if not movie or movie is None: raise OSError(ENOENT, '') return [ '.', '..', os.path.basename(movie.path).replace(os.sep, ' '), 'info' ]
def read(self, pieces, size, offset, fh=None): if len(pieces) <= 1 or pieces[-1] != 'info': raise OSError(ENOENT, '') movie = db.movieFromCache(pieces[-2]) return movie.printinfo()
# we have an actual movie selected here - just return its personal directory if not movie or movie is None: raise OSError(ENOENT, '') return os.path.abspath(self.pathbase + '/' + movie.path) def getattr(self, pieces, fh=None): if len(pieces) <= 1: # probably a directory.. either way, this is just here for convenience. st = { 'st_mode': S_IFDIR | 0755, 'st_nlink': 2, } st['st_ctime'] = st['st_mtime'] = st['st_atime'] = time() return st else: movie = db.movieFromCache(pieces[-2]) if movie is None or movie is None: raise OSError(ENOENT, '') if pieces[-1] == 'info': # otherwise, it's a symbolic link st = { 'st_mode': S_IFREG | 0644, 'st_size': len(movie.printinfo()), 'st_nlink': 1, } st['st_ctime'] = st['st_mtime'] = st['st_atime'] = time() return st elif pieces[-1] == os.path.basename(movie.path).replace( os.sep, ' '): # otherwise, it's a symbolic link st = {
# we have an actual movie selected here - just return its personal directory if not movie or movie is None: raise OSError(ENOENT, '') return os.path.abspath( self.pathbase + '/' + movie.path ) def getattr(self, pieces, fh=None): if len(pieces) <= 1: # probably a directory.. either way, this is just here for convenience. st = { 'st_mode': S_IFDIR | 0755, 'st_nlink': 2, } st['st_ctime'] = st['st_mtime'] = st['st_atime'] = time() return st else: movie = db.movieFromCache(pieces[-2]) if movie is None or movie is None: raise OSError(ENOENT, '') if pieces[-1] == 'info': # otherwise, it's a symbolic link st = { 'st_mode': S_IFREG | 0644, 'st_size': len(movie.printinfo()), 'st_nlink': 1, } st['st_ctime'] = st['st_mtime'] = st['st_atime'] = time() return st elif pieces[-1] == os.path.basename(movie.path).replace(os.sep, ' '): # otherwise, it's a symbolic link st = { 'st_mode': S_IFLNK | 0777,