Beispiel #1
0
def translations(plugin):
    season_url = plugin.args.get('url')
    if season_url is None:
        logger.error('{0}: "url" arg is missing or malformed: {0}'.format(
            'screen "translations"', plugin.args))
        plugin.publish_screen(False)
        return
    tr = plugin.args.get('tr')
    thumb = seasonvar.thumb_url(season_url)
    season = seasonvar.season_info(season_url)
    if season is None:
        logger.error('{0}: failed to get season info: {0}'.format(
            'screen "translations"', plugin.args))
        plugin.publish_screen(False)
        return
    for n, pl in enumerate(season['playlist']):
        if tr is None and n == 0 or pl['tr'] == tr:
            prefix = '* '
        else:
            prefix = ''
        url = plugin.make_url({
            'screen': 'episodes',
            'url': season_url,
            'tr': pl['tr'],
        })
        name = '{0}{1}'.format(
            prefix, pl['tr'] if pl['tr'] is not None else 'Стандартная')
        plugin.add_screen_directory(name, url, thumb=thumb)
    plugin.publish_screen(True)
def translations(plugin):
    season_url = plugin.args.get('url')
    if season_url is None:
        logger.error('{0}: "url" arg is missing or malformed: {0}'.format(
            'screen "translations"', plugin.args))
        plugin.publish_screen(False)
        return
    tr = plugin.args.get('tr')
    thumb = seasonvar.thumb_url(season_url)
    season = seasonvar.season_info(season_url)
    if season is None:
        logger.error('{0}: failed to get season info: {0}'.format(
            'screen "translations"', plugin.args))
        plugin.publish_screen(False)
        return
    for n, pl in enumerate(season['playlist']):
        if tr is None and n == 0 or pl['tr'] == tr:
            prefix = '* '
        else:
            prefix = ''
        url = plugin.make_url({
            'screen': 'episodes',
            'url': season_url,
            'tr': pl['tr'],
        })
        name = '{0}{1}'.format(
                prefix,
                pl['tr'] if pl['tr'] is not None else 'Стандартная')
        plugin.add_screen_directory(name, url, thumb=thumb)
    plugin.publish_screen(True)
def episodes(plugin):
    season_url = plugin.args.get('url')
    if season_url is None:
        logger.error('{0}: "url" arg is missing or malformed: {0}'.format(
            'screen "episodes"', plugin.args))
        plugin.publish_screen(False)
        return
    tr = plugin.args.get('tr')
    thumb = seasonvar.thumb_url(season_url)
    season = seasonvar.season_info(season_url)
    if season is None or len(season) == 0:
        logger.error('{0}: failed to get season info: {0}'.format(
            'screen "episodes"', plugin.args))
        plugin.show_notification(
            'Content is blocked',
            'Or external player is being used')
        plugin.publish_screen(False)
        return
    if season.get('total', 0) > 1:
        url = plugin.make_url({
            'screen': 'seasons',
            'url': season_url,
        })
        name = '[COLOR FFFFD700]сезон[/COLOR]: {0} / {1}'.format(
                season['number'], season['total'])
        plugin.add_screen_directory(name, url)
    if len(season.get('playlist', [])) > 1:
        url = plugin.make_url({
            'screen': 'translations',
            'url': season_url,
            'tr': tr,
        })
        name = '[COLOR FFFFD700]озвучка[/COLOR]: {0}'.format(
                tr if tr is not None else 'Стандартная')
        plugin.add_screen_directory(name, url)
    pl_url = (x['url'] for x in season.get('playlist', []) if x['tr'] == tr)
    for e in (x for url in pl_url for x in seasonvar.episodes(url)):
        url = plugin.make_url({'play': e['url']})
        plugin.add_screen_item(e['name'], url, thumb=thumb)
    plugin.publish_screen(True)
Beispiel #4
0
def episodes(plugin):
    season_url = plugin.args.get('url')
    if season_url is None:
        logger.error('{0}: "url" arg is missing or malformed: {0}'.format(
            'screen "episodes"', plugin.args))
        plugin.publish_screen(False)
        return
    tr = plugin.args.get('tr')
    thumb = seasonvar.thumb_url(season_url)
    season = seasonvar.season_info(season_url)
    if season is None or len(season) == 0:
        logger.error('{0}: failed to get season info: {0}'.format(
            'screen "episodes"', plugin.args))
        plugin.show_notification('Content is blocked',
                                 'Or external player is being used')
        plugin.publish_screen(False)
        return
    if season.get('total', 0) > 1:
        url = plugin.make_url({
            'screen': 'seasons',
            'url': season_url,
        })
        name = '[COLOR FFFFD700]сезон[/COLOR]: {0} / {1}'.format(
            season['number'], season['total'])
        plugin.add_screen_directory(name, url)
    if len(season.get('playlist', [])) > 1:
        url = plugin.make_url({
            'screen': 'translations',
            'url': season_url,
            'tr': tr,
        })
        name = '[COLOR FFFFD700]озвучка[/COLOR]: {0}'.format(
            tr if tr is not None else 'Стандартная')
        plugin.add_screen_directory(name, url)
    pl_url = (x['url'] for x in season.get('playlist', []) if x['tr'] == tr)
    for e in (x for url in pl_url for x in seasonvar.episodes(url)):
        url = plugin.make_url({'play': e['url']})
        plugin.add_screen_item(e['name'], url, thumb=thumb)
    plugin.publish_screen(True)
Beispiel #5
0
import seasonvar

a = seasonvar.search('doctor who')
for it in a:
    print it['name'], '>', it['url']

e = seasonvar.season_info(it[0]['url'])
for et in e:
    print et['name'], '>', et['url']