# 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
api_base = 'https://api.vimeo.com'
app_token = '55e9f802ceb814b649ef3c9504d4d38f'  # Official token for EpyMC
headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC',
           'Accept': 'application/vnd.vimeo.*+json;version=3.2'}

icon_channels = local_resource(__file__, 'icon_channels.png')
icon_groups = local_resource(__file__, 'icon_groups.png')
icon_categories = local_resource(__file__, 'icon_categories.png')
icon_users = local_resource(__file__, 'icon_users.png')
icon_videos = 'icon/play'

ITEMS_PER_PAGE = 50

ST_HOME = 0
ST_VIDEO_LIST = 1
ST_CHANN_LIST = 2
ST_GROUP_LIST = 3
ST_USERS_LIST = 4
ST_CATEGORIES = 5
ST_PLAY = 10

STATE, URL = state_get()


def vimeo_api_url(url):
    try:
        return fetch_url(url, headers=headers, parser='json')
    except HTTPError as e:
        report_error('%d: %s' % (e.code, e.reason))
    except URLError as e:

# 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

api_base = 'https://api.vimeo.com'
app_token = '55e9f802ceb814b649ef3c9504d4d38f'  # Official token for EpyMC
headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC',
           'Accept': 'application/vnd.vimeo.*+json;version=3.2'}

icon_channels = local_resource(__file__, 'icon_channels.png')
icon_groups = local_resource(__file__, 'icon_groups.png')
icon_categories = local_resource(__file__, 'icon_categories.png')
icon_users = local_resource(__file__, 'icon_users.png')
icon_videos = 'icon/play'

ITEMS_PER_PAGE = 50

ST_HOME = 0
ST_VIDEO_LIST = 1
ST_CHANN_LIST = 2
ST_GROUP_LIST = 3
ST_USERS_LIST = 4
ST_CATEGORIES = 5
ST_PLAY = 10

STATE, URL = state_get()


def vimeo_api_url(url):
    try:
        return fetch_url(url, headers=headers, parser='json')
    except HTTPError as e:
        report_error('%d: %s' % (e.code, e.reason))
    except URLError as e:

        report_error('%s' % e.reason)