# 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
           '<small><name>%s</> %s <name>/ %s %s</><br>' \
           '<name>%s</> %s<br>' \
           '<success>%d %s</success> <name>/</> ' \
           '<info>%d %s</info></small><br>%s' % (
               channel['name'],
               _('user'), channel['user']['name'],
               _('created'), relative_date(channel['created_time']),
               _('updated'), relative_date(channel['modified_time']),
               videos, ngettext('video', 'videos', videos),
               followers, ngettext('follower', 'followers', followers),
               channel['description'] or '')
    item_add(ST_VIDEO_LIST, channel['name'], url, icon=icon_channels,
             poster=poster, info=info)


def group_item_add(group):
    url = api_base + group['metadata']['connections']['videos']['uri']
    try:
        poster = [p['link'] for p in group['pictures']['sizes'] if p['width'] == 640][0]
        if '?' in poster: poster = poster.split('?')[0]
    except:
        poster = None
    videos = group['metadata']['connections']['videos']['total'] or 0
    followers = group['metadata']['connections']['users']['users'] or 0
    info = '<title>%s</><br>' \
           '<small><name>%s</> %s <name>/ %s %s</><br>' \
           '<name>%s</> %s<br>' \
           '<success>%d %s</> <name>/</> <info>%d %s</></small><br>%s' % (
               group['name'],
               _('user'), group['user']['name'],

# 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

           '<small><name>%s</> %s <name>/ %s %s</><br>' \
           '<name>%s</> %s<br>' \
           '<success>%d %s</success> <name>/</> ' \
           '<info>%d %s</info></small><br>%s' % (
               channel['name'],
               _('user'), channel['user']['name'],
               _('created'), relative_date(channel['created_time']),
               _('updated'), relative_date(channel['modified_time']),
               videos, ngettext('video', 'videos', videos),
               followers, ngettext('follower', 'followers', followers),
               channel['description'] or '')
    item_add(ST_VIDEO_LIST, channel['name'], url, icon=icon_channels,
             poster=poster, info=info)


def group_item_add(group):
    url = api_base + group['metadata']['connections']['videos']['uri']
    try:
        poster = [p['link'] for p in group['pictures']['sizes'] if p['width'] == 640][0]
        if '?' in poster: poster = poster.split('?')[0]
    except:
        poster = None
    videos = group['metadata']['connections']['videos']['total'] or 0
    followers = group['metadata']['connections']['users']['users'] or 0
    info = '<title>%s</><br>' \
           '<small><name>%s</> %s <name>/ %s %s</><br>' \
           '<name>%s</> %s<br>' \
           '<success>%d %s</> <name>/</> <info>%d %s</></small><br>%s' % (
               group['name'],
               _('user'), group['user']['name'],

               _('created'), relative_date(group['created_time']),