当前位置: 首页>>代码示例>>Python>>正文


Python Addon.get_profile方法代码示例

本文整理汇总了Python中t0mm0.common.addon.Addon.get_profile方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.get_profile方法的具体用法?Python Addon.get_profile怎么用?Python Addon.get_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在t0mm0.common.addon.Addon的用法示例。


在下文中一共展示了Addon.get_profile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
	def __init__(self):
		global ADDON_ID
		global reg
		ADDON = Addon(ADDON_ID)
		self.data_root = ADDON.get_profile()
		if reg.getBoolSetting('cache_temp_custom_directory'):
			self.cache_root = reg.getSetting('cache_temp_directory')
		else:
			self.cache_root = os.path.join(xbmc.translatePath(self.data_root + 'cache'), '')
		print "Setting cache_root: %s" % self.cache_root
		self.mkdir(self.cache_root)

		if reg.getBoolSetting('cache_movie_custom_directory'):
			self.movie_root = reg.getSetting('cache_movie_directory')
		else:
			self.movie_root = os.path.join(xbmc.translatePath(self.data_root + 'cache/movies'), '')
		print "Setting movie_root: %s" % self.movie_root
		self.mkdir(self.movie_root)

		if reg.getBoolSetting('cache_tvshow_custom_directory'):
			self.tvshow_root = reg.getSetting('cache_tvshow_directory')
		else:
			self.tvshow_root = os.path.join(xbmc.translatePath(self.data_root + 'cache/tvshows'), '')	
		print "Setting tvshow_root: %s" % self.tvshow_root
		self.mkdir(self.tvshow_root)

		db_file = os.path.join(xbmc.translatePath(self.data_root), 'walter.db')
		sql_path = os.path.join(xbmc.translatePath(ROOT_PATH + '/resources/database'), '')
		self.DB = DatabaseClass(db_file, sql_path)
开发者ID:jolid,项目名称:script.module.walter,代码行数:31,代码来源:service.py

示例2: CREATE_BOXSET

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
def CREATE_BOXSET(meta_name,url):
    boxset_path = os.path.join(Addon.get_profile(), 'boxset')
    boxset = os.path.join(boxset_path, meta_name)
    if os.path.exists(boxset_path) == False:
        os.makedirs(boxset_path)
    if os.path.exists(boxset) == False:
        os.makedirs(boxset)
    meta_name = meta_name.strip()
    url = 'http://tv-release.net/?s="%s"&cat='%(meta_name).replace(' ','+')
    html = GET_HTML(url)
    print 'CBS PATH: '+addon.getAddonInfo("path")
    print 'CBS DPATH: '+Addon.get_profile()
    print 'CBS BOXSET PATH: '+boxset_path
    print 'BOXSET NAME: '+boxset

    #-----------------------------------------------------------------------
    print 'Create Boxset MetaName: '+meta_name
    print 'Create Boxset url: '+url
    if re.search(r'\s[0-9]{4}\s[0-9]{2}\s[0-9]{2}\s',meta_name,flags=re.I):
        print 'YES: Meta_name: '+meta_name

    print 'meta_name2: '+meta_name
    print 'CBS URL: '+url
开发者ID:Ultraporing,项目名称:jas0npc,代码行数:25,代码来源:default.py

示例3: Addon

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
import urllib, urllib2, re, cookielib, string, urlparse, sys, os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
import urlresolver
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net as net

addon_id = "plugin.video.movie25"
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id)
datapath = addon.get_profile()
elogo = xbmc.translatePath("special://home/addons/plugin.video.movie25/resources/art/bigx.png")


class ResolverError(Exception):
    def __init__(self, value, value2):
        self.value = value
        self.value2 = value2

    def __str__(self):
        return repr(self.value, self.value2)


def resolve_url(url):
    stream_url = False
    if url:
        try:
            match = re.search("xoxv(.+?)xoxe(.+?)xoxc", url)
            if match:
                source = urlresolver.HostedMediaFile(host=match.group(1), media_id=match.group(2))
                if source:
                    stream_url = source.resolve()
开发者ID:kragen4,项目名称:MashUp,代码行数:33,代码来源:resolvers.py

示例4: Addon

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
ADDON = Addon('plugin.video.1channel', sys.argv)
DB = os.path.join(xbmc.translatePath("special://database"), 'onechannelcache.db')
META_ON = ADDON.get_setting('use-meta')
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', 
          'Talk-Show', 'Thriller', 'War', 'Western', 'Zombies']

prepare_zip = False
metaget=metahandlers.MetaData(preparezip=prepare_zip)

if not os.path.isdir(ADDON.get_profile()):
     os.makedirs(ADDON.get_profile())

def AddOption(text, isFolder, mode, letter=None, section=None, sort=None, genre=None, query=None, page=None, img=None):
	li = xbmcgui.ListItem(text)
	fanart = os.path.join(ADDON.get_path(),'fanart.jpg')
	li.setProperty('fanart_image', fanart)
	if img is not None:
		img = os.path.join(ADDON.get_path(),'art',img)
		li.setIconImage(img)
		li.setThumbnailImage(img)
	print 'Adding option with params:\n Text: %s\n Folder: %s\n Mode %s\n Letter: %s\n Section: %s\n Sort: %s\n Genre: %s' %(text, isFolder,mode, letter, section, sort, genre)
	url = sys.argv[0]+'?mode=' + str(mode)
	if letter  is not None: url += '&letter=%s'  % letter
	if section is not None: url += '&section=%s' % section
	if sort    is not None: url += '&sort=%s'	 % sort
开发者ID:zpanderson,项目名称:1Channel,代码行数:33,代码来源:default.py

示例5: Addon

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
try:
    import json
except ImportError:
    import simplejson as json

try:
  import StorageServer
except:
  import storageserverdummy as StorageServer

BASE_URL = "http://www.flyinhd.com"
LANGS = [ 'tamil', 'hindi', 'telugu' ]

addonId = 'plugin.video.flyinhd'
addon = Addon( addonId, sys.argv )
addonPath = xbmc.translatePath( addon.get_profile() )
cookiePath = os.path.join( addonPath, 'cookies' )
cookieFile = os.path.join( cookiePath, "cookies.txt" )

net = Net()
if not os.path.exists(cookiePath):
   os.makedirs(cookiePath)
else:
   net.set_cookies( cookieFile )

cache = StorageServer.StorageServer( addonId )
cache.dbg = True
cache.dbglevel = 10

def parseMoviePage( lang ):
   print "parseMoviePage, lang:" + lang
开发者ID:Kantilal,项目名称:codenx-xbmc-addons,代码行数:33,代码来源:default.py

示例6: Addon

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [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
import sys
import threading
import time
import xbmc
import xbmcgui
from t0mm0.common.addon import Addon

SLEEP_MILLIS = 250
addon = Addon('script.module.playbackengine', sys.argv)
PROFILE_PATH = addon.get_profile()
DB_PATH = os.path.join(PROFILE_PATH, 'playbackengine.db')

if not os.path.isdir(PROFILE_PATH):
    os.makedirs(PROFILE_PATH)

try:
    from sqlite3 import dbapi2 as sqlite
    addon.log('Loading sqlite3 as DB engine')
except:
    from pysqlite2 import dbapi2 as sqlite
    addon.log('Loading pysqlite2 as DB engine')

def format_time(seconds):
    minutes,seconds = divmod(seconds, 60)
    if minutes > 60:
开发者ID:philtimmes,项目名称:addons,代码行数:32,代码来源:playbackengine.py

示例7: Addon

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
import os    
from t0mm0.common.addon import Addon
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin


addon = Addon('script.module.donnie')
addon_path = addon.get_path()
profile_path = addon.get_profile()
开发者ID:jolid,项目名称:script.module.donnie,代码行数:13,代码来源:common.py

示例8: xbmcpath

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
#pulockertv constants
putlocker_URL = 'http://www.putlockertvshows.me'
urllist = putlocker_URL+ '/tv-shows.list.html'
urlimages = putlocker_URL+ '/p/'
urlwatch = putlocker_URL+ '/watch/'
allurl = putlocker_URL + '/tv-shows-list.html'

adatapath = 'special://profile/addon_data/plugin.video.putlockertv'
metapath = adatapath+'/mirror_page_meta_cache'
downinfopath = adatapath+'/downloadinfologs'
transdowninfopath = xbmcpath(downinfopath,'')
transmetapath = xbmcpath(metapath,'')
translateddatapath = xbmcpath(adatapath,'')
path = adatapath
datapath = _PLUG.get_profile()
artdir = "special://home/addons/plugin.video.putlockertv/resources/media/"
downloadScript = "special://home/addons/plugin.video.putlockertv/resources/lib/download.py"
textBoxesScript = "special://home/addons/plugin.video.putlockertv/resources/lib/textBoxes.py"

#cookie constants
cookie_path = os.path.join(datapath)
cookiejar = os.path.join(cookie_path,'losmovies.lwp')
net = Net()


# FUNCTIONS USED   

def f7(seq):
    #sorts list
    seen = set()
开发者ID:virajkanwade,项目名称:Bunkford,代码行数:32,代码来源:default_bak.py

示例9: addst

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
### 
### ############################################################################################################
### ############################################################################################################
### ############################################################################################################
##Notes-> I placed these here so that they would be before the stuff that they use during setup.
def addst(r,s=''): return _addon.get_setting(r)   ## Get Settings
def addpr(r,s=''): return _addon.queries.get(r,s) ## Get Params
def tfalse(r,d=False): ## Get True / False
	if   (r.lower()=='true' ): return True
	elif (r.lower()=='false'): return False
	else: return d
##### Paths #####
### # ps('')
_addonPath	=xbmc.translatePath(_plugin.getAddonInfo('path'))
_artPath		=xbmc.translatePath(os.path.join(_addonPath,ps('_addon_path_art')))
_datapath 	=xbmc.translatePath(_addon.get_profile()); _artIcon		=_addon.get_icon(); _artFanart	=_addon.get_fanart()
##### /\ ##### Paths #####
##### Important Functions with some dependencies #####
def art(f,fe=ps('default_art_ext')): return xbmc.translatePath(os.path.join(_artPath,f+fe)) ### for Making path+filename+ext data for Art Images. ###
##### /\ ##### Important Functions with some dependencies #####
##### Settings #####
_setting={}; 
##Notes-> options from the settings.xml file.
_setting['enableMeta']	=	_enableMeta			=tfalse(addst("enableMeta"))
_setting['debug-enable']=	_debugging			=tfalse(addst("debug-enable")); _setting['debug-show']	=	_shoDebugging		=tfalse(addst("debug-show"))
_setting['label-empty-favorites']=tfalse(addst('label-empty-favorites'))
##Notes-> some custom settings.
#_setting['meta.movie.domain']=ps('meta.movie.domain'); _setting['meta.movie.search']=ps('meta.movie.search')
#_setting['meta.tv.domain']   =ps('meta.tv.domain');    _setting['meta.tv.search']   =ps('meta.tv.search')
#_setting['meta.tv.page']=ps('meta.tv.page'); _setting['meta.tv.fanart.url']=ps('meta.tv.fanart.url'); 
#_setting['meta.tv.fanart.url2']=ps('meta.tv.fanart.url2'); 
开发者ID:HIGHWAY99,项目名称:plugin.video.example,代码行数:33,代码来源:default.py

示例10: CraftsyPlugin

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [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):
#.........这里部分代码省略.........
开发者ID:cosminadrianpopescu,项目名称:plugin.video.craftsy,代码行数:103,代码来源:plugin.py

示例11: art

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
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', 
          'Talk-Show', 'Thriller', 'War', 'Western', 'Zombies']

prepare_zip = False
metaget=metahandlers.MetaData(preparezip=prepare_zip)

if not os.path.isdir(addon.get_profile()):
     os.makedirs(addon.get_profile())

def art(file):
	img = os.path.join(THEME_PATH, file)
	return img

def unicode_urlencode(value): 
	if isinstance(value, unicode): 
		return urllib.quote(value.encode("utf-8"))
	else: 
		return urllib.quote(value)

def initDatabase():
	print "Building 1channel Database"
	if not os.path.isdir( os.path.dirname( DB ) ):
开发者ID:Rogerthis,项目名称:1Channel,代码行数:33,代码来源:default.py

示例12: xbmcpath

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import get_profile [as 别名]
def xbmcpath(path,filename):
     translatedpath = os.path.join(xbmc.translatePath( path ), ''+filename+'')
     return translatedpath

#paths etc need sorting out.

putlockertvdatapath = 'special://profile/addon_data/plugin.video.putlockertv'
metapath = putlockertvdatapath+'/mirror_page_meta_cache'
downinfopath = putlockertvdatapath+'/downloadinfologs'
transdowninfopath = xbmcpath(downinfopath,'')
transmetapath = xbmcpath(metapath,'')
translatedputlockertvdatapath = xbmcpath(putlockertvdatapath,'')
art = putlockertvpath+'/resources/art'

datapath = _PLT.get_profile()
cookie_path = os.path.join(datapath)
cookiejar = os.path.join(cookie_path,'losmovies.lwp')
net = Net()

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

def cleanUnicode(string):
    try:
        string = string.replace("'","").replace(unicode(u'\u201c'), '"').replace(unicode(u'\u201d'), '"').replace(unicode(u'\u2019'),'').replace(unicode(u'\u2026'),'...').replace(unicode(u'\u2018'),'').replace(unicode(u'\u2013'),'-')
        return string
    except:
        return string
开发者ID:virajkanwade,项目名称:Bunkford,代码行数:32,代码来源:default.py


注:本文中的t0mm0.common.addon.Addon.get_profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。