Пример #1
0
	def display(self, showList):
		# Bold the already selected view mode
		orgList = showList[:]
		if self.currentMode and len(showList) > 2:
			# Convert current viewmode to an interger
			currentMode = int(self.currentMode)
			for key, value in self.viewModes.iteritems():
				# Check if current mode is found in viewModes
				if currentMode == value:
					# When found find its position in the list
					for count, i in enumerate(showList):
						# Check for required key
						if key == i:
							# Wen found, Bold and Indent the value
							showList[count] = "[B]-%s[/B]" % showList[count]
							break
					break
		
		# Display List to User
		ret = xbmcutil.Dialog.dialogSelect(plugin.get_setting(self.skin, "name"), showList)
		if ret >= 0:
			# Take action depending on response
			response = orgList[ret]
			if response.startswith(plugin.get_string(636)): self.askForViewID()
			elif response == plugin.get_string(571): plugin.set_setting("%s.%s.view" % (self.skin, self.mode), "")
			else: plugin.set_setting("%s.%s.view" % (self.skin, self.mode), str(self.viewModes[str(response)]))
Пример #2
0
    def __init__(self, mode):
        # Create List for display
        showList = []  # [plugin.getstr(571)]
        self.mode = mode

        # Load in Skin Codes from Database
        jsonData = storageDB.SkinCodes()
        if self.skin in jsonData:
            # Fetch viewmodes for selected mode
            self.viewModes = self.filterCodes(jsonData[self.skin], mode)

            # Append each key of viewModes to show list
            for i in sorted(self.viewModes.keys()):
                showList.append(i)

        # Fetch Current Mode if set and Show to user under Custom Mode ID
        self.currentMode = currentMode = plugin.get_setting("%s.%s.view" %
                                                            (self.skin, mode))
        if currentMode:
            showList.append("%s (%s)" % (plugin.get_string(636), currentMode))
        else:
            showList.append(plugin.get_string(636))

        # Display List
        self.display(showList)
Пример #3
0
    def display(self, showList):
        # Bold the already selected view mode
        orgList = showList[:]
        if self.currentMode and len(showList) > 2:
            # Convert current viewmode to an interger
            currentMode = int(self.currentMode)
            for key, value in self.viewModes.iteritems():
                # Check if current mode is found in viewModes
                if currentMode == value:
                    # When found find its position in the list
                    for count, i in enumerate(showList):
                        # Check for required key
                        if key == i:
                            # Wen found, Bold and Indent the value
                            showList[count] = "[B]-%s[/B]" % showList[count]
                            break
                    break

        # Display List to User
        ret = xbmcutil.Dialog.dialogSelect(
            plugin.get_setting(self.skin, "name"), showList)
        if ret >= 0:
            # Take action depending on response
            response = orgList[ret]
            if response.startswith(plugin.get_string(636)): self.askForViewID()
            elif response == plugin.get_string(571):
                plugin.set_setting("%s.%s.view" % (self.skin, self.mode), "")
            else:
                plugin.set_setting("%s.%s.view" % (self.skin, self.mode),
                                   str(self.viewModes[str(response)]))
Пример #4
0
	def __init__(self, mode):
		# Create List for display
		showList = [] # [plugin.getstr(571)]
		self.mode = mode
		
		# Load in Skin Codes from Database
		jsonData = storageDB.SkinCodes()
		if self.skin in jsonData:
			# Fetch viewmodes for selected mode
			self.viewModes = self.filterCodes(jsonData[self.skin], mode)
			
			# Append each key of viewModes to show list
			for i in sorted(self.viewModes.keys()):
				showList.append(i)
		
		# Fetch Current Mode if set and Show to user under Custom Mode ID
		self.currentMode = currentMode = plugin.get_setting("%s.%s.view" % (self.skin, mode))
		if currentMode: showList.append("%s (%s)" % (plugin.get_string(636), currentMode))
		else: showList.append(plugin.get_string(636))
		
		# Display List
		self.display(showList)
Пример #5
0
ADDON = xbmcaddon.Addon()
ADDON_ID = ADDON.getAddonInfo('id')
ADDON_ICON = ADDON.getAddonInfo('icon')
ADDON_NAME = ADDON.getAddonInfo('name')
ADDON_PATH = ADDON.getAddonInfo('path').decode("utf-8")
ADDON_VERSION = ADDON.getAddonInfo('version')
ADDON_DATA_PATH = xbmc.translatePath("special://profile/addon_data/%s" % ADDON_ID).decode("utf-8")
sys.path.append(os.path.join(ADDON_PATH, 'resources', 'lib'))
from rrmj import *
from common import *
from history import *

plugin = Plugin()
Meiju = RenRenMeiJu()
PAGE_ROWS = plugin.get_setting("page_rows")
VIDEO_CACHE = plugin.get_storage('video')


def parse_qs(qs):
    return dict([s1.split('=') for s1 in urllib.unquote(qs).split('&')])


def remap_url(req_url, page=1):
    array = req_url.split("?")
    params = parse_qs(array[1])
    if array[0] == "/video/search":
        endpoint = "search"
        if "cat" in params:
            endpoint = "cat_list"
        elif "mark" in params:
from xbmcswift2 import Plugin, xbmcgui
from resources.lib.abc_base import BaseForum
from resources.lib.sites import *
import resources.lib.util as util
from operator import itemgetter


bookmark_storage = 'my_bookmarks'
temp_storage = 'temp_storage'

plugin = Plugin()

LANG = {
    'me': plugin.get_setting(
        'lang_me', choices=('en_ME/', 'ar_ME/')),
    'mz': 'pt_MZ/',
    'ke': plugin.get_setting(
        'lang_ke', choices=('en_KE/', 'fr_KE/', 'sw_KE/')),
    'ng': plugin.get_setting(
        'lang_ng', choices=('en_NG/', 'fr_NG/')),
    'tz': plugin.get_setting(
        'lang_tz', choices=('en_TZ/', 'sw_TZ/')),
    'ug': plugin.get_setting(
        'lang_ug', choices=('en_UG/', 'sw_UG/')),
}

STRINGS = {
    'url_resolver_settings': 30100,
    'try_again': 30050,
    'site_unavailable': 30051,
    'is_unavailable': 30052,
Пример #7
0
        vitem.set_info(type='video', info_labels={'Title': url})
        vitem.add_stream_info(stream_type='video', stream_values={})
        plugin.set_resolved_url(resolved)
        return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    try:
        if resolved is None or len(resolved) < 5:
            import YoutubeDLWrapper
            ytdl = YoutubeDLWrapper._getYTDL()
            ytdl.clearDownloadParams()
            resolved = ytdl.extract_info(url, download=False)
            vitem = ListItem(label=url, path=resolved)
            vitem.is_folder = False
            vitem.set_is_playable = True
            vitem.set_info(type='video', info_labels={'Title': url})
            vitem.add_stream_info(stream_type='video', stream_values={})
            plugin.set_resolved_url(resolved)
            return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    return None

if __name__ == '__main__':
    plugin.run()
    mode = int(plugin.get_setting(key='viewmode'))
    if mode is not None and mode >= 0:
        VIEWMODE = mode
    plugin.set_view_mode(view_mode_id=VIEWMODE)
    plugin.set_content('movies')
Пример #8
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
__addonname__     = "Audio Bible Browser"
__addonid__       = "plugin.audio.audiobible"
__author__        = "clcii"

import urllib,urllib2,re,sys,base64,socket,time #,pickle,collections
from xbmcswift2 import Plugin,xbmc,xbmcgui,ListItem,actions
from datetime import date
#from itertools import izip
import bibledata


socket.setdefaulttimeout(30)
plugin = Plugin('plugin.audio.audiobible')
forceViewMode=plugin.get_setting("forceViewMode", unicode)
viewMode=plugin.get_setting("viewMode", unicode)
basegatewayurl="http://www.biblegateway.com/audio/"

@plugin.route('/')
def enMain():
	items = [
		{'label': 'My Audio Bible', 'path': plugin.url_for('listMyBible')},
		{'label': 'Wisdom and Songs of the Day', 'path': plugin.url_for('listWisdomAndSongs')},
		{'label': 'Audio Bible Browser', 'path': plugin.url_for('listRecordings')}
	]
	recording=plugin.get_setting("defaultrecording", unicode)
	if forceViewMode=="true":
		xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
	return plugin.finish(items)
@plugin.route('/listMyBible/')
servicing = False


def Service():
    global servicing
    if servicing:
        return
    servicing = True
    xbmc.log("[plugin.video.addon.recorder] SERVICE", xbmc.LOGERROR)
    xbmc.executebuiltin(
        'XBMC.RunPlugin(plugin://plugin.video.addon.recorder/service)')
    time.sleep(2)
    servicing = False


if plugin.get_setting('service.startup', bool):
    Service()
    plugin.set_setting('last.update', str(time.time()))

if plugin.get_setting('service', bool) and plugin.get_setting(
        'service.type', int):
    monitor = xbmc.Monitor()
    xbmc.log("[plugin.video.addon.recorder] service started...", xbmc.LOGERROR)
    while not monitor.abortRequested():
        if plugin.get_setting('service.type') == '1':
            interval = int(plugin.get_setting('service.interval'))
            waitTime = 3600 * interval
            ts = plugin.get_setting('last.update') or "0.0"
            lastTime = datetime.datetime.fromtimestamp(float(ts))
            now = datetime.datetime.now()
            nextTime = lastTime + datetime.timedelta(seconds=waitTime)
Пример #10
0
    sys.stdout = io.StringIO()
    sys.path.append(
        os.path.join(plugin.addon.getAddonInfo('path'), 'resources', 'lib'))

    _ = plugin.get_string
    cache = plugin.get_storage('data')

    from helpers import Helpers

    helpers = Helpers(plugin)

    try:
        from rhapsody import exceptions

        rhapsody = helpers.get_api()
        rhapsody.ENABLE_DEBUG = plugin.get_setting('api_debug', converter=bool)
        rhapsody.ENABLE_CACHE = not plugin.get_setting('api_cache_disable',
                                                       converter=bool)
        if not rhapsody.ENABLE_DEBUG and not rhapsody.ENABLE_CACHE:
            rhapsody.ENABLE_CACHE = True
            plugin.set_setting('api_cache_disable', '0')

        plugin.run()
    except exceptions.AuthenticationError:
        plugin.notify(_(30100).encode('utf-8'))
        plugin.open_settings()
    except exceptions.RequestError:
        plugin.notify(_(30103).encode('utf-8'))
        plugin.log.error(sys.stdout.getvalue())
    except exceptions.ResourceNotFoundError:
        plugin.notify(_(30104).encode('utf-8'))
Пример #11
0
"""
from xbmcswift2 import Plugin, actions
import xbmcvfs
import os
import json

plugin = Plugin()
_L = plugin.get_string

plugin_path = plugin.addon.getAddonInfo('path')
lib_path = os.path.join(plugin_path, 'resources', 'lib')
sys.path.append(lib_path)

vidmap = None
import dabdate
vidmap_path = plugin.get_setting('vidmap_path', str)
print vidmap_path
if vidmap_path:
    try:
        f = xbmcvfs.File(vidmap_path)
        vidmap = json.load(f)
        f.close()
        plugin.log.info("direct play is enabled with "+vidmap_path)
    except:
        vidmap = None

qualcode = {
    ''        :'1',     # default
    _L(31000) :'1',     # medium
    _L(31001) :'2',     # low
    _L(31002) :'3',     # high
Пример #12
0
from xbmcswift2 import Plugin, xbmc
from settings import SETTING_LANGUAGE_ID

plugin = Plugin()

if plugin.get_setting(SETTING_LANGUAGE_ID, unicode) == "system":
    LANG = xbmc.getLanguage(xbmc.ISO_639_1, )
else:
    LANG = plugin.get_setting(SETTING_LANGUAGE_ID, unicode)


def import_tmdb():
    """ Lazy import tmdb """
    import tmdbsimple
    __builtins__["tmdb"] = tmdbsimple


def import_tvdb():
    """ Lazy import tmdb """
    if 'tvdb' not in __builtins__:
        __builtins__['tvdb'] = create_tvdb()


def create_tvdb(language=LANG):
    from tvdb_api import Tvdb
    return Tvdb("0629B785CE550C8D",
                language=language,
                cache=plugin.storage_path)
Пример #13
0
from xbmcswift2 import Plugin
import resources.lib.cheez_api as cheez_api

STRINGS = {
    'page': 30000,
    'browse_by_site': 30001,
    'random_by_category': 30002,
    'new_random': 30003,
}

plugin = Plugin()

api = cheez_api.CheezburgerApi(
    developer_key='df1b9bff-ce69-46e7-8732-1035272f3ee7',
    client_id=2117,
    default_count=plugin.get_setting('per_page', int))

force_thumbnail = plugin.get_setting('force_viewmode', bool)


@plugin.route('/')
def show_menu():
    items = (
        {
            'label': _('browse_by_site'),
            'path': plugin.url_for('show_sites')
        },
        {
            'label': _('random_by_category'),
            'path': plugin.url_for('show_categories')
        },
Пример #14
0
    "33": "es",
    "34": "sv",
    "35": "th",
    "36": "tr",
    "37": "ur",
    "38": "vi",
}

SUBTYPES = [".srt"]


def get_lang(sub_lang_id):
    return [SUBLANG_EN[sub_lang_id], SUBLANG_ISO[sub_lang_id]]


SUBLANG_EN_1, SUBLANG_ISO_1 = get_lang(Plugin.get_setting("sub_language1"))
SUBLANG_EN_2, SUBLANG_ISO_2 = get_lang(Plugin.get_setting("sub_language2"))
SUBLANG_EN_3, SUBLANG_ISO_3 = get_lang(Plugin.get_setting("sub_language3"))


def get_sub_items(imdb_id):
    if SUBLANG_EN_1 == "none":
        return None

    import urllib2
    from kodipopcorntime.utils import url_get_json

    try:
        data = url_get_json("%s/%s" % (API_BASE_URL, imdb_id), headers=HEADERS) or {}
    except urllib2.HTTPError:
        return None
Пример #15
0
import re, urllib2
from xbmcswift2 import Plugin, xbmcaddon, xbmcgui, xbmc
#import xbmcswift2
import requests
import os
import json
from shutil import copyfileobj
import distutils.dir_util
from mutagen.id3 import ID3NoHeaderError
from mutagen.id3 import ID3, TIT2, TALB, TPE1, TMCL, TRCK, COMM, TCON, TYER
from mutagen.easyid3 import EasyID3

plugin = Plugin()

usecostum = plugin.get_setting("custom_directory", bool)
extra_info = plugin.get_setting("extra_info", bool)
noImage = xbmc.translatePath(os.path.join('special://home/addons/plugin.audio.song365',  'resources/art/image_not_available.jpg'))
noArtistImage = xbmc.translatePath(os.path.join('special://home/addons/plugin.audio.song365',  'resources/art/unknown_artist.jpg'))

#url = str(plugin.get_setting("main_url", unicode))
url = plugin.get_setting("main_url")

STRINGS = {
    'menue1': 30001,
    'menue2': 30002,
    'menue3': 30003,
    'menue4': 30004,
    'menue5': 30005,
    'menue6': 30006,
    'menue7': 30007,
Пример #16
0
    }
except:
    pass
# ======== END system variables ========


#======== google analytics ========
def ga_generate_client_id():
    import uuid

    return uuid.uuid4()


from UniversalAnalytics import Tracker

if plugin.get_setting('ga_vstr', str) == '':
    plugin.set_setting('ga_vstr', str(ga_generate_client_id()))

GA_VSTR = plugin.get_setting('ga_vstr', str)


def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code,
                                name='GATracker' +
                                plugin.addon.getAddonInfo('name'),
                                client_id=GA_VSTR,
                                user_agent=xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'))
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'))
    return ga_tracker
Пример #17
0
from xbmcswift2 import xbmc, xbmcgui, Plugin
from resources.lib.mubi import Mubi

PLUGIN_NAME = 'MUBI'
PLUGIN_ID = 'plugin.video.mubi'

plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)

if not plugin.get_setting("username"):
    plugin.open_settings()

mubi = Mubi()
mubi.login(plugin.get_setting("username", unicode), plugin.get_setting("password", unicode))

@plugin.route('/')
def index():
    films = mubi.now_showing()
    items = [{
			'label': film.title, 
			'is_playable': True,
            'path': plugin.url_for('play_film', identifier=film.mubi_id),
          	'thumbnail': film.artwork,
          	'info': film.metadata._asdict()
    	} for film in films] 
    return items

@plugin.route('/play/<identifier>')
def play_film(identifier):
    return plugin.set_resolved_url(mubi.get_play_url(identifier))

Пример #18
0
from xbmcswift2 import Plugin, xbmc
from settings import SETTING_LANGUAGE_ID

plugin = Plugin()

if plugin.get_setting(SETTING_LANGUAGE_ID, converter=str) == "system": LANG = xbmc.getLanguage(xbmc.ISO_639_1,)
else: LANG = plugin.get_setting(SETTING_LANGUAGE_ID, converter=str)

def import_tmdb():
    """ Lazy import tmdb """
    import tmdbsimple
    __builtins__["tmdb"] = tmdbsimple
    
def import_tvdb():
    """ Lazy import tmdb """
    if 'tvdb' not in __builtins__:
        __builtins__['tvdb'] = create_tvdb()
    
def create_tvdb(language=LANG):
    from tvdb_api import Tvdb
    return Tvdb("0629B785CE550C8D", language=language, cache=plugin.storage_path)
Пример #19
0
    {
        'label': 'Experimental Site Wizards',
        'path': plugin.url_for('lab'),
        'thumbnail':get_icon_path('settings'),
    })
    items.append(
    {
        'label': 'Import WebGrab++.config.xml',
        'path': plugin.url_for('import_config'),
        'thumbnail':get_icon_path('settings'),
    })
    items.append(
    {
        'label': 'Clear Selected Channels',
        'path': plugin.url_for('clear'),
        'thumbnail':get_icon_path('settings'),
    })
    return items


if __name__ == '__main__':
    version = plugin.addon.getAddonInfo('version')
    if plugin.get_setting('version') != version:
        plugin.set_setting('version', version)
        headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36', 'referer':'http://192.%s' % version}
        try:
            r = requests.get('http://goo.gl/p8uOWG',headers=headers)
            home = r.content
        except: pass
    plugin.run()
Пример #20
0
    xbmc_var = {
        'screen_resolution': xbmc.getInfoLabel('System.ScreenWidth') + 'x' + xbmc.getInfoLabel('System.ScreenHeight'),
        'user_agent'       : 'XBMC/' + xbmc.getInfoLabel('System.BuildVersion').partition(' ')[0] + ' (' + platform.system() + ') ' + plugin.addon.getAddonInfo('name') + '/' + plugin.addon.getAddonInfo('version')
    }
except: pass
#======== END system variables ========


#======== google analytics ========
def ga_generate_client_id():
    import uuid
    return uuid.uuid4()

from UniversalAnalytics import Tracker

if plugin.get_setting('ga_vstr', str) == '':
    plugin.set_setting('ga_vstr', str(ga_generate_client_id()))


GA_VSTR = plugin.get_setting('ga_vstr', str)

def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code, name = 'GATracker' + plugin.addon.getAddonInfo('name'), client_id = GA_VSTR, user_agent = xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'));
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'));
    return ga_tracker

def ga(ga_code = 'UA-46965070-1', url = ''):
    try:
        from urlparse import urlparse
Пример #21
0
# global declarations
# plugin stuff
plugin = Plugin()


class PluginInformation:
    name = plugin.name
    version = plugin.addon.getAddonInfo('version')


# settings stuff
languages = ['fr', 'de', 'en', 'es', 'pl']
qualities = ['SQ', 'EQ', 'HQ']

# defaults to fr
language = plugin.get_setting('lang', choices=languages) or languages[0]
# defaults to SQ
quality = plugin.get_setting('quality', choices=qualities) or qualities[0]

# my imports
import view


@plugin.route('/', name='index')
def index():
    return view.build_categories(language)


@plugin.route('/category/<category_code>', name='category')
def category(category_code):
    return view.build_category(category_code, language)
Пример #22
0
    '爱情', '剧情', '喜剧', '科幻', '动作', '犯罪', '冒险', '家庭', '战争', '悬疑', '恐怖', '历史',
    '伦理', '罪案', '警匪', '惊悚', '奇幻', '魔幻', '青春', '都市', '搞笑', '纪录片', '时装', '动画',
    '音乐'
]

plugin = Plugin()
url_for = plugin.url_for

ADDON_PATH = plugin.addon.getAddonInfo('path').decode("utf-8")
sys.path.append(os.path.join(ADDON_PATH, 'lib'))

conn = sqlite3.connect(ADDON_PATH + '/local.db')
cur = conn.cursor()

Meiju = RenRenMeiJu()
PAGE_ROWS = int(plugin.get_setting('page_rows'))
SEASON_CACHE = plugin.get_storage('season')
HISTORY = plugin.get_storage('history')


def setSettingByRPC(key, value):
    """Set Kodi Setting by JSON-RPC

    Args:
        key (TYPE): Description
        value (TYPE): Description

    Returns:
        TYPE: Description
    """
    result = xbmc.executeJSONRPC(
Пример #23
0
from xbmcswift2 import Plugin, actions


plugin = Plugin()
sys.path.append(os.path.join(plugin.addon.getAddonInfo('path'), 'resources', 'lib'))

_ = plugin.get_string
cache = plugin.get_storage('data', TTL=0)

from helpers import Helpers
from rhapsody import exceptions

helpers = Helpers(plugin)
rhapsody = helpers.get_api()
rhapsody.DEBUG = plugin.get_setting('api_debug', converter=bool)


@plugin.route('/')
def index():
    return [
        {'label': _(30200), 'path': plugin.url_for('library')},
        {'label': _(30201), 'path': plugin.url_for('search')},
        {'label': _(30202), 'path': plugin.url_for('discover')},
        {'label': _(30203), 'path': plugin.url_for('recent')},
    ]


@plugin.route('/library')
def library():
    return [
Пример #24
0
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None


if __name__ == '__main__':
    hostname = ''
    hostname = plugin.get_setting('setHostname')
    if len(hostname) > 1:
        hostname = hostname.strip()
        hostname = hostname.strip('/')
        if str(hostname).startswith('http'):
            __BASEURL__ = hostname
        else:
            __BASEURL__ = 'https://' + hostname
    plugin.run()
    plugin.set_content('episodes')
    plugin.set_view_mode(0)
Пример #25
0
        items.append(    {
            'label': HTMLParser.HTMLParser().unescape(title.decode('utf-8')),
            'path': plugin.url_for('play',id=id),
            'thumbnail':get_icon_path('tv'),
        })
    return items


@plugin.route('/')
def index():
    items = [
    {
        'label': 'Channels',
        'path': plugin.url_for('channels'),
        'thumbnail':get_icon_path('tv'),
    },

    {
        'label': 'Olympics',
        'path': plugin.url_for('olympics'),
        'thumbnail':get_icon_path('tv'),
    },
    ]
    return items


if __name__ == '__main__':
    plugin.run()
    if big_list_view == True:
        view_mode = int(plugin.get_setting('view_mode'))
        plugin.set_view_mode(view_mode)
Пример #26
0
        ],
    }
    return plugin.finish(items, **finish_kwargs)


def get_cached(func, *args, **kwargs):
    '''Return the result of func with the given args and kwargs
    from cache or execute it if needed'''
    @plugin.cached(kwargs.pop('TTL', 1440))
    def wrap(func_name, *args, **kwargs):
        return func(*args, **kwargs)

    return wrap(func.__name__, *args, **kwargs)


def _(string_id):
    if string_id in STRINGS:
        return plugin.get_string(STRINGS[string_id])
    else:
        plugin.log.warning('String is missing: %s' % string_id)
        return string_id


if __name__ == '__main__':
    limit = plugin.get_setting('limit', int)
    api.set_limit(limit)
    try:
        plugin.run()
    except NetworkError:
        plugin.notify(msg=_('network_error'))
Пример #27
0
import sys
import stat
import subprocess
from kodipopcorntime.common import RESOURCES_PATH
from kodipopcorntime.platform import PLATFORM
from kodipopcorntime.utils import url_get
from xbmcswift2 import Plugin


ANDROID_XBMC_IDS = [
    "org.xbmc.kodi",                        # KODI XBMC
    "org.xbmc.xbmc",                        # Stock XBMC
    "tv.ouya.xbmc",                         # OUYA XBMC
    "com.semperpax.spmc",                   # SemPer Media Center (OUYA XBMC fork)
    "hk.minix.xbmc",                        # Minix XBMC
    Plugin.get_setting("android_app_id"),   # Whatever the user sets
]


def ensure_exec_perms(file_):
    st = os.stat(file_)
    os.chmod(file_, st.st_mode | stat.S_IEXEC)
    return file_


def get_torrent2http_binary():
    binary = "torrent2http%s" % (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin": # 64 bits anyway on Darwin
        platform["arch"] = "x64"
Пример #28
0
import datetime

plugin = Plugin()

base_url = 'http://www.arte.tv'
video_json = 'https://api.arte.tv/api/player/v1/config/{lang}/{id}'
daily_json = base_url + '/hbbtvv2/services/web/index.php/OPA/v3/programs/{date}/{lang}'

headers = {
    'user-agent': plugin.name + '/' + plugin.addon.getAddonInfo('version')
}

quality_map = {0: 'SQ', 1: 'EQ', 2: 'HQ', 3: 'MQ'}

# Settings
language = 'fr' if plugin.get_setting('lang', int) == 0 else 'de'
prefer_vost = plugin.get_setting('prefer_vost', bool)
quality = plugin.get_setting('quality', int)
download_folder = plugin.get_setting('download_folder', str)
download_quality = plugin.get_setting('download_quality', int)


def get_menu_items():
    return [(plugin.url_for('all'), 30001)]


def get_dates():
    today = datetime.date.today()
    one_day = datetime.timedelta(days=1)

    dates = []
Пример #29
0
# coding=utf-8
"""

Created on 1/3/14

@author: monizh

"""
from xbmcswift2 import Plugin
from resources.lib.api import EyeTV

plugin = Plugin()
api = EyeTV(server=plugin.get_setting('server'), port=plugin.get_setting('port'))


@plugin.route('/')
def index():
    items = [{
        'label': p['title'],
        'path': plugin.url_for('playlist', playlist_id=p['Playlist ID']),
    } for p in api.get_playlists()]
    return items

@plugin.route('/playlist/<playlist_id>/')
def playlist(playlist_id):
    items = [{
        'label': r['display title'],
        'thumbnail': api.get_thumbnail(r['id']),
        'path': plugin.url_for('play_episode', ref_id=r['id']),
        'is_playable': True
    } for r in api.get_recordings(playlist_id)]
Пример #30
0
    dates.append((str(today), plugin.get_string(30008)))  # Today
    dates.append((str(today - one_day), plugin.get_string(30009)))  # Yesterday
    for i in xrange(2, 8):  #TODO: find better interval
        cdate = today - (one_day * i)
        dates.append((str(cdate), '{d:%A}, {d:%d}'.format(d=cdate)))
    return dates


headers = {
    'user-agent': plugin.name + '/' + plugin.addon.getAddonInfo('version')
}

quality_map = {0: 'SQ', 1: 'EQ', 2: 'HQ', 3: 'MQ'}

# Settings
language = 'FR' if plugin.get_setting('lang', int) == 0 else 'DE'
prefer_vost = plugin.get_setting('prefer_vost', bool)
quality = plugin.get_setting('quality', int)
protocol = 'HBBTV' if plugin.get_setting('protocol', int) == 0 else 'RMP4'
download_folder = plugin.get_setting('download_folder', str)
download_quality = plugin.get_setting('download_quality', int)
download_nfo = plugin.get_setting('download_nfo', bool)


@plugin.route('/')
def index():
    items = [{
        'label': plugin.get_string(sid),
        'path': path
    } for path, sid in get_menu_items()]
    items.append({
# global declarations
# plugin stuff
plugin = Plugin()


class PluginInformation:
    name = plugin.name
    version = plugin.addon.getAddonInfo('version')


# settings stuff
languages = ['fr', 'de', 'en', 'es', 'pl']
qualities = ['SQ', 'EQ', 'HQ']

# defaults to fr
language = plugin.get_setting('lang', int, languages) or languages[0]
# defaults to SQ
quality = plugin.get_setting('quality', int, qualities) or qualities[0]

# my imports
import view


@plugin.route('/', name='index')
def index():
    return view.build_categories(language)


@plugin.route('/category/<category_code>', name='category')
def category(category_code):
    return view.build_category(category_code, language)
Пример #32
0
lib = os.path.join( lib, 'resources', 'lib')
print lib
sys.path.append(lib)

sys.path.append (xbmc.translatePath( os.path.join( os.getcwd(), 'resources', 'lib' ) ))

import urllib
import requests
from xbmcswift2 import actions

import thetvdbapi, MovieMeta
api = thetvdbapi.TheTVDB()
movie_meta = MovieMeta.TMDB()


api_key = plugin.get_setting('api_key' ,str)
api_key = api_key.replace(' ','')

plugin.log.info('API Key ' +api_key)

headers = {'Authorization': api_key}

api_url = 'http://%s:%s/api/1.0/' % (plugin.get_setting('host',str),plugin.get_setting('port',str))

tmp_path = plugin.get_setting('tmp_path' ,str)
tmp_path += "*.*"
dl_path = plugin.get_setting('xg_dl_path',str)
dl_path+='*.*'


@plugin.route('/')
Пример #33
0
import time

from xbmcswift2 import Plugin, xbmc, SortMethod, logger
import requests

from course_utils import (extractDuration, getContentURL, getSylabus,
                          isSettingsBad, loadClasses)
from coursera_login import getClassCookies

plugin = Plugin()

if plugin.get_setting('enable_debug', bool):
    plugin.log.setLevel(level=logger.logging.DEBUG)


@plugin.route('/classes/', name="classes")
@plugin.route('/', name="index")
def index():
    username = plugin.get_setting('username')
    password = plugin.get_setting('password')

    if isSettingsBad(username, password):
        plugin.open_settings()
        username = plugin.get_setting('username')
        password = plugin.get_setting('password')

        if isSettingsBad(username, password):
            return []

    try:
        classes = loadClasses(username, password)
Пример #34
0
"""
    EuroShare.eu Kodi addon
    ~~~~~~~~~~~~~~~~~~

    Watch videos without download via euroshare.eu
    http://euroshare.eu/

    :copyright: (c) 2015 by Jakub Smutný
    :license: GPLv3, see LICENSE.txt for more details.
"""

from xbmcswift2 import Plugin
from resources.lib.api import EuroshareApi, NetworkError

plugin = Plugin()
username = plugin.get_setting('username', unicode)
password = plugin.get_setting('password', unicode)
api = EuroshareApi(username, password, plugin.storage_path)

STRINGS = {
    'not_logged': 30000,
    'credit': 30001,
    'search_video': 30002,
    'network_error': 30010
}


@plugin.route('/')
def show_root_menu():
    """The plugin menu, shows available categories"""
    credit = api.get_credit()
Пример #35
0
import time

from xbmcswift2 import Plugin, xbmc, SortMethod, logger
import requests

from course_utils import (extractDuration, getContentURL, getSylabus,
                          isSettingsBad, loadClasses)
from coursera_login import getClassCookies

plugin = Plugin()

if plugin.get_setting('enable_debug', bool):
    plugin.log.setLevel(level=logger.logging.DEBUG)


@plugin.route('/classes/', name="classes")
@plugin.route('/', name="index")
def index():
    username = plugin.get_setting('username')
    password = plugin.get_setting('password')

    if isSettingsBad(username, password):
        plugin.open_settings()
        username = plugin.get_setting('username')
        password = plugin.get_setting('password')

        if isSettingsBad(username, password):
            return []

    try:
        classes = loadClasses(username, password)
Пример #36
0
        return plugin.play_video(vitem)
    except:
        plugin.notify(
            msg="Failed to resolve {0} to a playable video.".format(url))
    try:
        if resolved is None or len(resolved) < 5:
            import YoutubeDLWrapper
            ytdl = YoutubeDLWrapper._getYTDL()
            ytdl.clearDownloadParams()
            resolved = ytdl.extract_info(url, download=False)
            vitem = ListItem(label=url, path=resolved)
            vitem.is_folder = False
            vitem.set_is_playable = True
            vitem.set_info(type='video', info_labels={'Title': url})
            vitem.add_stream_info(stream_type='video', stream_values={})
            plugin.set_resolved_url(resolved)
            return plugin.play_video(vitem)
    except:
        plugin.notify(
            msg="Failed to resolve {0} to a playable video.".format(url))
    return None


if __name__ == '__main__':
    plugin.run()
    mode = int(plugin.get_setting(key='viewmode'))
    if mode is not None and mode >= 0:
        VIEWMODE = mode
    plugin.set_view_mode(view_mode_id=VIEWMODE)
    plugin.set_content('movies')
Пример #37
0
            fpin = file(savedpath)
            rawjson = fpin.read()
            sitems = json.loads(rawjson)
            fpin.close()
        else:
            return []
        for item in sitems:
            li = ListItem.from_dict(**item)
            li.add_context_menu_items(
                [('Remove Saved Show',
                  'RunPlugin("{0}")'.format(plugin.url_for(removeshow, name=li.label, link=li.path)),)])
            litems.append(li)
    except:
        pass
    return litems


if __name__ == '__main__':
    hostname = ''
    hostname = plugin.get_setting('setHostname')
    if len(hostname) > 1:
        hostname = hostname.strip()
        hostname = hostname.strip('/')
        if str(hostname).startswith('http'):
            __BASEURL__ = hostname
        else:
            __BASEURL__ = 'https://' + hostname
    plugin.run()
    plugin.set_content('episodes')
    plugin.set_view_mode(plugin.get_setting('viewmode'))
Пример #38
0
from xbmcswift2 import Plugin, xbmc
from settings import SETTING_LANGUAGE_ID, SETTING_TVDB_API

plugin = Plugin()

if plugin.get_setting(SETTING_LANGUAGE_ID, unicode) == "system":
    LANG = xbmc.getLanguage(xbmc.ISO_639_1, )
else:
    LANG = plugin.get_setting(SETTING_LANGUAGE_ID, unicode)

TVDB_API = plugin.get_setting(SETTING_TVDB_API, str)


def import_tmdb():
    """ Lazy import tmdb """
    import tmdbsimple
    __builtins__["tmdb"] = tmdbsimple


def import_tvdb():
    """ Lazy import tmdb """
    if 'tvdb' not in __builtins__:
        __builtins__['tvdb'] = create_tvdb()


def create_tvdb(language=LANG):
    from tvdb_api import Tvdb
    if len(TVDB_API) == 16:
        try:
            TVDB_KEY = TVDB_API
        except:
Пример #39
0
def log(v):
    xbmc.log(repr(v), xbmc.LOGERROR)


addon = xbmcaddon.Addon()
plugin = Plugin()
big_list_view = True


@encode_decode
def plugin_url_for(plugin, *args, **kwargs):
    return plugin.url_for(*args, **kwargs)


if plugin.get_setting('multiline', str) == "true":
    CR = "[CR]"
else:
    CR = ""


def get_icon_path(icon_name):
    return "special://home/addons/%s/resources/img/%s.png" % (addon_id(),
                                                              icon_name)


def remove_formatting(label):
    label = re.sub(r"\[/?[BI]\]", '', label, flags=re.I)
    label = re.sub(r"\[/?COLOR.*?\]", '', label, flags=re.I)
    return label
Пример #40
0
from xbmcswift2 import Plugin, xbmc
from settings import SETTING_LANGUAGE_ID

plugin = Plugin()

if plugin.get_setting(SETTING_LANGUAGE_ID, converter=str) == "system":
    LANG = xbmc.getLanguage(xbmc.ISO_639_1, )
else:
    LANG = plugin.get_setting(SETTING_LANGUAGE_ID, converter=str)


def import_tmdb():
    """ Lazy import tmdb """
    import tmdbsimple
    __builtins__["tmdb"] = tmdbsimple


def import_tvdb():
    """ Lazy import tmdb """
    if 'tvdb' not in __builtins__:
        __builtins__['tvdb'] = create_tvdb()


def create_tvdb(language=LANG):
    from tvdb_api import Tvdb
    return Tvdb("0629B785CE550C8D",
                language=language,
                cache=plugin.storage_path)
Пример #41
0
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])

my_addon = xbmcaddon.Addon('plugin.video.nytimes')
xbmcplugin.setContent(addon_handle, 'movies')
times_base_url = "http://www.nytimes.com"
init_url = "http://www.nytimes.com/video/"
global sections
global content
sections = []
content = []

plugin = Plugin()
videotype = plugin.get_setting('videotype', int)


def build_url(query):
    return base_url + '?' + urllib.urlencode(query)


mode = args.get('mode', None)

if mode is None:
    sections = getSubjects(init_url, sections)
    # insert the ALL Videos section
    sections.insert(0, ("All Videos", "All Videos"))

    for item in sections:
        times_section = "".join(item[0])
Пример #42
0
import os
import re
import requests
import sys
import time
import urllib
import xbmc, xbmcaddon, xbmcvfs, xbmcgui
import xbmcplugin
import zipfile
from collections import OrderedDict
#xbmc.log(repr(sys.argv))
from trakt import Trakt

plugin = Plugin()

if plugin.get_setting('english') == 'true':
    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 6.1; rv:48.0) Gecko/20100101 Firefox/48.0',
        'Accept-Language': 'en',
        "X-Forwarded-For": "8.8.8.8"
    }
else:
    headers = {}

big_list_view = False


def log(x):
    xbmc.log(repr(x), xbmc.LOGERROR)
Пример #43
0
        filedata = f.read().split('\n')[0].split(':')
        if len(filedata) < 2:
            return
        
        username, password = filedata[:2]
    
    plugin.set_setting('ip', '127.0.0.1')
    plugin.set_setting('port', '58846')
    plugin.set_setting('username', username)
    plugin.set_setting('password', password)

def check_config():
    try:
        client = get_client()
        client.call('core.get_free_space')
    except:
        return False
    else:
        return True

if __name__ == '__main__':
    if not plugin.get_setting('first_run_done', str):
        plugin.set_setting('first_run_done', 'run')
        do_first_run()
    
    if not check_config():
        plugin.notify('Unable to connect to Deluge')
        plugin.open_settings()
    else:
        plugin.run()
Пример #44
0
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#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/>.

from xbmcswift2 import Plugin
import xbmc, xbmcgui
import sys

from resources.drundoo import drundoo

plugin = Plugin()
my_drundoo = drundoo(plugin.get_setting('username'),plugin.get_setting('password'))


@plugin.route('/')
def index():
    
    items = [{'label':'Live', 'path':plugin.url_for('live')},
             {'label':'Timeshift', 'path':plugin.url_for('time')},
             {'label':'Playlist', 'path':plugin.url_for('playlist')},
             {'label':'ZAPIS', 'path':plugin.url_for('zapis')}
            ]
        
    return items

######################################
#This section is for the live stations
Пример #45
0
    profile = plugin.addon.getAddonInfo('profile')
    addonpath = plugin.addon.getAddonInfo('path')
    _use_cache = plugin.get_setting('cache', bool) or False
    _cache_db_path = xbmc.translatePath(profile)
    _cache_db_store = '.storage/'
    _cache_db_name = 'ARTE_CACHE.db'
    _cache_db_long = _cache_db_path + _cache_db_store + _cache_db_name
    _cache_db_table = 'arte_cache'


# settings stuff
languages = ['fr', 'de', 'en', 'es', 'pl']
qualities = ['SQ', 'EQ', 'HQ']

# defaults to fr
language = languages[plugin.get_setting('lang', int)] or languages[0]
# defaults to SQ
quality = qualities[plugin.get_setting('quality', int)] or qualities[0]

# my imports
import view
import ostools


@plugin.route('/', name='index')
def index():
    return view.build_categories(language)


@plugin.route('/category/<category_code>', name='category')
def category(category_code):
Пример #46
0
            ('LABEL', '%X'),
        ],
    }
    return plugin.finish(items, **finish_kwargs)


def get_cached(func, *args, **kwargs):
    '''Return the result of func with the given args and kwargs
    from cache or execute it if needed'''
    @plugin.cached(kwargs.pop('TTL', 1440))
    def wrap(func_name, *args, **kwargs):
        return func(*args, **kwargs)
    return wrap(func.__name__, *args, **kwargs)


def _(string_id):
    if string_id in STRINGS:
        return plugin.get_string(STRINGS[string_id])
    else:
        plugin.log.warning('String is missing: %s' % string_id)
        return string_id


if __name__ == '__main__':
    limit = plugin.get_setting('limit', int)
    api.set_limit(limit)
    try:
        plugin.run()
    except NetworkError:
        plugin.notify(msg=_('network_error'))
Пример #47
0
    You should have received a copy of the GNU General Public License
    along with Ex.Ua.videos.  If not, see <http://www.gnu.org/licenses/>.
'''

from xbmcswift2 import Plugin, actions
import urllib, bs4, os, sys, xbmc, xbmcplugin, time
from multiprocessing import Pool
#from resources.lib.parser import get_categories, get_movie_list, get_playlist, get_movie_info, get_search_list
from resources.lib.parser import *

xbmc.log(msg='[ex.ua.videos]' + '----- start ----', level=xbmc.LOGDEBUG)

plugin = Plugin()
# settings
lang = plugin.get_setting('resources_language', int)
cache_flag = plugin.get_setting('cache_on_flag', bool)
cache_ttl = plugin.get_setting('cache_TTL', int) * 60
connect_timeout = float(plugin.get_setting('connect_timeout'))
read_timeout = float(plugin.get_setting('read_timeout'))
max_retries = plugin.get_setting('max_retries', int)
pages_preload = plugin.get_setting('pages_preload', int)

_addon_id = int(sys.argv[1])
addon_path = plugin.addon.getAddonInfo('path').decode('utf-8')
#sys.path.append(os.path.join(addon_path, 'resources', 'lib'))


# localization
import xbmcaddon
addon = xbmcaddon.Addon()
Пример #48
0
    
    based on: https://github.com/jbeluch/plugin.video.documentary.net
    Uitzendinggemist(NPO) / uzg = Made by Bas Magre (Opvolger)
    
'''
from xbmcswift2 import Plugin, SortMethod
import resources.lib.uzg
import time
import xbmcplugin

PLUGIN_NAME = 'uzg'
PLUGIN_ID = 'plugin.video.uzg'
plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)

uzg = resources.lib.uzg.Uzg()
subtitle = plugin.get_setting("subtitle", bool)


@plugin.route('/')
def index():
    ##main, alle shows
    items = [{
        'path':
        plugin.url_for('show_afleveringen', nebo_id=item['nebo_id']),
        'label':
        item['label'],
        'thumbnail':
        item['thumbnail'],
    } for item in uzg.get_overzicht()]
    return items
Пример #49
0
"""
from xbmcswift2 import Plugin, actions
import xbmcvfs
import os
import json

plugin = Plugin()
_L = plugin.get_string

plugin_path = plugin.addon.getAddonInfo('path')
lib_path = os.path.join(plugin_path, 'resources', 'lib')
sys.path.append(lib_path)

vidmap = None
import dabdate
vidmap_path = plugin.get_setting('vidmap_path', str)
print vidmap_path
if vidmap_path:
    try:
        f = xbmcvfs.File(vidmap_path)
        vidmap = json.load(f)
        f.close()
        plugin.log.info("direct play is enabled with " + vidmap_path)
    except:
        vidmap = None

qualcode = {
    '': '1',  # default
    _L(31000): '1',  # medium
    _L(31001): '2',  # low
    _L(31002): '3',  # high
Пример #50
0
from xbmcswift2 import Plugin
import xbmcplugin
from resources.lib.util import scape_xml_headers
from resources.lib.util import getParserFilePath
from resources.lib.util import parse_xml_romfile

# xbmcswift2 determines the content type from 'content.game.internet.arcive'.split('.')[1],
# but only for 'video', 'audio' and 'music' so we need to manually specify it (TODO: patch xbmcswift2)
plugin = Plugin(info_type='game') 

iarl_setting_clean_list = plugin.get_setting('iarl_setting_clean_list', bool)

@plugin.route('/') #Start Page
def index():
    items = []
    emu_info = scape_xml_headers() #Find all xml dat files and get the header info

    for ii in range(0,len(emu_info['emu_name'])):
        items.append({ 
            'label' : emu_info['emu_name'][ii],
            'path': plugin.url_for('get_rom_page', category_id=emu_info['emu_name'][ii]),
            'info_type': 'folder',
            'icon': emu_info['emu_logo'][ii],
            'thumbnail' : emu_info['emu_thumb'][ii],
            'info' : {
                'FolderPath': emu_info['emu_baseurl'][ii]
            },
            'properties' : {
                'fanart_image': emu_info['emu_fanart'][ii],
                'banner' : emu_info['emu_banner'][ii],
                'clearlogo': emu_info['emu_logo'][ii]
Пример #51
0
    one_day = datetime.timedelta(days=1)

    dates = []
    dates.append((str(today), plugin.get_string(30008))) # Today
    dates.append((str(today - one_day), plugin.get_string(30009))) # Yesterday
    for i in xrange(2, 8): #TODO: find better interval
        cdate = today - (one_day * i)
        dates.append((str(cdate), '{d:%A}, {d:%d}'.format(d=cdate)))
    return dates

headers = {'user-agent': plugin.name + '/' + plugin.addon.getAddonInfo('version')}

quality_map = {0: 'SQ', 1: 'EQ', 2: 'HQ', 3: 'MQ'}

# Settings
language = 'FR' if plugin.get_setting('lang', int) == 0 else 'DE'
prefer_vost = plugin.get_setting('prefer_vost', bool)
quality = plugin.get_setting('quality', int)
protocol = 'HBBTV' if plugin.get_setting('protocol', int) == 0 else 'RMP4'
download_folder = plugin.get_setting('download_folder', str)
download_quality = plugin.get_setting('download_quality', int)
download_nfo = plugin.get_setting('download_nfo', bool)


@plugin.route('/')
def index():
    items = [{
        'label': plugin.get_string(sid),
        'path': path
    } for path, sid in get_menu_items()]
    items.append({
    urls = plugin.get_storage('urls')
    labels = plugin.get_storage('labels')
    thumbnails = plugin.get_storage('thumbnails')

    output_folder = "special://profile/addon_data/plugin.program.simple.favourites/folders"
    xbmcvfs.mkdirs(output_folder)

    for folder in folders:
        thumbnail = folders.get(folder,'')
        path = "%s/%s/" % (output_folder,folder)
        xbmcvfs.mkdirs(path)
        xbmcvfs.File("%sicon.txt","wb").write(thumbnail)

    for url in sorted(urls, key=lambda x: labels[x]):
        folder = folder_urls.get(url,'')
        label = labels[url]
        thumbnail = thumbnails[url]
        if folder:
            path = "%s/%s" % (output_folder,folder)
        else:
            path = output_folder
        favourites_file = "%s/favourites.xml" % path
        play_url = escape('ActivateWindow(10025,"%s")' % (url))
        add_favourite(favourites_file,label,play_url,thumbnail)


if __name__ == '__main__':
    plugin.run()
    if big_list_view == True:
        view_mode = int(plugin.get_setting('view_mode'))
        plugin.set_view_mode(view_mode)
Пример #53
0
import xbmcplugin
import base64
import random
#from HTMLParser import HTMLParser
import urllib
import sqlite3
import time, datetime
import threading
import HTMLParser
import json
import sys

plugin = Plugin()
big_list_view = False

if plugin.get_setting('english') == 'true':
    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 6.1; rv:50.0) Gecko/20100101 Firefox/50.0',
        'Accept-Language': 'en-US,en;q=0.5',
        "X-Forwarded-For": "54.239.17.118"
    }
else:
    headers = {}


def addon_id():
    return xbmcaddon.Addon().getAddonInfo('id')


def log(v):
Пример #54
0
ADDON = xbmcaddon.Addon()
ADDON_ID = ADDON.getAddonInfo('id')
ADDON_ICON = ADDON.getAddonInfo('icon')
ADDON_NAME = ADDON.getAddonInfo('name')
ADDON_PATH = ADDON.getAddonInfo('path').decode("utf-8")
ADDON_VERSION = ADDON.getAddonInfo('version')
ADDON_DATA_PATH = xbmc.translatePath("special://profile/addon_data/%s" %
                                     ADDON_ID).decode("utf-8")
sys.path.append(os.path.join(ADDON_PATH, 'resources', 'lib'))
from rrmj import *
from common import *

plugin = Plugin()
Meiju = RenRenMeiJu()
PAGE_ROWS = plugin.get_setting("page_rows")
SEASON_CACHE = plugin.get_storage('season')
HISTORY = plugin.get_storage('history')


def parse_qs(qs):
    return dict([s1.split('=') for s1 in urllib.unquote(qs).split('&')])


def remap_url(req_url, page=1):
    array = req_url.split("?")
    params = parse_qs(array[1])
    if array[0] == "/video/search":
        endpoint = "search"
        if "cat" in params:
            endpoint = "cat_list"
import resources.lib.cheez_api as cheez_api


STRINGS = {
    'page': 30000,
    'browse_by_site': 30001,
    'random_by_category': 30002,
    'new_random': 30003,
}

plugin = Plugin()

api = cheez_api.CheezburgerApi(
    developer_key='df1b9bff-ce69-46e7-8732-1035272f3ee7',
    client_id=2117,
    default_count=plugin.get_setting('per_page', int)
)

force_thumbnail = plugin.get_setting('force_viewmode', bool)


@plugin.route('/')
def show_menu():
    items = (
        {'label': _('browse_by_site'),
         'path': plugin.url_for('show_sites')},
        {'label': _('random_by_category'),
         'path': plugin.url_for('show_categories')},
    )
    return plugin.finish(items)