コード例 #1
0
                   '-o test.flv'
               ) % rtmp_params

    def xbmc_output(rtmp_params):
        return (
                   '%(rtmp_url)s '
                   'app=%(app)s '
                   'swfUrl=%(swf_url)s '
                   'playpath=%(playpath)s '
                   'live=%(live)s '
                   'pageUrl=%(video_page_url)s '
               ) % rtmp_params

    playback_url = xbmc_output(rtmp_params)
    plugin.log.info('RTMP cmd: %s' % rtmpdump_output(rtmp_params))
    plugin.log.info('XBMC cmd: %s' % xbmc_output(rtmp_params))

    return plugin.set_resolved_url(playback_url)


def _art(file, *args):
    return os.path.join(plugin.addon.getAddonInfo('path'), file, *args)


if __name__ == '__main__':
    cache = plugin.get_storage('channels_cache.txt', TTL=CACHE_DURATION_MINUTES)
    api = TeledunetAPI(cache)

    if api:
        plugin.run()
コード例 #2
0
ファイル: main.py プロジェクト: Inter95/tutvguia
    params1 = {}
    for item in opciones.split("\n"):
        if item.strip() != "":
            key, value = item.strip()[:-1].split(':')
            params1[key] = value.replace("'", "")
    # settings.debug(params1)
    urlPage = re.search('url: "(.*?)"', data).group(1)
    return urlPage, params, params1["totalPages"]


##INITIALISATION
storage = Storage(settings.storageName, type="dict", eval=True)
plugin = Plugin()
isLogin = False
# Getting the cookies from cache
cookies = plugin.get_storage('cookies', TTL=5)
if settings.value["user"] == "" or settings.value["password"] == "":
    settings.dialog.ok(settings.cleanName, "Por favor, suministre su usuario y clave")
    settings.settings.openSettings()
    settings = Settings()

if len(cookies.items()) < 2:
    settings.log("Asking the new credentials")
    browser.get(settings.value["urlAddress"] + "/")
    goodSpider()
    params = {"user": settings.value["user"],
              "password": settings.value["password"]}
    browser.post(settings.value["urlAddress"] + "/ajax/login_check_user.php", data={"user": settings.value["user"]})
    browser.post(settings.value["urlAddress"] + "/ajax/login_check_pass.php", data=params)
    browser.post(settings.value["urlAddress"] + "/ajax/login_check.php", data=params)
    cookies.update(browser.cookies.items())
コード例 #3
0
                   '-o test.flv'
               ) % rtmp_params

    def xbmc_output(rtmp_params):
        return (
                   '%(rtmp_url)s '
                   'app=%(app)s '
                   'swfUrl=%(swf_url)s '
                   'playpath=%(playpath)s '
                   'live=%(live)s '
                   'pageUrl=%(video_page_url)s '
               ) % rtmp_params

    playback_url = xbmc_output(rtmp_params)
    plugin.log.info('RTMP cmd: %s' % rtmpdump_output(rtmp_params))
    plugin.log.info('XBMC cmd: %s' % xbmc_output(rtmp_params))

    return plugin.set_resolved_url(playback_url)


def _art(file, *args):
    return os.path.join(plugin.addon.getAddonInfo('path'), file, *args)


if __name__ == '__main__':
    cache = plugin.get_storage('teledunet_cache.txt', TTL=CACHE_DURATION_MINUTES)
    api = TeledunetAPI(cache)

    if api:
        plugin.run()
コード例 #4
0
ファイル: addon.py プロジェクト: poingg/CloudPTXBMC
import os.path

sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'resources/lib'))

from xbmcswift2 import Plugin
from xbmcswift2 import xbmc, xbmcgui, xbmcaddon
from requests_oauthlib import OAuth1Session, OAuth1
import requests
from datetime import datetime, timedelta
from xml.dom.minidom import parseString
import oauthlib
import urllib


plugin = Plugin()
storage = plugin.get_storage('storage')

OAUTH_CONSUMER_KEY = 'fa1c9359-984c-40af-bed0-18854a1f4647'
OAUTH_CONSUMER_SECRET = '137108407390855967187518585103907027345'

OAUTH_REQUEST_TOKEN_URL = 'https://cloudpt.pt/oauth/request_token'
OAUTH_AUTHORIZE_TOKEN_URL = 'https://cloudpt.pt/oauth/authorize'
OAUTH_ACCESS_TOKEN_URL = 'https://cloudpt.pt/oauth/access_token'

PUNY_URL = 'http://services.sapo.pt/PunyURL/GetCompressedURLByURL'

CLOUDPT_API_URL = 'https://api.cloudpt.pt'
CLOUDPT_API_CONTENT_URL = 'https://api-content.cloudpt.pt'

API_METADATA_URL = CLOUDPT_API_URL + '/1/Metadata/cloudpt'
API_SEARCH_URL = CLOUDPT_API_URL + '/1/Search/cloudpt/'
コード例 #5
0
ファイル: path.py プロジェクト: lordor2/xbmc-addons-chinese
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"
        elif "mark" in params:
コード例 #6
0
import os
import sys

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')
コード例 #7
0
        # setup any auth-related data here
        self.access_token = access_token

    def __call__(self, r):
        # modify and return the request
        r.headers['Authorization'] = 'Bearer %s' % self.access_token
        return r


STRINGS = {
}

base_url = 'https://www.googleapis.com/youtube/v3'
plugin = Plugin()

storage = plugin.get_storage('youtube_oauth')
client_id = '739224800601-arh67kfq6144gjegtg93thk5npsv1h8d.apps.googleusercontent.com'
client_secret = 'Ca-ViXwmygO8ozjA0bdr5IaC'
server_key = 'AIzaSyDv00GEeBNXguqKJQiYLeDlkbx0MU6b9tE'

@plugin.route('/')
def show_root_menu():
	items = [
		{'label': 'Top Rated', 'path': plugin.url_for('top_rated')},
		{'label': 'Search', 'path': plugin.url_for('search')},
		{'label': 'My channels', 'path': plugin.url_for('my_channels')},
	]
	if storage.get('access_token'):
		items.append({'label': 'Logout', 'path': plugin.url_for('logout')})
	else:
		items.append({'label': 'Login', 'path': plugin.url_for('login')})
コード例 #8
0
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})',
                  lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()

reqid = 0
uid = '_26187_'
headers = {
    'user-agent':
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
}
his = plugin.get_storage('his')
cache = plugin.get_storage('cache')


def del_kr(txt):
    while True:
        if re.search('\[(.*?)\]/(http|https):\/\/([\w.]+\/?)\S*/', txt):
            txt = txt.replace(
                re.search('\[(.*?)\]/(http|https):\/\/([\w.]+\/?)\S*/',
                          txt).group(), '(图片)')
        else:
            if re.search('\[(.*?)\]', txt):
                txt = txt.replace(re.search('\[(.*?)\]', txt).group(), '(表情)')
            else:
                break
    return txt
コード例 #9
0
ファイル: default.py プロジェクト: HDPxbmc/plugin.video.115
        retId = prefix
        retId += self.encodess(int(time.time()),8)
        retId += self.encodess(phpjs, 5)
        return retId
    def encodess(self,seed, reqWidth):
        seed = hex(int(seed))[2:]
        if (reqWidth < len(seed)):
            return seed[len(seed) - reqWidth:]
        if (reqWidth >  len(seed)):
            return (1 + (reqWidth - seed.length)).join('0') + seed
        return seed
plugin = Plugin()
ppath = plugin.addon.getAddonInfo('path')
cookiefile = os.path.join(ppath, 'cookie.dat')
xl = api_115(cookiefile)
urlcache = plugin.get_storage('urlcache', TTL=5)

@plugin.route('/login')
def login():
    plugin.open_settings()
    user = plugin.get_setting('username')
    passwd = plugin.get_setting('password')
    if not (user and passwd):
        return
    vcode=xl.encodes()
    data = urllib.urlencode({'login[ssoent]': 'A1', 'login[version]': '2.0', 'login[ssoext]': vcode,
                             'login[ssoln]':user, 'login[ssopw]':xl.depass(user,passwd,vcode),'login[ssovcode]':vcode,
                             'login[safe]':'1','login[time]':'1','login[safe_login]':'1','goto':'http://m.115.com/?ac=home'})
    xl.cookiejar.clear()
    login_page = xl.urlopen('http://passport.115.com/?ct=login&ac=ajax&is_ssl=1', data=data)
    msgs=json.loads(xl.fetch(login_page))
コード例 #10
0
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    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.

from novaprinter import prettyPrinter
from helpers import retrieve_url, download_file
import json, urllib, re, xbmc, xbmcgui

from xbmcswift2 import Plugin
plugin = Plugin()
webproxy = plugin.get_storage('webproxy')


class btdigg(object):
    url = 'http://btdigg.org/search'
    name = 'btdigg'
    supported_categories = {'all': ''}

    def __init__(self):
        pass

    def download_torrent(self, info):
        print download_file(info, info)

    def getwebproxy(self):
        try:
コード例 #11
0
    # wait for the current item to finish before exiting
    while not xbmc.abortRequested and not player.has_stopped:
        xbmc.sleep(10)

    plugin.log.info('Player: Exited')
    return plugin.finish()


if __name__ == '__main__':
    sys.stdout = StringIO()
    sys.path.append(
        os.path.join(plugin.addon.getAddonInfo('path'), 'resources', 'lib'))

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

    import requests

    requests.packages.urllib3.disable_warnings()

    from helpers import Helpers

    helpers = Helpers(plugin)

    try:
        from rhapsody import exceptions

        rhapsody = helpers.get_api()
        rhapsody.ENABLE_RTMP = plugin.get_setting('api_transport',
                                                  converter=str) == 'RTMP'
コード例 #12
0



def unescape(string):
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})', lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()



apikey = plugin.get_storage('apikey',TTL=30)
xbbxmp4 = plugin.get_storage('xbbxmp4',TTL=60)
headers = {'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'}
mheaders = {'user-agent' : 'Mozilla/5.0 (Linux; Android 10; Z832 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Mobile Safari/537.36'}

@plugin.cached(TTL=10)
def get_hash():
    hashurl = 'https://weibomiaopai.com/online-video-download-helper/bilibili'
    rec = requests.get(hashurl,headers=headers)
    rec.encoding = 'utf-8'
    rte = rec.text
    str1 = rte.find('var freeservice=')
    str2 = rte.find('var thepage="bilibili";')
    cut = rte[str1+16:str2]
    cut = cut.replace('\n','')
    cut = cut.replace(';','')
コード例 #13
0
ファイル: addon.py プロジェクト: edevil/CloudPTXBMC
        self.addControl(self.button0)
        self.setFocus(self.button0)

    def onAction(self, action):
        ACTION_PREVIOUS_MENU = 10
        ACTION_SELECT_ITEM = 7
        if action == ACTION_PREVIOUS_MENU or action == ACTION_SELECT_ITEM:
            self.close()

    def onControl(self, control):
        if control == self.button0:
            self.close()


plugin = Plugin()
storage = plugin.get_storage(name='storage', file_format='pickle', TTL=None)

OAUTH_CONSUMER_KEY = 'fa1c9359-984c-40af-bed0-18854a1f4647'
OAUTH_CONSUMER_SECRET = '137108407390855967187518585103907027345'

OAUTH_REQUEST_TOKEN_URL = 'https://meocloud.pt/oauth/request_token'
OAUTH_AUTHORIZE_TOKEN_URL = 'https://meocloud.pt/oauth/authorize'
OAUTH_ACCESS_TOKEN_URL = 'https://meocloud.pt/oauth/access_token'

PUNY_URL = 'http://services.sapo.pt/PunyURL/GetCompressedURLByURL'

CLOUDPT_API_URL = 'https://api.meocloud.pt'
CLOUDPT_API_CONTENT_URL = 'https://api-content.meocloud.pt'

API_METADATA_URL = CLOUDPT_API_URL + '/1/Metadata/meocloud'
API_SEARCH_URL = CLOUDPT_API_URL + '/1/Search/meocloud/'
コード例 #14
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, xbmc
from resources.lib.api import \
    ItunesPodcastApi, NetworkError, NoEnclosureException

plugin = Plugin()
api = ItunesPodcastApi()
my_podcasts = plugin.get_storage('my_podcasts.json', file_format='json')

STRINGS = {
    'all': 30000,
    'browse_by_genre': 30002,
    'show_my_podcasts': 30003,
    'search_podcast': 30004,
    'video': 30005,
    'audio': 30006,
    'add_to_my_podcasts': 30010,
    'remove_from_my_podcasts': 30011,
    'network_error': 30200,
    'no_media_found': 30007,
}

コード例 #15
0
import time
import urllib
import urllib2
import httplib
from StringIO import StringIO
from xbmcswift2 import xbmc
from xbmcswift2 import Plugin
from xbmcswift2 import xbmcgui
try:
    from ChineseKeyboard import Keyboard
except:
    from xbmc import Keyboard

plugin = Plugin()
dialog = xbmcgui.Dialog()
epcache = plugin.get_storage('epcache', TTL=1440)

baseurl = r'http://www.fyyy7.com'

@plugin.route('/')
def showcatalog():
    """
    show catalog list
    """
    if baseurl in epcache:
        return epcache[baseurl]
    result = _http(baseurl)
    catastr = re.search(r'<div class="menu".*?<ul>(.*?)</ul>',
                        result, re.S)
    catalogs = re.findall(r'<li class="letter_3"><a href="(.*?)">(.*?)</a>', catastr.group(1),re.S)
    menus = [{
コード例 #16
0
ファイル: addon.py プロジェクト: Gemini88/addons
#
#    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, xbmc
from resources.lib.api import ShoutcastApi, NetworkError

plugin = Plugin()
api = ShoutcastApi('sh1t7hyn3Kh0jhlV')
my_stations = plugin.get_storage('my_stations.json', file_format='json')

STRINGS = {
    'all': 30000,
    'top500_stations': 30001,
    'browse_by_genre': 30002,
    'my_stations': 30003,
    'search_station': 30004,
    'search_current_track': 30005,
    'add_to_my_stations': 30010,
    'remove_from_my_stations': 30011,
    'network_error': 30200
}


@plugin.route('/')
コード例 #17
0
import xbmcplugin
import xbmcgui
import xbmcaddon
import copy
from xbmcswift2 import Plugin, actions
from resources.lib.shahidnet.utils import imagePath
from resources.lib.shahidnet.api import ShahidNetAPI
from resources.lib.shahidnet.models import MediaType
from resources.lib.shahidnet.scraper import FILTER_GENRE, FILTER_DIALECT, FILTER_PROGRAM_TYPE


plugin = Plugin()

SEARCH_LIMIT = 10

CACHE_NEW_FILTER = plugin.get_storage("CACHE_NEW_FILTER")

CACHE_FILTERS = plugin.get_storage("CACHE_FILTERS")
# CACHE_FILTERS.clear()

STRINGS = {
    # Root menu
    "filter": 30000,
    "channels": 30001,
    "search": 30002,
    "most_popular": 30003,
    "date_released": 30004,
    "add_filter": 30005,
    "program_type": 30006,
    "genre": 30007,
    "dialect": 30008,
コード例 #18
0
ファイル: addon.py プロジェクト: bialagary/mw
#    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, xbmc
from resources.lib.api import \
    ItunesPodcastApi, NetworkError, NoEnclosureException

plugin = Plugin()
api = ItunesPodcastApi()
my_podcasts = plugin.get_storage('my_podcasts.json', file_format='json')

STRINGS = {
    'all': 30000,
    'browse_by_genre': 30002,
    'show_my_podcasts': 30003,
    'search_podcast': 30004,
    'video': 30005,
    'audio': 30006,
    'add_to_my_podcasts': 30010,
    'remove_from_my_podcasts': 30011,
    'network_error': 30200,
    'no_media_found': 30007,
}

コード例 #19
0
#

from urlparse import parse_qsl, urlparse
import HTMLParser

from xbmcswift2 import Plugin
from xbmcswift2 import actions

import requests

import xbmc
import xbmcgui

plugin = Plugin()

storage = plugin.get_storage('KodditStorage', file_format='json')
if 'subreddits' not in storage:
    storage['subreddits'] = []

base_url = 'http://www.reddit.com'
sub_json = base_url + '/r/{sub}/{cat}.json'

categories = [('new', 30001),
              ('hot', 30002),
              ('top_h', 30003),
              ('top_d', 30004),
              ('top_w', 30005),
              ('top_m', 30006),
              ('top_y', 30007),
              ('top_a', 30008)]
コード例 #20
0
                             comment=None,
                             port=None,
                             rest={},
                             rfc2109=False)
        self.cookiejar.set_cookie(c)
        self.cookiejar.save(cookiefile, ignore_discard=True)

    def md5(self, s):
        import hashlib
        return hashlib.md5(s).hexdigest().lower()


dialog = xbmcgui.Dialog()
ppath = plugin.addon.getAddonInfo('path')
cookiefile = os.path.join(ppath, 'cookie.dat')
dbapi = 'https://api.douban.com/v2/movie'
cloudurlpre = 'http://i.vod.xunlei.com'
lxurlpre = 'http://dynamic.cloud.vip.xunlei.com'
filters = plugin.get_storage('ftcache', TTL=1440)
magnets = plugin.get_storage('ftcache')

cachetime = int(time.time() * 1000)
randomtime = '%s%06d.%s' % (cachetime, randint(
    0, 999999), randint(100000000, 9999999999))

xl = HttpClient(cookiefile)
hc = HttpClient()

if __name__ == '__main__':
    plugin.run()
コード例 #21
0
ACTION_PREVIOUS_MENU = 10
ACTION_SHOW_INFO = 11
ACTION_PAUSE = 12
ACTION_STOP = 13
ACTION_NEXT_ITEM = 14
ACTION_PREV_ITEM = 15
ACTION_SHOW_GUI = 18
ACTION_PLAYER_PLAY = 79
ACTION_MOUSE_LEFT_CLICK = 100
ACTION_CONTEXT_MENU = 117

plugin = Plugin()
root_url = 'http://www.youku.com/v_showlist/c0.html'
html_parser = HTMLParser.HTMLParser()

epcache = plugin.get_storage('epcache', TTL=10080)


class BaseWindow(xbmcgui.WindowXML):
    def __init__(self, *args, **kwargs):
        self.oldWindow = None
        xbmcgui.WindowXML.__init__(self)

    def doClose(self):
        self.session.window = self.oldWindow
        self.close()

    def onInit(self):
        self.setSessionWindow()

    def onFocus(self, controlId):
コード例 #22
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:
            endpoint = "mark_list"
コード例 #23
0
ファイル: addon.py プロジェクト: catro/plugin.video.youku_new
ACTION_PREVIOUS_MENU  = 10
ACTION_SHOW_INFO      = 11
ACTION_PAUSE          = 12
ACTION_STOP           = 13
ACTION_NEXT_ITEM      = 14
ACTION_PREV_ITEM      = 15
ACTION_SHOW_GUI       = 18
ACTION_PLAYER_PLAY    = 79
ACTION_MOUSE_LEFT_CLICK = 100
ACTION_CONTEXT_MENU   = 117

plugin = Plugin()
root_url = 'http://www.youku.com/v_showlist/c0.html'
html_parser = HTMLParser.HTMLParser()

epcache = plugin.get_storage('epcache', TTL=10080)

class BaseWindow(xbmcgui.WindowXML):
    def __init__( self, *args, **kwargs):
        self.oldWindow = None
        xbmcgui.WindowXML.__init__( self )
        
    def doClose(self):
        self.session.window = self.oldWindow
        self.close()
        
    def onInit(self):
        self.setSessionWindow()
        
    def onFocus( self, controlId ):
        self.controlId = controlId
コード例 #24
0
#    print film

# # print lb.get_profile('petterhj')
# # print lb._get_poster('the-guest-2014')

# print '='*20

# import resources.models.film

from xbmcswift2 import xbmc, xbmcgui, Plugin

xbmc.executebuiltin("Notification('Title','Message')")

plugin = Plugin()

films = plugin.get_storage('films')

def test():
	print 'test ran'
	return '2014'


# f1 = {'slug': 'hateship-loveship', 'title': 'Hateship, loveship', 'year': test()}
# f2 = {'slug': 'the-matrix', 'title': 'The Matrix', 'year': '1999'}

# films[f1['slug']] = f1

# print films['hateship-loveship']

# films.sync()
コード例 #25
0
# coding: utf-8
# Main Addon
__author__ = 'mancuniancol'

from xbmcswift2 import Plugin
from tools2 import *

##INITIALISATION
storage = Storage(settings.storageName, type="dict", eval=True)
plugin = Plugin()

cookies = plugin.get_storage('token', TTL=15)
if cookies.get("token", "") == "":
    response = browser.get(settings.value["urlAddress"] + "?get_token=get_token&app_id=rarbg-viewer")
    data = response.json()
    cookies["token"] = data["token"]
    cookies.sync()
    settings.log("new token updated!")


###############################
###  MENU    ##################
###############################
@plugin.route('/')
def index():
    textViewer(settings.string(32000), once=True)
    items = [
        {'label': settings.string(32194),
         'path': plugin.url_for('searchMenu'),
         'thumbnail': dirImages("search.png"),
         'properties': {'fanart_image': settings.fanart}
コード例 #26
0
import xbmcplugin
import xbmcgui
import xbmcaddon
import copy
from xbmcswift2 import Plugin, actions
from resources.lib.shahidnet.utils import imagePath
from resources.lib.shahidnet.api import ShahidNetAPI
from resources.lib.shahidnet.models import MediaType
from resources.lib.shahidnet.scraper import FILTER_GENRE, FILTER_DIALECT, FILTER_PROGRAM_TYPE

plugin = Plugin()

SEARCH_LIMIT = 10

CACHE_NEW_FILTER = plugin.get_storage('CACHE_NEW_FILTER')

CACHE_FILTERS = plugin.get_storage('CACHE_FILTERS')
#CACHE_FILTERS.clear()

STRINGS = {
    # Root menu
    'filter': 30000,
    'channels': 30001,
    'search': 30002,
    'most_popular': 30003,
    'date_released': 30004,
    'add_filter': 30005,
    'program_type': 30006,
    'genre': 30007,
    'dialect': 30008,
    'save': 30009,
コード例 #27
0
ファイル: addon.py プロジェクト: mammothb/xbmc-addons-chinese
import gzip
import urllib
import urllib2
import httplib
import base64
import time
from StringIO import StringIO
from xbmcswift2 import xbmc
from xbmcswift2 import Plugin
from xbmcswift2 import xbmcgui
from collections_backport import OrderedDict
from ChineseKeyboard import Keyboard

plugin = Plugin()
dialog = xbmcgui.Dialog()
filters = plugin.get_storage("ftcache", TTL=1440)
epcache = plugin.get_storage("epcache", TTL=1440)


@plugin.route("/")
def showcatalog():
    """
    show catalog list
    """
    url = "http://www.youku.com/v/"
    if url in epcache:
        return epcache[url]
    result = _http(url)
    catastr = re.search(r'yk-filter-panel">(.*?)yk-filter-handle', result, re.S)
    catalogs = re.findall(r'href="(.*?)".*?>(.*?)</a>', catastr.group(1))
    menus = [
コード例 #28
0
import os
import xbmcplugin, xbmcgui, xbmcaddon
from operator import itemgetter
from xbmcswift2 import Plugin
from resources.lib.teledunet.api import TeledunetAPI

# Setup global variables
PLUGIN_NAME = 'Teledunet.com'
PLUGIN_ID = 'plugin.video.teledunet'
CACHE_DURATION_MINUTES = 20

# Create Plugin object
plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)

# Instantiate API object
cache = plugin.get_storage('channels_cache.txt', TTL=CACHE_DURATION_MINUTES)
api = TeledunetAPI(cache)


@plugin.route('/')
def list_categories():
    items = [{
        'label': channel['title'],
        'path': plugin.url_for('play_video', url=channel['path']),
        'is_playable': True,
        'thumbnail': channel['thumbnail']
    } for channel in api.get_channels()]

    return plugin.finish(items, sort_methods=['label'])

コード例 #29
0
    "search_for_station": 30200,
    "enter_name_country_or_language": 30201,
    "add_to_my_stations": 30400,
    "remove_from_my_stations": 30401,
    "edit_custom_station": 30402,
    "please_enter": 30500,
    "name": 30501,
    "thumbnail": 30502,
    "stream_url": 30503,
    "add_custom": 30504,
}


plugin = Plugin(addon_id="plugin.audio.radio_de")
radio_api = RadioApi()
my_stations = plugin.get_storage("my_stations.json", file_format="json")


@plugin.route("/")
def show_root_menu():
    items = (
        {"label": _("local_stations"), "path": plugin.url_for("show_local_stations")},
        {"label": _("editorials_recommendations"), "path": plugin.url_for("show_recommendation_stations")},
        {"label": _("top_100_stations"), "path": plugin.url_for("show_top_stations")},
        {"label": _("browse_by_genre"), "path": plugin.url_for("show_station_categories", category_type="genre")},
        {"label": _("browse_by_topic"), "path": plugin.url_for("show_station_categories", category_type="topic")},
        {"label": _("browse_by_country"), "path": plugin.url_for("show_station_categories", category_type="country")},
        {"label": _("browse_by_city"), "path": plugin.url_for("show_station_categories", category_type="city")},
        {"label": _("browse_by_language"), "path": plugin.url_for("show_station_categories", category_type="language")},
        {"label": _("search_for_station"), "path": plugin.url_for("search")},
        {"label": _("my_stations"), "path": plugin.url_for("show_my_stations")},
コード例 #30
0
def get_real_url(url):
    rs = requests.get(url, headers=headers, timeout=2)
    return rs.url


def unescape(string):
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})',
                  lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()

cache = plugin.get_storage('cache', TTL=60)
headers = {
    'user-agent':
    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
}


def get_categories():
    return [{
        'name': '妇产科疾病',
        'link': '1'
    }, {
        'name': '儿科疾病',
        'link': '2'
    }, {
        'name': '神经系统疾病',
コード例 #31
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"
        elif "mark" in params:
コード例 #32
0
    # wait for the current item to finish before exiting
    monitor = xbmc.Monitor()
    while not monitor.abortRequested() and not player.has_stopped:
        if monitor.waitForAbort(1):
            break

    plugin.log.info('Player: Exited')


if __name__ == '__main__':
    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')
コード例 #33
0
    'user-agent':
    'Mozilla/5.0 (iPad; CPU OS 10_15_4 Supplemental Update like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/605.1.15'
}
iphoneheaders = {
    'user-agent':
    'Mozilla/5.0 (iPhone; CPU OS 10_15_4 Supplemental Update like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/14E304 Safari/605.1.15'
}
mheaders = {
    'user-agent':
    'Mozilla/5.0 (Linux; Android 10; Z832 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Mobile Safari/537.36'
}
headers = {
    'user-agent':
    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
}
tmp = plugin.get_storage('tmp')

#用户设置存储
storage = plugin.get_storage('storage')
#搜索历史纪录
his = plugin.get_storage('his')


def chushihua(key, default):
    if key in storage:
        switch = storage[key]
    else:
        storage[key] = default
        switch = storage[key]
    if switch == 1:
        value = '开'
コード例 #34
0
                '--swfUrl "%(swf_url)s" '
                '--playpath "%(playpath)s" '
                '-o test.flv') % rtmp_params

    def xbmc_output(rtmp_params):
        return ('%(rtmp_url)s '
                'app=%(app)s '
                'swfUrl=%(swf_url)s '
                'playpath=%(playpath)s '
                'live=%(live)s '
                'pageUrl=%(video_page_url)s ') % rtmp_params

    playback_url = xbmc_output(rtmp_params)
    plugin.log.info('RTMP cmd: %s' % rtmpdump_output(rtmp_params))
    plugin.log.info('XBMC cmd: %s' % xbmc_output(rtmp_params))

    return plugin.set_resolved_url(playback_url)


def _art(file, *args):
    return os.path.join(plugin.addon.getAddonInfo('path'), file, *args)


if __name__ == '__main__':
    cache = plugin.get_storage('teledunet_cache.txt',
                               TTL=CACHE_DURATION_MINUTES)
    api = TeledunetAPI(cache)

    if api:
        plugin.run()
コード例 #35
0
ファイル: addon.py プロジェクト: mbr/xvisi
    import lxml
    lxml
except ImportError:
    dialog = xbmcgui.Dialog()
    dialog.ok('Sorry!', "Sorry, but you don't have lxml available and we",
                        "can't install it for you. Contact your xbmc-supplier",
                        "for a fix - or sneakily do it yourself!")
    import sys
    sys.exit(0)

from resources.lib.xvisi import all_sites, get_sources_for
from resources.lib.xvisi.base import XVisiExternalError

plugin = Plugin()

_history = plugin.get_storage('search_history')
if not 'entries' in _history:
    _history['entries'] = []


DOWNLOAD_MOVIE_FN = os.path.join(
    xbmc.translatePath('special://temp/'),
    'xvisi-video-tmp'
)
BUFSIZE = 1024 * 4


def format_delta(s):
    s = int(s)

    def pluralize(n, word):
コード例 #36
0
def unescape(string):
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})',
                  lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()

headers = {
    'user-agent':
    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
}
tmp = plugin.get_storage('tmp')

#用户设置存储
storage = plugin.get_storage('storage')


def chushihua(key, default):
    if key in storage:
        switch = storage[key]
    else:
        storage[key] = default
        switch = storage[key]
    if switch == 1:
        value = '开'
    else:
        value = '关'
コード例 #37
0
def get_real_url(url):
    rs = requests.get(url, headers=headers, timeout=2)
    return rs.url


def unescape(string):
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})',
                  lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()

cookie = plugin.get_storage('cookie', TTL=60)
cookiebak = plugin.get_storage('cookiebak')
apicache = plugin.get_storage('apicache', TTL=60)


#@plugin.cached(TTL=60*24)
def cook():
    if 'wafid' in cookie:
        q = 1

        dialog = xbmcgui.Dialog()
        dialog.notification('提示', '缓存中已有wafid,跳过获取wafid',
                            xbmcgui.NOTIFICATION_INFO, 2000, False)
    else:
        #if 'wafid' in cookiebak:
        #r = requests.get('http://www.ixigua.com',headers=headers,cookies=cookiebak)
コード例 #38
0
IMAGES_PATH = xbmc.translatePath(os.path.join(__resource__, 'media'))
__subpath__ = xbmc.translatePath( os.path.join( __cwd__, 'subtitles') )
if not os.path.exists(__subpath__):
    os.makedirs(__subpath__)
__temppath__  = xbmc.translatePath( os.path.join( __cwd__, 'temp') )
if not os.path.exists(__temppath__):
    os.makedirs(__temppath__)

import six
from six.moves.urllib import parse
from six.moves.urllib import request
from six.moves import http_cookiejar as cookielib

from xbmcswift2 import Plugin
plugin = Plugin()
setthumbnail=plugin.get_storage('setthumbnail')
setthumbnail['set']=False

moviepoint=plugin.get_storage('moviepoint')
searchvalues=plugin.get_storage('searchvalues')

colors = {'dir': 'FF9966','video': 'FF0033','bt': '33FF00', 'audio': '66CCCC', 'subtitle':'505050', 'image': '99CC33',
        'back': '0099CC','next':'CCCCFF', 'menu':'CCFF66', 'star1':'FFFF00','star0':'777777','sort':'666699','filter':'0099CC',
        '-1':'FF0000','0':'8B4513','1':'CCCCFF','2':'7FFF00'}

ALL_VIEW_CODES = {
    'list': {
        'skin.confluence': 50, # List
        'skin.estuary': 50, # List
        'skin.aeon.nox': 50, # List
        'skin.droid': 50, # List
コード例 #39
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
from xbmcswift2 import Plugin

import requests
import logging

logging.basicConfig(level=logging.DEBUG)

plugin = Plugin()

source_url = 'https://github.com/google/ExoPlayer/raw/dev-v2/demo/src/main/assets/media.exolist.json'
g_source_json = ''
g_storage = plugin.get_storage('storage', TTL=60 * 24)


def load_json(url, params=None, headers=None):
    r = requests.get(url, params=params, headers=headers)
    return r.json()


def check_source():
    global g_source_json

    if g_source_json is None and 'source_json' in g_storage:
        return

    g_source_json = load_json(source_url)
    g_storage['source_json'] = g_source_json
コード例 #40
0
ファイル: addon.py プロジェクト: JacobZy/plugin.video.fytv
import time
import urllib
import urllib2
import httplib
from StringIO import StringIO
from xbmcswift2 import xbmc
from xbmcswift2 import Plugin
from xbmcswift2 import xbmcgui
try:
    from ChineseKeyboard import Keyboard
except:
    from xbmc import Keyboard

plugin = Plugin()
dialog = xbmcgui.Dialog()
filters = plugin.get_storage('ftcache', TTL=1440)
epcache = plugin.get_storage('epcache', TTL=1440)

baseurl = r'http://www.fuyin.tv'

@plugin.route('/')
def showcatalog():
    """
    show catalog list
    """
    if baseurl in epcache:
       return epcache[baseurl]
    result = _http(baseurl)
    catastr = re.search(r'<div class="nav".*?<ul>(.*?)</ul>',
                        result, re.S)
    catalogs = re.findall(r'<a href="(/content/category.*?)" title="(.*?)"', catastr.group(1),re.S)
コード例 #41
0
ファイル: addon.py プロジェクト: camster1/RTOTV
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Watch films from http://classiccinemaonline.com.

    :copyright: (c) 2012 by Jonathan Beluch
    :license: GPLv3, see LICENSE.txt for more details.
'''
from xbmcswift2 import Plugin, xbmcgui
from resources.lib import api


plugin = Plugin()


# Warn users that some menus may be empty
user_data = plugin.get_storage('user_data')
if 'not_first_time' not in user_data.keys():
    dialog = xbmcgui.Dialog()
    dialog.ok(
        'Classic Cinema',
        'The website has recently changed so all of the old',
        'films are not yet uploaded to the new website.'
    )
    user_data['not_first_time'] = True


@plugin.route('/')
def show_browse_methods():
    '''Default view. Displays the different ways to browse the site.'''
    items = [{
        'label': ctg,
コード例 #42
0
    'search_for_station': 30200,
    'enter_name_country_or_language': 30201,
    'add_to_my_stations': 30400,
    'remove_from_my_stations': 30401,
    'edit_custom_station': 30402,
    'mark_autostart': 30403,
    'unmark_autostart': 30404,
    'please_enter': 30500,
    'name': 30501,
    'thumbnail': 30502,
    'stream_url': 30503,
    'add_custom': 30504
}
plugin = Plugin()
radio_api = RadioApi()
my_stations = plugin.get_storage('my_stations.json', file_format='json')


@plugin.route('/')
def show_root_menu():
    items = (
        {'label': _('local_stations'),
         'path': plugin.url_for('show_local_stations')},
        {'label': _('editorials_recommendations'),
         'path': plugin.url_for('show_recommendation_stations')},
        {'label': _('top_100_stations'),
         'path': plugin.url_for('show_top_stations')},
        {'label': _('browse_by_genre'),
         'path': plugin.url_for('show_station_categories',
                                category_type='genre')},
        {'label': _('browse_by_topic'),
コード例 #43
0
#!/usr/bin/python
# -*- coding: utf8 -*-

from xbmcswift2 import Plugin, xbmc
from json import loads
from bigmovie import BigMovie

plugin = Plugin()
Bigmovie = BigMovie()
HISTORY = plugin.get_storage('history')


def colorize(label, color):
    return "[COLOR %s]" % color + label + "[/COLOR]"


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

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

    Returns:
        TYPE: Description
    """
    result = xbmc.executeJSONRPC(
        '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"%s", "value":%s}, "id":1}'
        % (key, value))
    result = loads(result)
    return result