class TestIntegration(unittest.TestCase):
    def setUp(self):
        self.api = MetaApi()

    @skip_if_no_creds
    def test_login(self):
        self.api.login(username=CRUNCHYROLL_USERNAME, password=CRUNCHYROLL_PASSWORD)

    def test_login_fail(self):
        with self.assertRaises(ApiLoginFailure):
            self.api.login(username='******', password='******')

    def test_anime_search(self):
        self._series = self.api.search_anime_series('Space Brothers')[0]
        self.assertEqual('Space Brothers', self._series.name)

    def test_list_media(self):
        self._series = self.api.search_anime_series('Space Brothers')[0]
        self._media = self.api.list_media(self._series)
        self.assertEqual(99, len([ep for ep in self._media if not ep.clip]))
        self.assertEqual('Life Changes, Promises Don\'t', self._media[0].name)

    @skip_if_no_creds
    def test_subtitle_decryption(self):
        self.api.login(username=CRUNCHYROLL_USERNAME, password=CRUNCHYROLL_PASSWORD)
        series = self.api.search_anime_series('Space Brothers')[0]
        media = self.api.list_media(series)
        ep = [e for e in media if e.episode_number == '40'][0]

        stream = self.api.get_media_stream(ep, 0, 0)
        subs = stream.default_subtitles.decrypt().get_ass_formatted()
        self.assertIn('Hibito, let me see your back', subs)
class TestIntegration(unittest.TestCase):
    def setUp(self):
        self.api = MetaApi()

    @skip_if_no_creds
    def test_login(self):
        self.api.login(username=CRUNCHYROLL_USERNAME, password=CRUNCHYROLL_PASSWORD)

    def test_login_fail(self):
        with self.assertRaises(ApiLoginFailure):
            self.api.login(username='******', password='******')

    def test_search(self):
        self._series = self.api.search_anime_series('Space Brothers')[0]
        self.assertEqual('Space Brothers', self._series.name)

    def test_list_media(self):
        self._media = self.api.list_media(self._series)
        self.assertEqual(99, len([ep for ep in self._media if not ep.clip]))
        self.assertEqual('Life Changes, Promises Don\'t')
Пример #3
0
class TestIntegration(unittest.TestCase):
    def setUp(self):
        self.api = MetaApi()

    @skip_if_no_creds
    def test_login(self):
        self.api.login(username=CRUNCHYROLL_USERNAME, password=CRUNCHYROLL_PASSWORD)

    def test_login_fail(self):
        with self.assertRaises(ApiLoginFailure):
            self.api.login(username='******', password='******')

    def test_anime_search(self):
        self._series = self.api.search_anime_series('Space Brothers')[0]
        self.assertEqual('Space Brothers', self._series.name)

    def test_list_media(self):
        self._series = self.api.search_anime_series('Space Brothers')[0]
        self._media = self.api.list_media(self._series)
        self.assertEqual(99, len([ep for ep in self._media if not ep.clip]))
        self.assertEqual('Life Changes, Promises Don\'t', self._media[0].name)
Пример #4
0
            userResultInput = int(showResultsSelectionNumber
                                  )  #Asks the user to input the show number.
        except:
            print("Number entered or their is an error, please try again.")
        else:
            showResultsSelectionCorrect = True

    #Asks the user if the show that they want to watch is correct, returns it in a lower case format.
    confirmation = input(
        "Are you sure that {0} is the anime you want to watch?: ".format(
            userSearchOutput[userResultInput - 1].name)).lower()

    if confirmation == "yes":  #If yes it will return the episodes.
        print("These are the list of episodes available to watch. \n")
        userEpisodes = crunchyrollMetaAPI.list_media(userSearchOutput[
            userResultInput -
            1])  #Lists the media of the series they are trying to watch.
        #Number of episodes show has availiable
        userEpisodeNumber = len(userEpisodes)
        for x in userEpisodes:
            print("[{0}] Episode {1}: {2}".format(
                userEpisodeNumber, x.episode_number,
                x.name))  #Prints the available list of episodes.
            userEpisodeNumber -= 1
        episodeNumberInput = input(
            "Input the id number of the episode(s) you want to watch (Look at --help's \"Multi-Episode Selection Guide\" for help): "
        )

        ydl_opts = {
            "simulate":
            simulateDownloadBoolean,