Example #1
0
def get_caption(job_id, caption_options, caption_format, username, password,
                api_securekey, api_token, server_url, verbose_mode):
    print "Getting caption..."
    __set_verbose(verbose_mode)
    actions = __initialize_actions(server_url)
    token = __get_token(actions, username, password, api_securekey, api_token)
    # Parse options
    caption_opts = CaptionOptions()
    caption_opts.populate_from_list(caption_options)
    caption = actions.get_caption(token, job_id, caption_format, caption_opts)
    print caption
Example #2
0
 def test_get_caption_build_url(self):
     options = CaptionOptions(build_url=True)
     caption_url = self.actions.get_caption(self.api_token, self.job_id,
                                            CaptionFormat.SRT, options)
     parsed_url = urlparse(caption_url)
     self.assertIsNot(parsed_url.scheme, '')
     self.assertIsNot(parsed_url.netloc, '')
     self.assertTrue(
         caption_url.__contains__('http'))  # URL must be returned
Example #3
0
def get_caption(job_id,
                caption_options,
                caption_format,
                username,
                password,
                api_securekey,
                api_token,
                server_url,
                verbose_mode):
    print "Getting caption..."
    __set_verbose(verbose_mode)
    actions = __initialize_actions(server_url)
    token = __get_token(actions, username, password, api_securekey, api_token)
    # Parse options
    caption_opts = CaptionOptions()
    caption_opts.populate_from_list(caption_options)
    caption = actions.get_caption(token, job_id, caption_format, caption_opts)
    print caption
Example #4
0
 def test_options_populate_from_list(self):
     options = CaptionOptions()
     options.populate_from_list(['build_url=true', 'dfxp_header=header'])
     # Can only assert length because Dict produces different order each time
     self.assertEqual(len('build_url=true&dfxp_header=header'),
                      len(options.to_query()))
Example #5
0
 def test_get_caption(self):
     options = CaptionOptions(caption_by_sentence=True)
     self.actions.get_caption(self.api_token, self.job_id,
                              CaptionFormat.SRT, options)
Example #6
0
 def test_options_populate_from_list(self):
     options = CaptionOptions()
     options.populate_from_list(['build_url=true', 'dfxp_header=header'])
     # Can only assert length because Dict produces different order each time
     self.assertEqual(len('build_url=true&dfxp_header=header'), len(options.to_query()))