Example #1
0
 def iter_create(self):
     dirs = glob.glob(os.path.join(self.path, "*"))
     dirs.sort()
     for path in dirs:
         if os.path.isdir(path):
             files = glob.glob(os.path.join(path, "*"))
             pictures = [f for f in files if os.path.splitext(f)[1].lower() in Pictures.valid_file_types]
             videos = [f for f in files if os.path.splitext(f)[1].lower()[1:] in HomeVideos.valid_file_types]
             if pictures:
                 yield utils.decode_title_text(os.path.basename(path)), Pictures(self.config, path)
             if videos:
                 yield utils.decode_title_text(os.path.basename(path)) + " (videos)", HomeVideos(self.config, videos)
             if not pictures and not videos:
                 subdirs = [d for d in files if os.path.isdir(d)]
                 if subdirs:
                     yield utils.decode_title_text(os.path.basename(path)) + " (folders)", PhotoFolder(self.config, path)
Example #2
0
 def iter_create(self):
     db = self.config.get_photo_database()
     for path in db.paths:
         yield utils.decode_title_text(os.path.basename(path)), PhotoFolder(self.config, path)
Example #3
0
 def iter_create(self):
     for video in self.videos:
         yield utils.decode_title_text(os.path.basename(video)), HomeVideoPlay(self.config, video)