本文整理汇总了Python中t0mm0.common.addon.Addon.get_setting方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.get_setting方法的具体用法?Python Addon.get_setting怎么用?Python Addon.get_setting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t0mm0.common.addon.Addon
的用法示例。
在下文中一共展示了Addon.get_setting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: art
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
def art(filename):
adn = Addon("plugin.video.1channel", sys.argv)
THEME_LIST = ["mikey1234", "Glossy_Black"]
THEME = THEME_LIST[int(adn.get_setting("theme"))]
THEME_PATH = os.path.join(adn.get_path(), "art", "themes", THEME)
img = os.path.join(THEME_PATH, filename)
return img
示例2: art
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
def art(file):
adn = Addon('plugin.video.1channel', sys.argv)
THEME_LIST = ['mikey1234','Glossy_Black']
THEME = THEME_LIST[int(adn.get_setting('theme'))]
THEME_PATH = os.path.join(adn.get_path(), 'art', 'themes', THEME)
img = os.path.join(THEME_PATH, file)
return img
示例3: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import os
from t0mm0.common.addon import Addon
import xbmc
import xbmcvfs
import xbmcgui
addon = Addon('plugin.video.movie25-mod')
addon_path = addon.get_path()
default_path = 'special://profile/addon_data/plugin.video.movie25/Universal'
db_path = addon.get_setting('local_save_location')
use_remote_db = addon.get_setting('use_remote_db')
db_address = addon.get_setting('db_address')
db_port = addon.get_setting('db_port')
if db_port: db_address = '%s:%s' %(db_address,db_port)
db_user = addon.get_setting('db_user')
db_pass = addon.get_setting('db_pass')
db_name = addon.get_setting('db_name')
def make_dir(mypath, dirname):
''' Creates sub-directories if they are not found. '''
subpath = os.path.join(mypath, dirname)
if not xbmcvfs.exists(subpath):
try:
xbmcvfs.mkdirs(subpath)
except:
示例4: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import sys
import json
import gzip
import urllib2
import xbmcplugin
from StringIO import StringIO
from t0mm0.common.addon import Addon
addon = Addon('plugin.video.waldo', sys.argv)
api_key = addon.get_setting('Rtn_api_key')
display_name = 'Rotten Tomatoes'
#Label that will be displayed to the user representing this index
tag = 'Rtn'
#MUST be implemented. Unique 3 or 4 character string that will be used to
#identify this index
required_addons = []
#MUST be implemented. A list of strings indicating which addons are required to
#be installed for this index to be used.
#For example: required_addons = ['script.module.beautifulsoup', 'plugin.video.youtube']
#Currently, xbmc does not provide a way to require a specific version of an addon
def get_settings_xml():
'''
Must be defined. This method should return XML which describes any Waldo
specific settings you would like for your plugin. You should make sure that
the ``id`` starts with your tag followed by an underscore.
For example:
示例5: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import os
import re
import sys
import xbmc
import xbmcgui
import xbmcplugin
# from functools import wraps
from t0mm0.common.addon import Addon
_1CH = Addon('plugin.video.1channel', sys.argv)
try:
DB_NAME = _1CH.get_setting('db_name')
DB_USER = _1CH.get_setting('db_user')
DB_PASS = _1CH.get_setting('db_pass')
DB_ADDR = _1CH.get_setting('db_address')
if _1CH.get_setting('use_remote_db') == 'true' and \
DB_ADDR is not None and \
DB_USER is not None and \
DB_PASS is not None and \
DB_NAME is not None:
import mysql.connector as orm
_1CH.log('Loading MySQL as DB engine')
DB = 'mysql'
else:
_1CH.log('MySQL not enabled or not setup correctly')
raise ValueError('MySQL not enabled or not setup correctly')
示例6: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
from metahandler import metahandlers
from metahandler import metacontainers
import metapacks
import playback
try:
from sqlite3 import dbapi2 as sqlite
print "Loading sqlite3 as DB engine"
except:
from pysqlite2 import dbapi2 as sqlite
print "Loading pysqlite2 as DB engine"
addon = Addon('plugin.video.1channel', sys.argv)
DB = os.path.join(xbmc.translatePath("special://database"), 'onechannelcache.db')
META_ON = addon.get_setting('use-meta') == 'true'
FANART_ON = addon.get_setting('enable-fanart') == 'true'
USE_POSTERS = addon.get_setting('use-posters') == 'true'
POSTERS_FALLBACK = addon.get_setting('posters-fallback') == 'true'
THEME_LIST = ['mikey1234','Glossy_Black']
THEME = THEME_LIST[int(addon.get_setting('theme'))]
THEME_PATH = os.path.join(addon.get_path(), 'art', 'themes', THEME)
AUTO_WATCH = addon.get_setting('auto-watch') == 'true'
AZ_DIRECTORIES = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z']
BASE_URL = 'http://www.1channel.ch'
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
GENRES = ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy',
'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Game-Show',
'History', 'Horror', 'Japanese', 'Korean', 'Music', 'Musical',
'Mystery', 'Reality-TV', 'Romance', 'Sci-Fi', 'Short', 'Sport',
示例7: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import xbmcvfs
import xbmcgui
import config
plugin_id = config.plugin_id
skin_id = config.skin_id
addon = Addon(plugin_id)
addon_path = addon.get_path()
default_path = 'special://profile/addon_data/'+plugin_id+'/'
db_path = os.path.join(xbmc.translatePath("special://database"), 'myvideolibrary')
use_remote_db = addon.get_setting('use_remote_db')
db_address = addon.get_setting('db_address')
db_port = addon.get_setting('db_port')
if db_port: db_address = '%s:%s' %(db_address,db_port)
db_user = addon.get_setting('db_user')
db_pass = addon.get_setting('db_pass')
db_name = addon.get_setting('db_name')
def make_dir(mypath, dirname):
''' Creates sub-directories if they are not found. '''
subpath = os.path.join(mypath, dirname)
if not xbmcvfs.exists(subpath):
try:
xbmcvfs.mkdirs(subpath)
except:
示例8:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
elif mode == 'tvseasons':
print 'tvseasons'
sh = re.sub(' ', '%20', show)
html = net.http_GET(url).content
match = re.compile('<h2 class="lists"><a href="(.+?)">(.+?) (.+?)</a> - ').findall(html)
try:
imdb_id = re.compile('<a href="http://www.imdb.com/title/(.+?)/" target="_blank">IMDB</a>', re.DOTALL).findall(html)[0]
except:
imdb_id = ''
if addon.get_setting('usemetadata') == 'true':
if imdb_id != '':
arthtml = net.http_GET('http://www.thetvdb.com/api/GetSeriesByRemoteID.php?imdbid='+imdb_id).content
else:
arthtml = net.http_GET('http://www.thetvdb.com/api/GetSeries.php?seriesname='+sh).content
try:
seriesid = re.compile('<seriesid>(.+?)</seriesid>').findall(arthtml)[0]
except:
seriesid = ''
seasons = re.compile('<h2 class="lists"><a href=".+?">Season ([0-9]+) .+?</a> -').findall(html)
num = 0
for link, season, episodes in match:
if not seriesid: crap = {'mode': 'tvepisodes', 'url': link, 'section': 'tvshows', 'imdb_id': imdb_id, 'season': num + 1}
else: crap = {'mode': 'tvepisodes', 'url': link, 'section': 'tvshows', 'imdb_id': imdb_id, 'season': num + 1, 'fanart': get_FanArt(seriesid), 'seriesid': seriesid}
示例9: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import os
import re
import sys
import urllib
import urllib2
import HTMLParser
from t0mm0.common.net import Net
from t0mm0.common.addon import Addon
addon = Addon('plugin.video.1channel', sys.argv)
BASE_URL = addon.get_setting('domain')
if ((addon.get_setting("enableDomain"))=='true') and (len(addon.get_setting("customDomain")) > 10):
BASE_URL=addon.get_setting("customDomain")
display_name = 'PrimeWire'
required_addons = []
tag = 'PWr'
def get_settings_xml():
return False
def get_results(vid_type, title, year, imdb, tvdb, season, episode):
if vid_type == 'movie':
return Search('movies', title, imdb)
elif vid_type == 'tvshow':
return _get_tvshows(title, year, imdb, tvdb)
elif vid_type == 'season':
return _get_season(title, year, imdb, tvdb, season)
elif vid_type == 'episode':
return _get_episodes(title, year, imdb, tvdb, season, episode)
示例10: CraftsyPlugin
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
class CraftsyPlugin():
addon = None
net = None
logo = None
profile_path = None
cookie_file = None
base_url = None
free_url = 'http://www.craftsy.com.edgesuite.net/'
pay_url = 'http://cd1.craftsy.com/'
def __init__(self):
self.addon = Addon('plugin.video.craftsy', sys.argv)
self.net = Net()
self.logo = os.path.join(self.addon.get_path(), 'art','logo.jpg')
self.profile_path = self.addon.get_profile()
self.cookie_file = os.path.join(self.profile_path, 'craftsy.cookies')
try:
os.makedirs(os.path.dirname(self.cookie_file))
except OSError:
pass
self.net.set_cookies(self.cookie_file)
self.base_url = 'http://www.craftsy.com'
def __get_image(self, url):
fname = os.path.join(self.profile_path, md5.new(url).digest())
print fname
if os.path.isfile(fname):
return fname
return url
def __check_link(self, url):
if (re.match('^/', url)):
return 'http:' + url
return url
def __fetch_regexp_idx(self, r, idx, default = None):
if (r == None):
return default
if (len(r.groups()) < idx + 1):
return default
return r.groups()[idx]
def check_login(self):
source = self.net.http_GET(self.base_url + '/my/home?NAVIGATION_PAGE_CONTEXT_ATTR=NONE').content
r = re.search('<title>([^<]+)</title>', source)
title = r.groups()[0]
if title == 'Welcome Back to Craftsy!':
return False
return True
def __get_url(self, url):
return self.net.http_GET(url).content.encode('utf8').replace("\n", "").replace("\r", "")
def add_classes(self):
source = self.__get_url(self.base_url + '/my/home?NAVIGATION_PAGE_CONTEXT_ATTR=NONE')
source = re.sub('<div class="classCard mostRecent".*?</div>.*?</div>.*?</div>.*?</div>', '', source)
source = re.sub('<div class="continueArea".*?</div>.*?</div>', '', source)
# parts = re.split('<div class="classBot myClassBot">', source)
r = re.findall('<a href="(/lecture[^\"]+)"(.*?)</a>[ \s\t]*<div class="classBot myClassBot">.*?<a href="([^"]+)"', source)
for i in r:
url = i[2]
if (re.match('^/', url)):
url = self.base_url + url
t = re.search('<h4>([^<]+)</h4>', i[1])
title = 'N/A'
title = self.__fetch_regexp_idx(t, 0, 'N/A')
img = self.base_url + '/images/craftsy/noImageTitleCard.png'
t = re.search('<img src="([^"]+)" alt="[^"]+" onerror', i[1])
_u = self.__fetch_regexp_idx(t, 0)
if (_u != None):
img = self.__check_link(_u)
# print self.__get_image(img)
self.addon.add_directory({'mode': 'classes', 'url': url}, {'title': title}, fanart=img, img=img)
def __try_resolve(self, pattern, video):
r = re.search(pattern, video)
return self.__fetch_regexp_idx(r, 0)
def resolve_url(self, lesson_url):
pattern = '&([0-9]+)&(pay|free)$'
l = re.search(pattern, lesson_url)
lesson_id = self.__fetch_regexp_idx(l, 0)
lesson_type = self.__fetch_regexp_idx(l, 1, 'pay')
lesson_url = re.sub(pattern, '', lesson_url)
q = self.addon.get_setting('quality')
t = self.addon.get_setting('type')
source = self.__get_url(lesson_url)
uid = re.search('/([0-9]+)\\.html(\\?t=[0-9]*){0,1}$', lesson_url)
url_id = self.__fetch_regexp_idx(uid, 0)
if (url_id == None):
#.........这里部分代码省略.........
示例11: Net
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import urllib2
import xbmc, xbmcaddon, xbmcplugin, xbmcgui
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
from bs4 import BeautifulSoup
addon_id = 'plugin.video.watchwrestling'
net = Net(user_agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36')
headers = {
'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
}
addon = Addon(addon_id, sys.argv)
BASEURL = addon.get_setting("srcweb")
#PATHS
AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, 'icons')
from universal import _common as univ_common
from universal import watchhistory, playbackengine
mode = addon.queries['mode']
url = addon.queries.get('url', '')
title = addon.queries.get('title', 'Watch Wrestling ( watchwrestling.ch )')
img = addon.queries.get('img', os.path.join(IconPath, 'icon.jpg'))
section = addon.queries.get('section', '')
page = addon.queries.get('page', '')
mediaid = addon.queries.get('mediaid', '')
示例12: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
addon = Addon('plugin.video.solarmovie', sys.argv)
cm = ContextMenu(addon)
net = Net()
net.set_user_agent('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; yie9)')
base_url = 'http://www.solarmovie.eu'
mode = addon.queries['mode']
play = addon.queries.get('play', None)
solarpath = addon.get_path()
smallimage = os.path.join(xbmc.translatePath(solarpath), \
'art','logo_in_gold_black.jpg')
numpages = numpagesindex[addon.get_setting('numpages')]
maxlinks = int(addon.get_setting('maxlinks'))
hideadult = addon.get_setting('hideadult')
enableproxy = addon.get_setting('proxy_enable')
proxyserver = addon.get_setting('proxy_server')
proxyport = addon.get_setting('proxy_port')
proxyuser = addon.get_setting('proxy_user')
proxypass = addon.get_setting('proxy_pass')
if enableproxy == 'true':
proxy = 'http://'
if proxyuser:
proxy = '%s%s:%[email protected]%s:%s' %(proxy, proxyuser, proxypass,
proxyserver, proxyport)
else:
示例13: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import os
import Queue
import sys
import threading
import time
import xbmc
import xbmcgui
from t0mm0.common.addon import Addon
from metahandler import metahandlers
addon = Addon("plugin.video.1channel", sys.argv)
try:
DB_NAME = addon.get_setting("db_name")
DB_USER = addon.get_setting("db_user")
DB_PASS = addon.get_setting("db_pass")
DB_ADDRESS = addon.get_setting("db_address")
if (
addon.get_setting("use_remote_db") == "true"
and DB_ADDRESS is not None
and DB_USER is not None
and DB_PASS is not None
and DB_NAME is not None
):
import mysql.connector as database
addon.log("Loading MySQL as DB engine")
DB = "mysql"
else:
addon.log("MySQL not enabled or not setup correctly")
raise ValueError("MySQL not enabled or not setup correctly")
示例14: Addon
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
import os
import Queue
import sys
import threading
import time
import xbmc
import xbmcgui
from t0mm0.common.addon import Addon
from metahandler import metahandlers
addon = Addon('plugin.video.1channel', sys.argv)
try:
DB_NAME = addon.get_setting('db_name')
DB_USER = addon.get_setting('db_user')
DB_PASS = addon.get_setting('db_pass')
DB_ADDRESS = addon.get_setting('db_address')
if addon.get_setting('use_remote_db')=='true' and \
DB_ADDRESS is not None and \
DB_USER is not None and \
DB_PASS is not None and \
DB_NAME is not None:
import mysql.connector as database
addon.log('Loading MySQL as DB engine')
DB = 'mysql'
else:
addon.log('MySQL not enabled or not setup correctly')
raise ValueError('MySQL not enabled or not setup correctly')
except:
try:
from sqlite3 import dbapi2 as database
示例15: str2bool
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_setting [as 别名]
historytitle = addon.queries.get('historytitle', '')
historylink = addon.queries.get('historylink', '')
iswatchhistory = addon.queries.get('watchhistory', '')
year = addon.queries.get('year', '')
show = addon.queries.get('show', '')
queued = addon.queries.get('queued', '')
items_per_page = 25
#################### Addon Settings ##################################
#Helper function to convert strings to boolean values
def str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
meta_setting = str2bool(addon.get_setting('use-meta'))
metaget=metahandlers.MetaData()
def WatchedCallback():
metaget.change_watched(video_type, show, imdb_id, season=season, episode=episode, year=year, watched=7)
xbmc.executebuiltin("Container.Refresh")
#################### Helper Functions ##################################
def unescape(text):
try:
rep = {" ": " ",
"\r": "",
"\n": "",
"\t": "",