Source code for load_folders

# load_folders_gtk.py
# By MW, Jul 2013
# GPLv3+
#
# Backed to load multi folder data

import logging, os

[docs]class Loader : def __init__(self) : self.folders = [] # A list of folders
[docs] def add_channel(self, f, name) : """Add a folder that will be considered as a new channel""" if os.path.isdir(f) : self.folders.append({'name' : name, 'folder' : f}) logging.info("Folder %s added as a channel.", f) else : logging.error("Folder %s does not exist.", f)
[docs] def get_frames_object(self) : res = [] for folder in self.folders : ch_files = os.listdir(folder['folder']) folder["frames"] = ch_files res.append(folder) return {'type' : 'frames', 'value' : res}