# Path: epymc/extapi/onlinevideo.py
# ACT_DEFAULT = 0
# ACT_NONE = 1
# ACT_FOLDER = 2
# ACT_MORE = 3
# ACT_PLAY = 4
# ACT_SEARCH = 5
# def state_get():
# def language_get():
# def item_add(next_state, label, url, info=None, icon=None, poster=None, action=ACT_DEFAULT):
# def play_url(url):
# def report_error(msg):
# def local_resource(_file_, res):
# def fetch_url(url, headers=None, parser=None):
# def ydl_executable():
# def call_ydl(url):
# def url_encode(params):
# def seconds_to_duration(seconds):
# def relative_date(date):
# def format_date(date):


from epymc.extapi.onlinevideo import api_version, state_get, \
    fetch_url, play_url, item_add, call_ydl, url_encode, language_get, \
    ACT_NONE, ACT_FOLDER, ACT_MORE, ACT_PLAY, ACT_SEARCH
            if video['site'] == 'YouTube':
                url = 'https://www.youtube.com/watch?v=%s' % video['key']
                info = '<title>{}</title><br>' \
                       '<name>{}:</name> <value>{}</value><br>' \
                       '<name>{}:</name> <value>{}</value><br>' \
                       '<name>{}:</name> <value>{}p</value>'.format(
                    video['name'],
                    _('Language'), video['iso_639_1'],
                    _('Source'), video['site'],
                    _('Quality'), video['size'])
                item_add(ST_PLAY_YOUTUBE, video['name'], url,
                         info=info, poster=poster, icon='icon/play')
    else:
        item_add(ST_NONE, _('No trailers available'), None,
                 poster=poster, icon='icon/play', action=ACT_NONE)

    # cast
    item_add(ST_CAST_LIST, _('Cast'), '/movie/%d/credits' % data['id'],
             poster=poster, icon='icon/head')


################################################################################
# Cast list
################################################################################
elif STATE == ST_CAST_LIST:
    data = v3_request(URL)
    for c in data['cast']:
        title = '{} <i>{} {}</i>'.format(
            c['name'], _('as'), c['character'])
        poster = full_img_url(c['profile_path'], size='h632')

# Path: epymc/extapi/onlinevideo.py
# ACT_DEFAULT = 0
# ACT_NONE = 1
# ACT_FOLDER = 2
# ACT_MORE = 3
# ACT_PLAY = 4
# ACT_SEARCH = 5
# def state_get():
# def language_get():
# def item_add(next_state, label, url, info=None, icon=None, poster=None, action=ACT_DEFAULT):
# def play_url(url):
# def report_error(msg):
# def local_resource(_file_, res):
# def fetch_url(url, headers=None, parser=None):
# def ydl_executable():
# def call_ydl(url):
# def url_encode(params):
# def seconds_to_duration(seconds):
# def relative_date(date):
# def format_date(date):


# Path: epymc/plugins/onlinevideo/themoviedb/themoviedb.py
from epymc.extapi.onlinevideo import api_version, state_get, \
    fetch_url, play_url, item_add, call_ydl, url_encode, language_get, \
    ACT_NONE, ACT_FOLDER, ACT_MORE, ACT_PLAY, ACT_SEARCH

            if video['site'] == 'YouTube':
                url = 'https://www.youtube.com/watch?v=%s' % video['key']
                info = '<title>{}</title><br>' \
                       '<name>{}:</name> <value>{}</value><br>' \
                       '<name>{}:</name> <value>{}</value><br>' \
                       '<name>{}:</name> <value>{}p</value>'.format(
                    video['name'],
                    _('Language'), video['iso_639_1'],
                    _('Source'), video['site'],
                    _('Quality'), video['size'])
                item_add(ST_PLAY_YOUTUBE, video['name'], url,
                         info=info, poster=poster, icon='icon/play')
    else:
        item_add(ST_NONE, _('No trailers available'), None,
                 poster=poster, icon='icon/play', action=ACT_NONE)

    # cast
    item_add(ST_CAST_LIST, _('Cast'), '/movie/%d/credits' % data['id'],
             poster=poster, icon='icon/head')


################################################################################
# Cast list
################################################################################
elif STATE == ST_CAST_LIST:
    data = v3_request(URL)
    for c in data['cast']:
        title = '{} <i>{} {}</i>'.format(
            c['name'], _('as'), c['character'])
        poster = full_img_url(c['profile_path'], size='h632')

        item_add(ST_NONE, title, 'url', poster=poster, action=ACT_NONE)