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


Python addon.Addon类代码示例

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


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

示例1: add_my_fav_directory

 def add_my_fav_directory(self, title='Favorites', img='', fanart='', item_mode='main'):
     if not self.sys_argv:
         common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in Favorites __init__(); Favorites directory will not be created.')
         return
         
     try:
         tmp_addon_id = 'plugin.video.favorites'
         tmp_addon = Addon(tmp_addon_id)
         tmp_addon_name = tmp_addon.get_name()                
     except:
         common.addon.log_error('-' + HELPER + '- -' +'Favorites video plugin not installed; Favorites directory will not be created.')
         common.notify(self.addon_id, 'small', ' - My Favorites video addon required', 'Please install My Favorites video addon from The ONE\'s XBMC Addons Repository.', '10000')                
         return
         
     
     listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
     listitem.setProperty('fanart_image', fanart)
     uni_fav = {
         'uni_fav_addon_id': self.addon_id,
         'uni_fav_mode': 'display',
         'uni_fav_item_mode': item_mode
         }
     
     params = self._build_params( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true', 'item_mode':item_mode} )
     xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.favorites/'+params,isFolder=True,listitem=listitem)
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:25,代码来源:favorites.py

示例2: RMOVIEMETA

def RMOVIEMETA(meta_name):
    imdb_id = Addon.queries.get('imdb_id', '')
    r = re.split(r'480p|720p|xvid',meta_name,0,)
    name = re.findall(r'(.+?)\s[\d]{4}',r[0],flags=re.I)
    year = re.findall(r'([\d{4}])',r[0])
    print str(name)
    if len(name) >=1:
        name = name[0]
    name =''.join(name)
    year =''.join(year)
    metaget=metahandlers.MetaData()
    try:
        search_meta = metaget.search_movies(name)
    except:
        xbmc.executebuiltin("XBMC.Notification([COLOR red]Notice[/COLOR],Could not find correct MetaData,10000,os.path.join(art,'TVRnotify.png')")

        return

    if search_meta:
        movie_list = []
        for movie in search_meta:
            movie_list.append(movie['title'] + ' (' + str(movie['year']) + ')')
        dialog = xbmcgui.Dialog()
        index = dialog.select('Choose', movie_list)

        if index > -1:
            new_imdb_id = search_meta[index]['imdb_id']
            new_tmdb_id = search_meta[index]['tmdb_id']       
            meta = metaget.update_meta('movie', name, imdb_id=imdb_id, new_imdb_id=new_imdb_id, new_tmdb_id=new_tmdb_id, year=year)   
            xbmc.executebuiltin("Container.Refresh")
    else:
        msg = ['No matches found']
        Addon.show_ok_dialog(msg, 'Refresh Results')
开发者ID:Ultraporing,项目名称:jas0npc,代码行数:33,代码来源:default.py

示例3: get_addons_that_have_favorites

 def get_addons_that_have_favorites(self):
 
     addons = []
 
     sql_select = "SELECT DISTINCT addon_id FROM favorites ORDER BY addon_id"
 
     self.dbcur.execute(sql_select)
 
     for matchedrow in self.dbcur.fetchall():
     
         match = dict(matchedrow)
         
         try:
             tmp_addon_id = match['addon_id']
             tmp_addon = Addon(tmp_addon_id)
             tmp_addon_name = tmp_addon.get_name()
             tmp_addon_img = tmp_addon.get_icon()                
             tmp_addon_fanart = tmp_addon.get_fanart() 
         except:
             tmp_addon_name = tmp_addon_id
             tmp_addon_img = ''          
             tmp_addon_fanart = ''
             pass
         
         tmp_addon_dtl = {'title' : tmp_addon_name, 'id' : tmp_addon_id, 'img':tmp_addon_img, 'fanart':tmp_addon_fanart}
         
         addons.append(tmp_addon_dtl)
         
     return addons
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:29,代码来源:favorites.py

示例4: __init__

	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,代码行数:29,代码来源:service.py

示例5: art

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
开发者ID:rollysalvana,项目名称:pampereo-xbmc-plugins,代码行数:7,代码来源:1Channel_index.py

示例6: art

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
开发者ID:stowevter,项目名称:1Channel,代码行数:7,代码来源:1Channel_index.py

示例7: proxpesquisa

def proxpesquisa():
    from t0mm0.common.addon import Addon
    addon=Addon(addon_id)
    form_d=addon.load_data('temp.txt')
    ref_data = {'Accept':'*/*','Content-Type':'application/x-www-form-urlencoded','Host':'abelhas.pt','Origin':'http://abelhas.pt','Referer':url,'User-Agent':user_agent,'X-Requested-With':'XMLHttpRequest'}
    form_d['Page']= form_d['Page'] + 1
    endlogin=MainURL + 'action/SearchFiles/Results'
    net.set_cookies(cookies)
    conteudo= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore')
    addon.save_data('temp.txt',form_d)
    pastas(MainURL + 'action/nada','coco',conteudo=conteudo)
开发者ID:Thewallguy,项目名称:fightnight-addons,代码行数:11,代码来源:default.py

示例8: PLAY

def PLAY(url,types,linkback,meta_name):
    infoLabels = GRABMETA(meta_name, types)
    stream_url = urlresolver.HostedMediaFile(url).resolve()
    if stream_url == False:
        Addon.log('Error while trying to resolve %s' % url)
        return VIDEOLINKS(linkback,types,'',meta_name,meta_name)
    meta_name = '[COLOR yellow]'+str(meta_name).replace('SEASON:',' ').replace('EPISODE:','x')+'[/COLOR]'
    liz=xbmcgui.ListItem(meta_name, iconImage= '', thumbnailImage=infoLabels['cover_url'])
    liz.setInfo( type="Video", infoLabels={ "Title": meta_name} )
    liz.setProperty("IsPlayable","true")
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream_url,isFolder=False,listitem=liz)#; Addon.resolve_url(stream_url)
    meta_name = str(meta_name).replace('[/COLOR]','').replace('[COLOR yellow]','')
    print meta_name
    xbmc.Player().play(stream_url,liz)
开发者ID:Ultraporing,项目名称:jas0npc,代码行数:14,代码来源:default.py

示例9: notify

def notify(addon_id, typeq, title, message, times, line2='', line3=''):
    addon_tmp = Addon(addon_id)
    if title == '' :
        title='[B]' + addon_tmp.get_name() + '[/B]'
    if typeq == 'small':
        if times == '':
           times='5000'
        smallicon= addon_tmp.get_icon()
        xbmc.executebuiltin("XBMC.Notification("+title+","+message+","+times+","+smallicon+")")
    elif typeq == 'big':
        dialog = xbmcgui.Dialog()
        dialog.ok(' '+title+' ', ' '+message+' ', line2, line3)
    else:
        dialog = xbmcgui.Dialog()
        dialog.ok(' '+title+' ', ' '+message+' ')    
开发者ID:ashikzk,项目名称:mvl-one-frodo,代码行数:15,代码来源:_common.py

示例10: __init__

 def __init__(self, addon_id, sys_argv=''):
     
     #Check if a path has been set in the addon settings
     if common.db_path:
         self.path = xbmc.translatePath(common.db_path)
     else:
         self.path = xbmc.translatePath(common.default_path)
     
     self.addon_id = addon_id
     self.sys_argv = sys_argv
     self.cache_path = common.make_dir(self.path, '')
     self.addon = Addon(self.addon_id, self.sys_argv)
     
     self.db = os.path.join(self.cache_path, self.local_db_name)
     
     # connect to db at class init and use it globally
     if DB == 'mysql':
         class MySQLCursorDict(database.cursor.MySQLCursor):
             def _row_to_python(self, rowdata, desc=None):
                 row = super(MySQLCursorDict, self)._row_to_python(rowdata, desc)
                 if row:
                     return dict(zip(self.column_names, row))
                 return None
         self.dbcon = database.connect(common.db_name, common.db_user, common.db_pass, common.db_address, buffered=True, charset='utf8')
         self.dbcur = self.dbcon.cursor(cursor_class=MySQLCursorDict, buffered=True)
     else:
         self.dbcon = database.connect(self.db)
         self.dbcon.row_factory = database.Row # return results indexed by field names and not numbers so we can convert to dict
         self.dbcon.text_factory = str
         self.dbcur = self.dbcon.cursor()
             
     self._create_favorites_tables()
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:32,代码来源:favorites.py

示例11: Search

def Search():
    last_search = Addon.load_data('search')
    if not last_search: last_search = ''
    search_entered =''
    keyboard = xbmc.Keyboard(search_entered, '[B][I] SEARCH TV-REALEASE.NET TVShows[/B][/I]')
    last_search = last_search.replace('%20',' ')
    keyboard.setDefault(last_search)
    keyboard.doModal()
    if keyboard.isConfirmed():
        search_entered = keyboard.getText().replace(' ','%20')# sometimes you need to replace spaces with + or %20#
        Addon.save_data('search',search_entered)
    if search_entered == None or len(search_entered)<1:
        MAIN()
    else:
        url = base64.b64encode('http://www.tv-release.net/?s='+search_entered+'&cat=')
        Index(url, '')
开发者ID:philtimmes,项目名称:addons,代码行数:16,代码来源:default.py

示例12: SEARCH

def SEARCH(url):
    last_search = Addon.load_data('search')
    if not last_search: last_search = ''
    search_entered =''
    keyboard = xbmc.Keyboard(search_entered, '[B][I] SEARCH TV-REALEASE.NET TVShows[/B][/I]')
    last_search = last_search.replace('+',' ')
    keyboard.setDefault(last_search)
    keyboard.doModal()
    if keyboard.isConfirmed():
        search_entered = keyboard.getText().replace(' ','+')# sometimes you need to replace spaces with + or %20#
        Addon.save_data('search',search_entered)
    if search_entered == None or len(search_entered)<1:
        MAIN()
    else:
        url = 'http://tv-release.net/?s="%s"&cat='%(search_entered)
        types = None
        SEARCHRESULTS(url,types)
开发者ID:Ultraporing,项目名称:jas0npc,代码行数:17,代码来源:default.py

示例13: add_my_history_directory

 def add_my_history_directory(self, title='Watch History', img='', fanart=''):
     if not self.sys_argv:
         common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in WatchHistory __init__(); Watch History directory will not be created.')
         return
         
     try:
         tmp_addon_id = 'plugin.video.watchhistory'
         tmp_addon = Addon(tmp_addon_id)
         tmp_addon_name = tmp_addon.get_name()                
     except:
         common.addon.log_error('-' + HELPER + '- -' +'Watch History video plugin not installed; Watch History directory will not be created.')
         common.notify(self.addon_id, 'small', ' - Watch History video addon required', 'Please install Watch History video addon from The ONE\'s XBMC Addons Repository.', '10000')                            
         return
     
     listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
     listitem.setProperty('fanart_image', fanart)
     
     params = '?' + common.dict_to_paramstr( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true'} )
     xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.watchhistory/'+params,isFolder=True,listitem=listitem)
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:19,代码来源:watchhistory.py

示例14: resolve_mightyupload

def resolve_mightyupload(url,referer):
    from resources.libs import jsunpack
    from t0mm0.common.addon import Addon
    addon = Addon('plugin.video.movie25', sys.argv)
    try:
        from t0mm0.common.net import Net as net
        html = net().http_GET(url).content
        addon.log_error('Mash Up: Resolve MightyUpload - Requesting GET URL: '+url)
        r = re.findall(r'name="(.+?)" value="?(.+?)"', html, re.I|re.M)
        post_data = {}
        for name, value in r:
            post_data[name] = value
        post_data['referer'] = referer
        headers={'Referer':referer}
        html = net().http_POST(url, post_data).content
        r = re.findall(r'<a href=\"(.+?)(?=\">Download the file</a>)', html)
        return r[0]
    except Exception, e:
        print 'Mash Up: Resolve MightyUpload Error - '+str(e)
        addon.show_small_popup('[B][COLOR green]Mash Up: MightyUpload Resolver[/COLOR][/B]','Error, Check XBMC.log for Details',
                               5000, elogo)
        return
开发者ID:charlesjackson261,项目名称:yolo-boo,代码行数:22,代码来源:movieplaylist.py

示例15: CREATE_BOXSET

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,代码行数:23,代码来源:default.py


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