# 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):


import sys
from epymc.extapi.onlinevideo import api_version, state_get, \
    fetch_url, play_url, report_error, item_add, call_ydl, local_resource, \
    relative_date, seconds_to_duration, url_encode, URLError, HTTPError, \
    ACT_NONE, ACT_FOLDER, ACT_MORE, ACT_PLAY, ACT_SEARCH
# home page
################################################################################
if STATE == ST_HOME:
    # searches
    item_add(ST_VIDEO_LIST, _('Search videos'), 'search1', action=ACT_SEARCH)
    item_add(ST_CHANN_LIST, _('Search channels'), 'search2', action=ACT_SEARCH)
    item_add(ST_GROUP_LIST, _('Search groups'), 'search3', action=ACT_SEARCH)
    item_add(ST_USERS_LIST, _('Search people'), 'search4', action=ACT_SEARCH)

    # more relevant videos (THIS DO NOT WORK, need to find another api)
    # url = api_base + '/videos?sort=relevant&per_page=%d' % ITEMS_PER_PAGE
    # item_add(ST_VIDEO_LIST, _('More relevant videos'), url,
    # icon=icon_videos, action=ACT_FOLDER)

    # more followed channels
    url = api_base + '/channels?sort=followers&per_page=%d' % ITEMS_PER_PAGE
    item_add(ST_CHANN_LIST, _('More followed channels'), url,
             icon=icon_channels, action=ACT_FOLDER)

    # more followed groups
    url = api_base + '/groups?sort=followers&per_page=%d' % ITEMS_PER_PAGE
    item_add(ST_GROUP_LIST, _('More followed groups'), url,
             icon=icon_groups, action=ACT_FOLDER)

    # more relevant users (DO NOT WORK)
    # url = api_base + '/users?sort=relevant&per_page=%d' % ITEMS_PER_PAGE
    # item_add(ST_USERS_LIST, 'More relevant users', url,
    # icon=icon_users, action=ACT_FOLDER)
    # browse by cats
    item_add(ST_CATEGORIES, _('Browse videos'), '/videos', action=ACT_FOLDER)

# 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/vimeo/vimeo.py
import sys
from epymc.extapi.onlinevideo import api_version, state_get, \
    fetch_url, play_url, report_error, item_add, call_ydl, local_resource, \
    relative_date, seconds_to_duration, url_encode, URLError, HTTPError, \
    ACT_NONE, ACT_FOLDER, ACT_MORE, ACT_PLAY, ACT_SEARCH

# home page
################################################################################
if STATE == ST_HOME:
    # searches
    item_add(ST_VIDEO_LIST, _('Search videos'), 'search1', action=ACT_SEARCH)
    item_add(ST_CHANN_LIST, _('Search channels'), 'search2', action=ACT_SEARCH)
    item_add(ST_GROUP_LIST, _('Search groups'), 'search3', action=ACT_SEARCH)
    item_add(ST_USERS_LIST, _('Search people'), 'search4', action=ACT_SEARCH)

    # more relevant videos (THIS DO NOT WORK, need to find another api)
    # url = api_base + '/videos?sort=relevant&per_page=%d' % ITEMS_PER_PAGE
    # item_add(ST_VIDEO_LIST, _('More relevant videos'), url,
    # icon=icon_videos, action=ACT_FOLDER)

    # more followed channels
    url = api_base + '/channels?sort=followers&per_page=%d' % ITEMS_PER_PAGE
    item_add(ST_CHANN_LIST, _('More followed channels'), url,
             icon=icon_channels, action=ACT_FOLDER)

    # more followed groups
    url = api_base + '/groups?sort=followers&per_page=%d' % ITEMS_PER_PAGE
    item_add(ST_GROUP_LIST, _('More followed groups'), url,
             icon=icon_groups, action=ACT_FOLDER)

    # more relevant users (DO NOT WORK)
    # url = api_base + '/users?sort=relevant&per_page=%d' % ITEMS_PER_PAGE
    # item_add(ST_USERS_LIST, 'More relevant users', url,
    # icon=icon_users, action=ACT_FOLDER)
    # browse by cats
    item_add(ST_CATEGORIES, _('Browse videos'), '/videos', action=ACT_FOLDER)

    item_add(ST_CATEGORIES, _('Browse channels'), '/channels', action=ACT_FOLDER)