예제 #1
0
def PLAY(payload):
    anime_url, episode = payload.rsplit("/", 1)
    s = SourcesList(
        NineAnimeBrowser().get_episode_sources(anime_url, int(episode)), {
            'title': control.lang(30100),
            'processing': control.lang(30101),
            'choose': control.lang(30102),
            'notfound': control.lang(30103),
        })
    return control.play_source(s.get_video_link())
예제 #2
0
def LIST_GENRES(payload):
    return control.draw_items(NineAnimeBrowser().get_genres())
예제 #3
0
def GENRE_ANIMES(payload):
    genre, page = payload.rsplit("/", 1)
    return control.draw_items(NineAnimeBrowser().get_genre(genre, int(page)))
예제 #4
0
def SEARCH(payload):
    query = control.keyboard(control.lang(30002))
    if query:
        return control.draw_items(NineAnimeBrowser().search_site(query))
    return False
예제 #5
0
def SEARCH_PAGES(payload):
    query, page = payload.rsplit("/", 1)
    return control.draw_items(NineAnimeBrowser().search_site(query, int(page)))
예제 #6
0
def LATEST(payload):
    return control.draw_items(NineAnimeBrowser().get_latest())
예제 #7
0
def LATEST_PAGES(payload):
    return control.draw_items(NineAnimeBrowser().get_latest(int(payload)))
예제 #8
0
def NEWEST(payload):
    return control.draw_items(NineAnimeBrowser().get_newest())
예제 #9
0
def NEWEST_PAGES(payload):
    return control.draw_items(NineAnimeBrowser().get_newest(int(payload)))
예제 #10
0
def ANIMES_PAGE(animeurl):
    return control.draw_items(NineAnimeBrowser().get_anime_episodes(animeurl))
예제 #11
0
from resources.lib.ui import control
from resources.lib.ui import utils
from resources.lib.ui.SourcesList import SourcesList
from resources.lib.ui.router import route, router_process
from resources.lib.NineAnimeBrowser import NineAnimeBrowser

AB_LIST = [".", "0"] + [chr(i) for i in range(ord("A"), ord("Z") + 1)]
MENU_ITEMS = [(control.lang(30000), "latest"), (control.lang(30001), "newest"),
              (control.lang(30002), "genres"), (control.lang(30003), "search")]

_BROWSER = NineAnimeBrowser()


@route('animes/*')
def ANIMES_PAGE(animeurl):
    return control.draw_items(_BROWSER.get_anime_episodes(animeurl))


@route('newest')
def NEWEST(payload):
    return control.draw_items(_BROWSER.get_newest())


@route('newest/*')
def NEWEST_PAGES(payload):
    return control.draw_items(_BROWSER.get_newest(int(payload)))


@route('latest')
def LATEST(payload):
    return control.draw_items(_BROWSER.get_latest())
예제 #12
0
class TestBrowser(unittest.TestCase):
    def __init__(self, *args, **kargs):
        super(TestBrowser, self).__init__(*args, **kargs)
        self.browser = NineAnimeBrowser()

    def _sleep(self):
        time.sleep(1)

    def test_search_site(self):
        "search site finds naruto"
        search_res = self.browser.search_site("Naruto Shippuden")
        self.assertGreater(len(search_res), 0)

        search_item = filter(lambda x: x['name'] == 'Naruto: Shippuuden (Dub)',
                             search_res)
        self.assertEquals(len(search_item), 1)
        self.assertEquals(search_item[0]['url'],
                          'animes/naruto-shippuuden-dub.00zr')
        self.assertEquals(search_item[0]['is_dir'], True)
        self._sleep()

    def test_search_with_pages(self):
        "search 'Dragon' and verify pages"
        search_res = self.browser.search_site("Dragon")
        self.assertGreaterEqual(len(search_res), 30)
        self.assertEqual(search_res[-1]['name'].startswith('Next Page (2'),
                         True)
        self.assertEqual(
            search_res[-1], {
                'name': search_res[-1]['name'],
                'is_dir': True,
                'image': None,
                'url': 'search/Dragon/2'
            })
        self._sleep()

    def test_get_latest(self):
        "get_latest returns at least 10 items"
        latest = self.browser.get_latest()
        self.assertGreater(len(latest), 10)
        self._sleep()

    def test_get_latest_pages(self):
        "get_latest returns next page"
        latest = self.browser.get_latest()
        self.assertEqual(latest[-1]['name'].startswith('Next Page (2'), True)
        self.assertEqual(
            latest[-1], {
                'name': latest[-1]['name'],
                'is_dir': True,
                'image': None,
                'url': 'latest/2'
            })
        self._sleep()

    def test_get_newest(self):
        "get_newest returns at least 10 items"
        newest = self.browser.get_newest()
        self.assertGreater(len(newest), 10)
        self._sleep()

    def test_get_newest_pages(self):
        "get_newest returns next page"
        newest = self.browser.get_newest()
        self.assertEqual(newest[-1]['name'].startswith('Next Page (2'), True)
        self.assertEqual(
            newest[-1], {
                'name': newest[-1]['name'],
                'is_dir': True,
                'image': None,
                'url': 'newest/2'
            })
        self._sleep()

    def test_get_genres(self):
        "get_genres returns genere list"
        genre_list = self.browser.get_genres()
        self.assertGreater(len(genre_list), 0)
        self.assertIn(
            {
                'url': 'genre/comedy/1',
                'is_dir': True,
                'image': '',
                'name': 'Comedy'
            }, genre_list)
        self._sleep()

    def test_get_genre(self):
        "get_genre returns anime list by genre"
        anime_list = self.browser.get_genre("action")
        self.assertGreater(len(anime_list), 10)
        self._sleep()

    def test_get_genre_pages(self):
        "get_genre returns anime list with pages"
        anime_list = self.browser.get_genre("action", 1)
        self.assertEqual(anime_list[-1]['name'].startswith('Next Page (2'),
                         True)
        self.assertEqual(
            anime_list[-1], {
                'name': anime_list[-1]['name'],
                'is_dir': True,
                'image': None,
                'url': 'genre/action/2'
            })
        self._sleep()

    def test_get_anime_episodes(self):
        "get_anime_episodes works for one-piece"
        episodes = self.browser.get_anime_episodes("one-piece.ov8")
        self.assertGreaterEqual(len(episodes), 750)
        self.assertEqual(
            episodes[-1], {
                'url': u'play/one-piece.ov8/1',
                'is_dir': False,
                'image': '',
                'name': u"Episode 1 (Dec 25, 2016 - 10:39)"
            })
        self._sleep()

    def test_get_episode_sources(self):
        "get_episode_sources find nartuo's first episode"
        sources = self.browser.get_episode_sources('one-piece.ov8', 1)
        self.assertGreaterEqual(len(sources), 3)
        self._sleep()

    def test_get_episode_video_url(self):
        "get_episode_sources find nartuo's first episode"
        sources = self.browser.get_episode_sources('one-piece.ov8', 1)
        self.assertGreaterEqual(len(sources), 3)
        self._sleep()
예제 #13
0
 def __init__(self, *args, **kargs):
     super(TestBrowser, self).__init__(*args, **kargs)
     self.browser = NineAnimeBrowser()
예제 #14
0
    "serverstreamango": "Streamango",
    "serverrapid": "RapidVideo",
    "servermycloud": "MyCloud",
    "serveropenload": "OpenLoad",
}

WATCHLIST_ITEMS = [(control.lang(30300), "watchlist_all"),
                   (control.lang(30301), "watchlist_watching"),
                   (control.lang(30302), "watchlist_completed"),
                   (control.lang(30303), "watchlist_onhold"),
                   (control.lang(30304), "watchlist_dropped"),
                   (control.lang(30305), "watchlist_planned")]

HISTORY_DELIM = ":_:"

_BROWSER = NineAnimeBrowser(control.getSetting('baseurl'))
control.setContent('tvshows')


def isDirectoryStyle():
    style = control.getSetting('displaystyle')
    return "Directory" == style


def sortResultsByRes(fetched_urls):
    prefereResSetting = utils.parse_resolution_of_source(
        control.getSetting('prefres'))

    filtered_urls = filter(
        lambda x: utils.parse_resolution_of_source(x[0]) <= prefereResSetting,
        fetched_urls)