示例#1
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)
示例#2
0
 def setUp(self):
     self.api = MetaApi()
示例#3
0
def build_manga_list(verbose=True):

    api = MetaApi()
    chapterdates = ChapterDateHandler()

    allchapters = []

    allseries = api._manga_api.list_series()
    if verbose:
        print "Retrieved", len(allseries), "manga titles from API"
        print
    if DEBUG: allseries = allseries[0:3]
    ctr = 0
    for series in allseries:

        try:
            series = Series(series)
        except:
            pass

        seriesname = '(seriesname_unknown)'
        try:
            seriesname = series.locale.enUS.name
        except:
            pass
        try:
            seriesname = seriesname.decode("utf-8").encode('ascii', 'ignore')
        except:
            pass
        try:
            seriesname = re.sub(r'[^\x00-\x7F]', ' ', seriesname)
        except:
            pass

        try:
            time.sleep(REQUEST_WAIT_TIME)
            ctr += 1
            if verbose:
                print "[" + str(ctr) + "/" + str(
                    len(allseries)) + "]", "Getting", seriesname, "..."
            chapters = api.list_chapters(series)
            for chapter in chapters:
                try:
                    try:
                        chapter = Chapter(chapter)
                    except:
                        pass

                    date = chapterdates.get_chapter_date(chapter, series)

                    allchapters.append({
                        "series":
                        series.locale.enUS.name,
                        "series_id":
                        series.series_id,
                        "guid":
                        chapter.chapter_id,
                        "thumb":
                        series.locale.enUS.thumb_url,
                        "volume_id":
                        chapter.volume_id,
                        "number":
                        chapter.number,
                        "url":
                        MANGA_URL.replace("{volume_id}",
                                          chapter.volume_id).replace(
                                              "{number}", chapter.number),
                        "name":
                        chapter.locale.enUS.name,
                        "updated":
                        date,
                        "updated_t":
                        datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
                    })

                    chapterdates.save_chapter_date(chapter, date)
                except Exception as e:
                    log("      Skipped chapter %s in series %s (%s)" %
                        (chapter.locale.enUS.name, seriesname, str(e)))
                    pass
        except Exception as e:
            try:
                try:
                    log("      Skipped series %s (%s)" % (seriesname, str(e)))
                except:
                    log("      Error %s" % str(e))
                    log("      Also couldn't print series name")
            except:
                log("      Fatal error")

    chapterdates.save()

    return allchapters
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)
示例#5
0
- Let user select subtitle language
- Force --search, default to --help not search
- Let user pick more then one episode (Done 8/8/17)
- Use ffmpeg to combine mp4 and ass from download into mkv
#ffmpeg -i $SHOWFILENAME.mp4 -i $SHOWFILENAME.enUS.ass -map 0 -map 1 -c copy -metadata:s:s:0 language=eng -disposition:s:0 default $SHOWFILENAME.mkv
- Login to crunchyroll via website so login cookie can be used to get premium content (Simulcasts, 1080p, Premium only shows)
- Let users download shows from their queue
- Finish help section (Done 8/8/17)
'''

#User's OS ("Windows" or "Linux")
userOperatingSystem = platform.system()

#Starting variables
commandLineArguments = sys.argv
crunchyrollMetaAPI = MetaApi()
crunchyrollScraperAPI = ScraperApi(connector=requests)
simulateDownloadBoolean = False
queueArgument = False

#Loop variables
crunchyrollLoginAttempt = False
showSearchSuccess = False
showResultsSelectionCorrect = False
doLoginOrNot = False

#Command line arguments
for argumentItem in commandLineArguments[1:]:
    if argumentItem == "--simulate":
        simulateDownloadBoolean = True
    elif argumentItem == "--auth":
from __future__ import unicode_literals, print_function

import getpass
import sys

import requests
from crunchyroll.apis.errors import ApiLoginFailure
from crunchyroll.apis.meta import MetaApi, ScraperApi
from termcolor import colored as colorize
from youtube_dl import YoutubeDL as YouTubeDL

__version__ = "0.0.2"

# API and Starting variables
commandline_arguments = sys.argv  # use the argparse library instead.
crunchyroll_meta_api = MetaApi()
crunchyroll_scraper_api = ScraperApi(connector=requests)


def fail(obj):
    print(colorize(str(obj), color="red"))
    quit(1)  # error code 1 signifies failure


def login_to_crunchyroll(crunchyroll_username, crunchyroll_password):
    try:
        crunchyroll_meta_api.login(username=crunchyroll_username,
                                   password=crunchyroll_password)
    except ApiLoginFailure:
        fail("Invalid Username/Password combination.")
    else:
示例#7
0
webapp_port = Config.get("webapp", "port")
downloadPath = Config.get("xdcc", "downloadpath")
xdccNick = Config.get("xdcc", "nick")
transmission_rpc_host = Config.get("transmission", "rpc-host")
transmission_rpc_port = int(Config.get("transmission", "rpc-port"))
transmission_redirect_url = Config.get("transmission", "redirect-url")
transmission_rpc_username = Config.get("transmission", "username")
transmission_rpc_password = Config.get("transmission", "password")

#Initiaze various search engines
haruhichan_scraper = haruhichanScraper.haruhichanScraper()
ixirc_scraper = ixircScraper.ixircScraper()
daddicts_scraper = daddictsScraper.DAddictsScraper()
shanaproject_scraper = shanaprojectScraper.ShanaProjectScraper()
crunchyroll = MetaApi()
gooddrama_scraper = gooddramaScraper.GoodDramaScraper()
animeseason_scraper = animeseasonScraper.AnimeSeasonScraper()
tpb = TPB('https://thepiratebay.org')
transmission_client = Transmission(host=transmission_rpc_host,
                                   port=transmission_rpc_port,
                                   username=transmission_rpc_username,
                                   password=transmission_rpc_password)

xdccPool = []
#----------------------------------------
# controllers
#----------------------------------------


@app.route("/")
示例#8
0
### GLOBALS
global verbose, font_name, queue_separator
global ny_endpoint, html_parser
global memorable_path

verbose=True
font_name='Open-Sans-Semibold'
queue_separator='====='

ny_endpoint = "http://www.newyorker.com/cartoons/random/randomAPI1"
html_parser = HTMLParser()

memorable_path="/media/removable/sdcard/home/boodoo/Downloads/cornell/moviequotes.memorable_quotes.txt"

## For Crunchyroll:
api = MetaApi()
all_series = [series.name for series in api.list_anime_series(limit=1000)]

## REGULAR EXPRESIONS:
# Throw out junk strings (sound effects, speaker labels...)
junk_re = re.compile("^\d+\. |^\s*[\-\>\#]+| ?[A-Z]+: | \-+ |[\<\[\(].+?[\]\)\>]| \>\>")

# Split on meaningful punctuation followed by a space
# TODO: Avoid false splits like 'Dr.' and 'Mrs.'
split_re = re.compile("([\.\?\!]+\"?) +")

#################################################################
# ____  ____  ____  _  _   ___     _     _  _  ____  __  __
#(    \(  __)(  _ \/ )( \ / __)   ( )   / )( \(_  _)(  )(  )
# ) D ( ) _)  ) _ () \/ (( (_ \  (_ _)  ) \/ (  )(   )( / (_/\
#(____/(____)(____/\____/ \___/   (_)   \____/ (__) (__)\____/
示例#9
0
from crunchyroll.apis.meta import MetaApi
from crunchyroll.constants import META
api = MetaApi()
api.login(username=input("Crunchyroll username:\n"),password=input("\nCrunchyroll password:\n"))
queue=api.list_queue(media_types=[META.TYPE_ANIME])
for anime in queue:
    #add anime to mal
    pass