Exemple #1
0
	def test_search_and_choose(self):
		""" Whole process """
		ep_finder = NetworkEpisodeVideoFinder()
		def print_results(results):
			""" presentation callback"""
			#print("Résultats {}".format(len(results)))
			pass
		def catch_err(res):
			""" error callback """
			print "err catched {}".format(res)
		def choose(res):
			""" choose callback, actually launches a dl
			"""

			info("res {}".format(res))
			info( "Choosing {}".format(ep_finder.candidates[0]))
			ep_finder.on_chosen_launch_dl(ep_finder.candidates[0])
			info ("dl_launched ?")
			return True

		final_test = OnEventDeferred(ep_finder, "download_launched")
		final_test.add_error_event(ep_finder, "download_not_launched")

		candidates_found = OnEventDeferred(ep_finder, "candidates_found")\
				.addCallback(choose).addErrback(catch_err)
		ep_find = ep_finder.search_newep(self.episode)\
				.addCallback(print_results)
		return final_test.addBoth(catch_err)
	def test_search_and_choose(self):
		ep_finder = EpisodeVideoFinder()
		def print_results(results):
			pass
			#print("Résultats {}".format(len(results)))
		def catch_err(res):
			print "err catched {}".format(res)
		def choose(res):
			print ep_finder.candidates[0]
			ep_finder.on_chosen_launch_dl(ep_finder.candidates[0])
			print "dl_launched ?" 
			return True

		final_test = OnEventDeferred(ep_finder,"download_launched")
		final_test.add_error_event(ep_finder,"download_not_launched")

		candidates_found = OnEventDeferred(ep_finder,"candidates_found")\
				.addCallback(choose).addErrback(catch_err)
		ep_find = ep_finder.search_newep(self.episode).addCallback(print_results)
		
		return final_test.addBoth(catch_err) 
    def test_search_and_choose(self):
        ep_finder = EpisodeVideoFinder()

        def print_results(results):
            pass
            # print("Résultats {}".format(len(results)))

        def catch_err(res):
            print "err catched {}".format(res)

        def choose(res):
            print ep_finder.candidates[0]
            ep_finder.on_chosen_launch_dl(ep_finder.candidates[0])
            print "dl_launched ?"
            return True

        final_test = OnEventDeferred(ep_finder, "download_launched")
        final_test.add_error_event(ep_finder, "download_not_launched")

        candidates_found = OnEventDeferred(ep_finder, "candidates_found").addCallback(choose).addErrback(catch_err)
        ep_find = ep_finder.search_newep(self.episode).addCallback(print_results)

        return final_test.addBoth(catch_err)