Esempio n. 1
0
# -*- coding: utf-8 -*-
from converter import JsonListItemConverter
from functools import wraps
from twitch import TwitchTV, TwitchVideoResolver, Keys, TwitchException
from xbmcswift2 import Plugin  # @UnresolvedImport
import urllib2, json, sys

ITEMS_PER_PAGE = 20
LINE_LENGTH = 60

PLUGIN = Plugin()
CONVERTER = JsonListItemConverter(PLUGIN, LINE_LENGTH)
TWITCHTV = TwitchTV(PLUGIN.log)


def managedTwitchExceptions(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except TwitchException as error:
            handleTwitchException(error)

    return wrapper


def handleTwitchException(exception):
    codeTranslations = {
        TwitchException.NO_STREAM_URL: 30023,
        TwitchException.STREAM_OFFLINE: 30021,
        TwitchException.HTTP_ERROR: 30020,
Esempio n. 2
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import xbmc
from common import kodi, log_utils
import api, utils, cache
from constants import Keys, LINE_LENGTH
from converter import JsonListItemConverter

ID = kodi.get_id()
monitor = xbmc.Monitor()
converter = JsonListItemConverter(LINE_LENGTH)


class TwitchPlayer(xbmc.Player):
    window = kodi.Window(10000)
    player_keys = {'twitch_playing': ID + '-twitch_playing'}
    seek_keys = {
        'seek_time': ID + '-seek_time',
    }
    reconnect_keys = {'stream': ID + '-livestream'}

    def __init__(self, *args, **kwargs):
        log_utils.log('Player: Start', log_utils.LOGDEBUG)
        self.reset()

    def reset(self):
Esempio n. 3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from converter import JsonListItemConverter
from functools import wraps
from gagtv import GagTV, Keys, GagException
from xbmcswift2 import Plugin  #@UnresolvedImport
import sys

ITEMS_PER_PAGE = 20
LINE_LENGTH = 60

PLUGIN_NAME = '9GAG TV'
PLUGIN_ID = 'plugin.video.9gagtv'
PLUGIN = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)
CONVERTER = JsonListItemConverter(PLUGIN)
GAGTV = GagTV()


@PLUGIN.route('/')
def createMainListing():
    items = [{
        'label': PLUGIN.get_string(10001),
        'path': PLUGIN.url_for(endpoint='createListOfTodaysVideos')
    }, {
        'label': PLUGIN.get_string(10002),
        'path': PLUGIN.url_for(endpoint='createListOfArchives')
    }]
    return items