def main(): if len(sys.argv) == 1: print 'No source URLs given.' sys.exit() # Get channel channel = sys.argv[1] cfgMgr = ConfigManager(channel) if not cfgMgr.load(): sys.exit() # dest_url: this url can change dest_url = cfgMgr.url file_list = {} while True: plist_extr = indexPListExtr(dest_url, cfgMgr.logger) ret_plist = plist_extr.retrieveAndProcess() if not isinstance(ret_plist, dict): time.sleep(cfgMgr.fileduration) continue if ret_plist['plist_array']: downloadSegments(ret_plist, file_list, cfgMgr.destination) else: dest_url = ret_plist['plist_url'] time.sleep(cfgMgr.fileduration)
def testSearchSettingInvalidENV(self): os.environ['INVALID_TEST_ENV_URL'] = "http://yahoo.com" self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "url", "TEST_ENV_URL"), "http://www.google.com", 'Test ENV error' )
def testSearchSettingNoOption(self): self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "uri"), None, 'Test option error' )
def testSearchSettingNoSection(self): self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_b", "url"), None, 'Test section error' )
def testSearchSettingsNotRawConfigParser(self): self.assertEqual(ConfigManager.searchSetting("NotRawConfigParserInstance", "test_a", "url"), None, 'Test parser instance error' )
def testSearchSettingValidENV(self): os.environ['TEST_ENV_URL'] = "http://yahoo.com" self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "url", "TEST_ENV_URL"), "http://yahoo.com", 'Test option error' )
def testSearchSettingValidParamsNoENV(self): self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "url"), "http://www.google.com", 'Invalid Param')