コード例 #1
0
 def __addVideos(self, parentPath, videos):
     logging.debug("YoutubeFUSE adding videos inodes to %s",\
         parentPath)
     parentInode = self.inodeCache.getInode(parentPath)
     for video in videos:
         logging.debug("YoutubeFUSE adding video %s", video.title)
         mode = stat.S_IFREG | 0444
         path = ("%s/%s.%s") % (parentPath,video.title,\
                     youtube.fs.VIDEO_FILE_EXTENSION)
         videoInode =  YoutubeFSInode(path,mode,\
                     video.id,video.ctime,video.mtime)
         videoInode.setData(video.getContents())
         self.inodeCache.addInode(videoInode)
         parentInode.addChildInode(videoInode)
コード例 #2
0
ファイル: youtubefuse.py プロジェクト: duck57/youtubefs
 def __addProfileInode(self):
     #
     # Add the profile file
     #
     profile = self.youtubeUser.getProfile()
     mode = stat.S_IFREG | 0444
     profileInode = YoutubeFSInode('/profile',mode,\
             0,profile.ctime,profile.mtime)
     profileInode.ctime  = profile.ctime
     profileInode.mtime  = profile.mtime
     profileInode.setData(profile.getData())
     self.inodeCache.addInode(profileInode) 
     rootDirInode = self.inodeCache.getInode('/')
     rootDirInode.addChildInode(profileInode)
コード例 #3
0
ファイル: youtubefuse.py プロジェクト: duck57/youtubefs
 def __addVideos(self,parentPath,videos):
     logging.debug("YoutubeFUSE adding videos inodes to %s",\
         parentPath)
     parentInode =  self.inodeCache.getInode(parentPath)
     for video in videos:
         logging.debug("YoutubeFUSE adding video %s",video.title)
         mode = stat.S_IFREG | 0444
         path = ("%s/%s.%s") % (parentPath,video.title,\
                     youtube.fs.VIDEO_FILE_EXTENSION)
         videoInode =  YoutubeFSInode(path,mode,\
                     video.id,video.ctime,video.mtime)
         videoInode.setData(video.getContents())
         self.inodeCache.addInode(videoInode) 
         parentInode.addChildInode(videoInode)
コード例 #4
0
 def __addRootInode(self):
     #
     # Added the root directory inode
     #
     mode = stat.S_IFDIR | 0755
     rootDirInode = YoutubeFSInode('/',mode,0,\
         long(time.time()),long(time.time()))
     self.inodeCache.addInode(rootDirInode)
コード例 #5
0
 def __addSubDir(self, parent, dir):
     regex = re.compile('//')
     mode = stat.S_IFDIR | 0755
     dirPath = "%s/%s" % (parent, dir)
     dirPath = regex.sub('/', dirPath)
     logging.debug("YoutubeFUSE adding subdir %s", dirPath)
     dirInode = YoutubeFSInode(dirPath,mode,0,\
         long(time.time()),long(time.time()))
     self.inodeCache.addInode(dirInode)
     rootDirInode = self.inodeCache.getInode(parent)
     rootDirInode.addChildInode(dirInode)
コード例 #6
0
 def __addPlaylists(self, parent, playlists):
     for playlist in playlists:
         playlistsDirInode = self.inodeCache.getInode(parent)
         plPath = "%s/%s" % (parent, playlist.title)
         logging.debug("YoutubeFUSE adding playlist %s", plPath)
         mode = stat.S_IFDIR | 0755
         playlistInode = YoutubeFSInode(plPath,mode,\
             0,playlist.ctime,playlist.mtime)
         self.inodeCache.addInode(playlistInode)
         playlistsDirInode.addChildInode(playlistInode)
         self.__addVideos(plPath, playlist.getVideos())
コード例 #7
0
 def __addFavouritesInode(self):
     #
     # Get the favourite videos
     #
     favourities = self.youtubeUser.getFavourities()
     mode = stat.S_IFDIR | 0755
     favouritesInode = YoutubeFSInode('/favourites',mode,\
             0,favourities.ctime,favourities.mtime)
     self.inodeCache.addInode(favouritesInode)
     rootDirInode = self.inodeCache.getInode('/')
     rootDirInode.addChildInode(favouritesInode)
     self.__addVideos("/favourites", favourities.getVideos())
コード例 #8
0
 def __addProfileInode(self):
     #
     # Add the profile file
     #
     profile = self.youtubeUser.getProfile()
     mode = stat.S_IFREG | 0444
     profileInode = YoutubeFSInode('/profile',mode,\
             0,profile.ctime,profile.mtime)
     profileInode.ctime = profile.ctime
     profileInode.mtime = profile.mtime
     profileInode.setData(profile.getData())
     self.inodeCache.addInode(profileInode)
     rootDirInode = self.inodeCache.getInode('/')
     rootDirInode.addChildInode(profileInode)