本文整理汇总了Python中xbmcswift2.Plugin类的典型用法代码示例。如果您正苦于以下问题:Python Plugin类的具体用法?Python Plugin怎么用?Python Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: TestParseRequest
class TestParseRequest(TestCase):
def setUp(self):
name = "Hello XBMC"
plugin_id = "plugin.video.helloxbmc"
path = os.path.join(os.path.dirname(__file__), "data", "plugin", "addon.py")
with preserve_cwd(os.path.dirname(path)):
self.plugin = Plugin(name, plugin_id, path)
def test_parse_request(self):
with patch("xbmcswift2.plugin.Request") as MockRequest:
sys.argv = ["plugin://plugin.video.helloxbmc", "0", "?"]
self.plugin._parse_request()
MockRequest.assert_called_with("plugin://plugin.video.helloxbmc?", "0")
def test_parse_request_no_qs(self):
with patch("xbmcswift2.plugin.Request") as MockRequest:
sys.argv = ["plugin://plugin.video.helloxbmc", "0"]
self.plugin._parse_request()
MockRequest.assert_called_with("plugin://plugin.video.helloxbmc", "0")
def test_parse_request_path_in_arg0(self):
# Older versions of xbmc sometimes pass path in arg0
with patch("xbmcswift2.plugin.Request") as MockRequest:
sys.argv = ["plugin://plugin.video.helloxbmc/videos/", "0", "?foo=bar"]
self.plugin._parse_request()
MockRequest.assert_called_with("plugin://plugin.video.helloxbmc/videos/?foo=bar", "0")
def test_parse_request_path_in_arg2(self):
# Older versions of xbmc sometimes pass path in arg2
with patch("xbmcswift2.plugin.Request") as MockRequest:
sys.argv = ["plugin://plugin.video.helloxbmc", "0", "/videos/?foo=bar"]
self.plugin._parse_request()
MockRequest.assert_called_with("plugin://plugin.video.helloxbmc/videos/?foo=bar", "0")
开发者ID:andi3000,项目名称:xbmcswift2,代码行数:33,代码来源:test_plugin.py
示例2: __init__
def __init__(self):
self.plugin = Plugin()
self.plugin.register_module(menu.Module(), '')
self.plugin.register_module(showlist.Module(), '')
self.plugin.register_module(playlist.Module(), '')
self.plugin.register_module(videolist.Module(), '')
self.plugin.register_module(play.Module(), '')
self.utils = Utils(self.plugin)
self.utils.log_init()
开发者ID:totalpcc,项目名称:plugin.video.catchuptv.au.ten,代码行数:10,代码来源:__init__.py
示例3: __init__
def __init__(self, addon_dir=None):
self.addon_dir = addon_dir
self.plugin = Plugin()
self.plugin.register_module(menu.Module(), '')
self.plugin.register_module(showlist.Module(), '')
self.plugin.register_module(playlist.Module(), '')
self.plugin.register_module(videolist.Module(), '')
self.plugin.register_module(play.Module(), '')
self.utils = Utils(self.plugin, addon_dir=self.addon_dir)
self.utils.log_init()
开发者ID:johnmee,项目名称:plugin.video.catchuptv.au.ten,代码行数:12,代码来源:__init__.py
示例4: Plugin
from xbmcswift2 import Plugin, xbmcgui
import resources.lib.util as util
from resources.lib.abc_base import BaseI4M
from resources.lib.sites import *
import urllib
plugin = Plugin()
STRINGS = {
'url_resolver_settings': 30100,
'try_again': 30050,
'site_unavailable': 30051,
'is_unavailable': 30052,
'try_again_later': 30053,
'no_valid_links': 30057,
'cannot_play': 30058,
'no_search_terms': 30060,
'video_url_not_found': 30061,
'unresolvable_link': 30062
}
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
开发者ID:irfancharania,项目名称:plugin.video.india4movie,代码行数:30,代码来源:addon.py
示例5: Plugin
from xbmcswift2 import Plugin
import xbmc,xbmcaddon,xbmcvfs,xbmcgui
import re
import requests
import resources.lib.pytz
from resources.lib.pytz import timezone
import datetime
plugin = Plugin()
def log2(v):
xbmc.log(repr(v))
def log(v):
xbmc.log(re.sub(',',',\n',repr(v)))
def get_tvdb_id(name):
tvdb_url = "http://thetvdb.com//api/GetSeries.php?seriesname=%s" % name
r = requests.get(tvdb_url)
tvdb_html = r.text
tvdb_id = ''
tvdb_match = re.search(r'<seriesid>(.*?)</seriesid>', tvdb_html, flags=(re.DOTALL | re.MULTILINE))
if tvdb_match:
tvdb_id = tvdb_match.group(1)
return tvdb_id
@plugin.route('/play/<channel>/<title>/<season>/<episode>')
def play(channel,title,season,episode):
开发者ID:primaeval,项目名称:plugin.video.tvlistings,代码行数:31,代码来源:main.py
示例6: Plugin
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
from xbmcswift2 import Plugin
# 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]
开发者ID:known-as-bmf,项目名称:plugin.video.arteplussept,代码行数:31,代码来源:addon.py
示例7: Plugin
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path as path
import json
import re
import urllib
from urllib import quote_plus
import ssl
import requests
from unidecode import unidecode
import webutil as WebUtils
from xbmcswift2 import Plugin, xbmc, ListItem, download_page, clean_dict, SortMethod
plugin = Plugin()
ssl._create_default_https_context = ssl._create_unverified_context
__BASEURL__ = u'https://watchseries-online.pl'
__addondir__ = xbmc.translatePath(plugin.addon.getAddonInfo('path'))
__datadir__ = xbmc.translatePath('special://profile/addon_data/{0}/'.format(plugin.id))
__cookie__ = path.join(__datadir__, 'cookies.lwp')
__temp__ = path.join(__datadir__, 'temp/')
__resdir__ = path.join(__addondir__, 'resources')
__imgsearch__ = path.join(__resdir__, 'search.png')
__savedjson__ = path.join(xbmc.translatePath(plugin.addon.getAddonInfo('profile')), 'savedshows.json')
getWeb = WebUtils.CachedWebRequest(path.join(__datadir__, 'cookies.lwp'), __temp__)
#getWeb = WebUtils.BaseRequest(path.join(__datadir__, 'cookies.lwp'))
def loadsaved():
sitems = []
litems = []
items = []
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:31,代码来源:old_addon.py
示例8: Plugin
# 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.
#
# 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
from resources.lib.api import Api, ApiError
plugin = Plugin()
api = Api(logger=plugin.log)
@plugin.route('/')
def show_root_menu():
items = [
{
'label': station.name,
'path': plugin.url_for('play', api_id=station.api_id),
}
for station in api.get_stations()
]
return plugin.finish(items)
开发者ID:D3X,项目名称:plugin.audio.rmfon,代码行数:29,代码来源:addon.py
示例9: Plugin
from xbmcswift2 import Plugin, xbmcgui
from resources.lib.api import SiteApi
plugin = Plugin()
api = SiteApi()
@plugin.cached_route("/")
def index():
"""
Get movie categories
"""
plugin.log.debug("Get category menu")
c = api.get_menu_category()
items = [
{
"label": item["label"],
"path": plugin.url_for("browse_category", menuid=item.get("pk", "0"), page=1, url=item["url"]),
}
for item in c
]
return items
@plugin.cached_route("/<menuid>/page/<page>")
def browse_category(menuid, page="1"):
"""
开发者ID:wljcom,项目名称:dkodi,代码行数:31,代码来源:addon.py
示例10: Plugin
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)
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:21,代码来源:__init__.py
示例11: Plugin
# 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.
#
# 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
from resources.lib.api import NetzkinoApi, NetworkError
plugin = Plugin()
api = NetzkinoApi()
@plugin.route('/')
def show_categories():
categories = api.get_categories()
items = [{
'label': item['title'],
'path': plugin.url_for(
endpoint='show_movies',
category_id=str(item['id'])
)
} for item in categories]
return plugin.finish(items)
开发者ID:Countbasic,项目名称:repository.mediabox.storage,代码行数:30,代码来源:addon.py
示例12: Plugin
# 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.
#
# 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
}
开发者ID:Gemini88,项目名称:addons,代码行数:30,代码来源:addon.py
示例13: Plugin
Reddit Music
~~~~~~~~~~~~
An XBMC addon for watching and listenting to music found on a variety of
subreddits.
:copyright: (c) 2012 by Jonathan Beluch
:license: GPLv3, see LICENSE.txt for more details.
'''
import operator
from xbmcswift2 import Plugin
from resources.lib.subreddits import subreddits
from resources.lib import mediahosts, playlists, reddit
plugin = Plugin()
plugin.register_module(playlists.playlists, '/playlists')
red = reddit.Reddit(user_agent='XBMC')
STRINGS = {
'browse_subreddits': 30010,
'my_playlists': 30011,
'add_to_playlist': 30012,
}
def _(string_id):
return plugin.get_string(STRINGS[string_id])
开发者ID:accumulator,项目名称:xbmc-reddit-music,代码行数:29,代码来源:addon.py
示例14: Plugin
import xbmc
import xbmcaddon
import xbmcgui
import datetime
import urlparse
import urllib2
import re
import HTMLParser
import codecs
# The following modules require an import entry in the addon.xml.
import urlresolver.types
from xbmcswift2 import Plugin
from bs4 import BeautifulSoup
plugin = Plugin()
MYNAME = "Movie4k.to"
CACHE_TTL = 360 # 6 hours
THUMBNAIL_PATH = os.path.join( plugintools.get_runtime_path() , "resources" , "img" )
FANART = os.path.join( plugintools.get_runtime_path() , "fanart.jpg" )
FORUM_URL = 'http://forums.tvaddons.ag'
plugintools.module_log_enabled = (plugintools.get_setting("debug")=="true")
plugintools.http_debug_log_enabled = (plugintools.get_setting("debug")=="true")
HOSTERS_BLACKLIST = [] # ["filenuke", "divxstage", "streamclou", "xvidstage", "rapidvideo"]
if plugintools.get_setting("use_anonymizer_site")=="true":
ANON_URL = 'http://anonymouse.org/cgi-bin/anon-www.cgi/'
MAIN_URL = ANON_URL + 'http://www.movie4k.to/'
elif plugintools.get_setting("use_alternative_site_url")=="true":
MAIN_URL = plugintools.get_setting("alternative_site_url")
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:31,代码来源:default.py
示例15: Plugin
# -*- coding: utf-8 -*-
"""
Dabdate - Korea Drama/TV Shows Streaming Service
"""
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
开发者ID:hojel,项目名称:plugin.video.dabdate.com,代码行数:31,代码来源:addon.py
示例16: Plugin
# -*- 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,
TwitchException.JSON_ERROR : 30027}
code = exception.code
开发者ID:G4RL1N,项目名称:Twitch.tv-on-XBMC,代码行数:31,代码来源:default.py
示例17: Storage
params[key] = value.replace("'", "")
# settings.debug(params)
opciones = re.search("var options =(.*?);", data, re.DOTALL).group(1).replace("{", "").replace("}", "") + ": ''"
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"]})
开发者ID:Inter95,项目名称:tutvguia,代码行数:31,代码来源:main.py
示例18: it
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]
开发者ID:BRY82,项目名称:plugin.program.iarl,代码行数:31,代码来源:addon.py
示例19: to_utf8
return s
def to_utf8(s):
return _to_unicode(s).encode('utf-8')
def get_url_route(url):
result = url.rsplit('/')
del result[0:2]
return result
import sys, os, platform, random, xbmc, xbmcaddon, xbmcgui
sys.path.append( os.path.join( to_utf8(xbmcaddon.Addon().getAddonInfo( 'path' )), 'resources', 'lib', 'libs') )
from xbmcswift2 import Plugin, actions
plugin = Plugin()
import CommonFunctions
common = CommonFunctions
common.dbg = False
common.dbglevel = 5
def asyncHTTP(url):
import urllib2, threading
class aynsHTTPHandler(urllib2.HTTPHandler):
def http_response(self, req, response):
return response
o = urllib2.build_opener(aynsHTTPHandler())
开发者ID:Alwnikrotikz,项目名称:xbmc-kg-ontv,代码行数:31,代码来源:_header.py
示例20: Plugin
# (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.
#
# 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,
}
开发者ID:bialagary,项目名称:mw,代码行数:31,代码来源:addon.py
注:本文中的xbmcswift2.Plugin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论