Esempio n. 1
0
File: vdl.py Progetto: xiaowei-w/vdl
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)
Esempio n. 2
0
 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' )
Esempio n. 3
0
 def testSearchSettingNoOption(self):
     self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "uri"), None, 'Test option error' )
Esempio n. 4
0
 def testSearchSettingNoSection(self):
     self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_b", "url"), None, 'Test section error' )
Esempio n. 5
0
 def testSearchSettingsNotRawConfigParser(self):
     self.assertEqual(ConfigManager.searchSetting("NotRawConfigParserInstance", "test_a", "url"), None, 'Test parser instance error' )
Esempio n. 6
0
 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' )
Esempio n. 7
0
 def testSearchSettingValidParamsNoENV(self):
     self.assertEqual(ConfigManager.searchSetting(self.testA_cfg_psr, "test_a", "url"), "http://www.google.com", 'Invalid Param')