def test_Init(self): #Try the normal constructor vfs = VirtualFileSystem()
def __init__(self): #Create a manager for different instances. self.manager = OneServerManager() # Load the configurations. self.config = ConfigManager() self.config.loadConfigFile() self.manager.config = self.config # Start logging. self.log = logging.getLogger('oneserver') logHandler = logging.StreamHandler() logHandler.setFormatter( logging.Formatter('[%(asctime)s] %(levelname)s: %(message)s')) self.log.addHandler(logHandler) self.log.setLevel(logging.DEBUG) # TODO: Add file handler for writing to a file. self.manager.log = self.log self.log.info('Preparing the OneServer media server to start...') # Start plugin loader. self.pluginManager = PluginManager() self.manager.pluginManager = self.pluginManager self.pluginManager.loadEnablePluginList(self.config) self.pluginManager.loadPlugins() self.pluginManager.enableAdminPlugins() self.pluginManager.enableStoragePlugins() self.pluginManager.enableUtilityPlugins() self.storagePlugins = self.pluginManager.getStoragePlugins() self.adminPlugins = self.pluginManager.getAdminPlugins() self.utilityPlugins = self.pluginManager.getUtilityPlugins() # Start scheduler. self.log.debug('Starting task scheduler...') self.scheduler = TaskScheduler() self.manager.scheduler = self.scheduler self.scheduler.startScheduler() self.log.debug('Task scheduler started.') # Start VFS self.log.debug('Starting virtual file system...') #TODO: Load loaded Storage plugins into vfs self.vfs = VirtualFileSystem() plugins = self.storagePlugins for plugin in plugins: if plugin != None: self.log.debug("Loading Storage Plugin : " + plugin) self.vfs.loadDataSource(plugin) self.log.debug('Virtual file system started.') # Start DLNA self.log.debug('Preparing DLNA service...') self.dlna = DLNAService(self.config) self.manager.dlna = self.dlna.dlna self.log.debug('DLNA service ready.') #Temporary Content Store self.log.debug('Creating temporary content store...') tcsRoot = tcs.populate([ "samples/sample.mp4", "samples/sample.mp3", "samples/movie.mp4", "samples/sample.jpg" ]) self.manager.rootEntry.addChild(tcsRoot) tcsRoot.parent = self.manager.rootEntry self.log.debug('Temporary content store ready.') # Set the singleton instance. OneServer.instance = self
def setUp(self): self.vfs = VirtualFileSystem() self.plugin = testPlugin() self.vfs.loadDataSource(self.plugin)