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


Python addon.Addon类代码示例

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


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

示例1: Transform

def Transform():
    if addon.get_setting('transform') == 'true':
        return
    if xbmcvfs.exists(xbmc.translatePath('special://masterprofile/sources.xml')):
        with open(xbmc.translatePath(os.path.join( addon.get_path(), 'resources', 'sourcesapp.xml'))) as f:
            sourcesapp = f.read()
            f.close()
        with open(xbmc.translatePath('special://masterprofile/sources.xml'), 'r+') as f:
            my_file = f.read()
            if re.search(r'http://transform.mega-tron.tv/', my_file):
                addon.log('Transform Source Found in sources.xml, Not adding.')
                return
            addon.log('Adding Transform source in sources.xml')
            my_file = re.split(r'</files>\n</sources>\n', my_file)
            my_file = my_file[0]+sourcesapp
            f.seek(0)
            f.truncate()
            f.write(my_file)
            f.close()
            Addon.setSetting(id='transform', value='true')
            

    else:
        xbmcvfs.copy(xbmc.translatePath(os.path.join( addon.get_path(), 'resources', 'sources.xml')),
                       xbmc.translatePath('special://masterprofile/sources.xml'))
        Addon.setSetting(id='transform', value='true')
开发者ID:jas0npc,项目名称:kodi,代码行数:26,代码来源:default.py

示例2: changes

def changes():
	installed = Addon.getSetting('version')
	if installed != addon_version:
		f = xbmcvfs.File(xbmcaddon.Addon().getAddonInfo('changelog'))
		text = f.read(); f.close()
		
		# xbmc.log(text)
		
		label = '%s - %s' % (xbmc.getLocalizedString(24054), xbmcaddon.Addon().getAddonInfo('name'))
		id = 10147
		xbmc.executebuiltin('ActivateWindow(%d)' % id)
		xbmc.sleep(500)
		
		win = xbmcgui.Window(id)
		retry = 50
		# win.getControl(5).setText(text)
		while (retry > 0):
			try:
				xbmc.sleep(10)
				win.getControl(1).setLabel(label)
				win.getControl(5).setText(text)
				retry = 0
			except:
				retry -= 1

		Addon.setSetting('version', addon_version)
开发者ID:gahan9,项目名称:Hotstar-Rain,代码行数:26,代码来源:default.py

示例3: Announce

def Announce(date,announce):
    date = re.sub(r'/','-', date)

    if addon.get_setting('seen_anounce') == 'true':
        seen_date = addon.get_setting('seen_date')
        if date > seen_date:
            pass
        else:
            return

    from pyxbmct.addonwindow import *
    Addon.setSetting('seen_anounce', value='true')
    
    window = AddonDialogWindow('Whitecream [COLOR red]*ANNOUNCEMENT*[/COLOR] %s'%date)
    window.setGeometry(850, 600, 12, 8)
    textBox = TextBox(textColor='0xFFFFFFFF')
    window.placeControl(textBox, 0, 0, columnspan=7, rowspan=11)
    textBox.setText(announce)

    button = Button('Close')
    window.placeControl(button, 11, 3, columnspan=2)
    window.setFocus(button)
    window.connect(button, window.close)
    window.connect(ACTION_NAV_BACK, window.close)
    window.doModal()

    Addon.setSetting(id='seen_date', value=date)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:27,代码来源:utils.py

示例4: get_free_movies

def get_free_movies():
	html2 = make_request(url)
	html = json.loads(html2)
	content_id=''
	for r in html['contents']:
		if '1' in r['content_type_id']:
			content_id = r['content_id']
			name = r['title']
	if content_id:
		userurl = 'https://erosnow.com/secured/dologin'
		req = make_request_post(userurl)
		movieurl2 = 'http://erosnow.com/profiles/'+str(content_id)+'?platform=2&q=auto'
		html3 = make_request(movieurl2)
		html4 = json.loads(html3)
		req2 = json.loads(req)
		item2 = xbmcgui.ListItem(name)
		if (str(req2['success']['plan']) == 'False'):
			movie_link = html4['profiles']['ADAPTIVE_SD'][0]
		else:
			movie_link = html4['profiles']['ADAPTIVE_ALL'][0]
			subYes = Addon.getSetting('subType')
			if (subYes=='true') and (html4.get('subtitles')):
				closedcaption=[]
				closedcaption.append(html4['subtitles']['eng']['url'])
				subpath = convert_subtitles(closedcaption)
				item2.setSubtitles([subpath])
		
		item2.setProperty('IsPlayable', 'true')
		item2.setPath(movie_link['url'])
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item2)
	else:
		dialog.notification('Error', 'Movie may not be released yet.', xbmcgui.NOTIFICATION_INFO, 6000)
开发者ID:YoColdRain,项目名称:ErosNow-Rain,代码行数:32,代码来源:default.py

示例5: convert_subtitles

def convert_subtitles(closedcaption):
	# from pycaption import detect_format, SRTWriter
	# idea taken from LearningIt(t1m)
	str_output =''
	if closedcaption[0] is not None:
		try:
			cc_content = smart_unicode(make_request(closedcaption[0]))
			# reader = detect_format(cc_content)
			if cc_content != "":
				profile = Addon.getAddonInfo('profile').decode("utf-8")
				prodir  = xbmc.translatePath(os.path.join(profile))
				if not os.path.isdir(prodir):
					os.makedirs(prodir)
				subfile = xbmc.translatePath(os.path.join(profile, 'subtitles.srt'))	
				file = open(subfile, 'w+')
				str_output = re.sub('\d+(\b,\b)\d+','.',cc_content)
				str_output = str_output.replace('WEBVTT','')
				file.write(str_output)
				str_output=''
				file.close()
			else:
				print "unknown sub type"
		except:
			print "Exception with Subs: "
			subfile = ''
	return subfile
开发者ID:YoColdRain,项目名称:ErosNow-Rain,代码行数:26,代码来源:default.py

示例6: make_request_post

def make_request_post():
	url = 'https://account.hotstar.com/AVS/besc?action=Login&appVersion=5.0.30'
	username = Addon.getSetting('username')
	password = Addon.getSetting('password')
	headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36', 'Referer':'http://www.hotstar.com', 'Origin':'http://www.hotstar.com', 'Content-Type':'application/x-www-form-urlencoded'}
	body = {'username':username, 'password':password, 'channel':'TABLET'}
	body = urllib.urlencode(body)
	try:
		response = s.post(url, headers=headers, data=body, verify=False)
		# cookieString = ''
		# c = response.cookies
		# i = c.items()
		# for name2, value in i:
			# cookieString+= name2 + "=" + value + ";"
		# Addon.setSetting('cookieString', i)
		# time.sleep(1)
		return "done"
	except urllib2.URLError, e:
		print
开发者ID:gahan9,项目名称:Hotstar-Rain,代码行数:19,代码来源:default.py

示例7: RealDebrid

def RealDebrid():
    rdv = addon.get_setting('realdebrid-video')
    addon.log('RealDebrid Video setting: %s'% rdv)
    
    if addon.get_setting('realdebrid-video') == 'true':
        return
    resolverSettings = xbmc.translatePath('special://masterprofile/addon_data/script.module.urlresolver/settings.xml')
    with open(resolverSettings, 'r') as f:
        my_file = f.read()
        f.close()
        r = re.search(r'RealDebridResolver_login\"\svalue\=\"false\"', my_file, re.I)
        
        if r:
            xbmcgui.Dialog().ok("TvRelease Realdebrid Info Video", "@veedubt25 Has made a video on HOW realdebrid works",
                                "You will ONLY see this ONCE")
            xbmc.executebuiltin("PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=s-C4DdG4FF0&quality=720p)")
            Addon.setSetting(id='realdebrid-video', value='true')
        else:
            return
开发者ID:jas0npc,项目名称:kodi,代码行数:19,代码来源:plugin.py

示例8: make_request_post

def make_request_post(url):
	username = (Addon.getSetting('username'))
	password = (Addon.getSetting('password'))
	# ipaddressUK="31.7."
	# for x in xrange(1,2):
		# ipaddressUK += ".".join(map(str,(random.randint(0,255) for _ in range(2))))
	
	if (username != '' and password != ''):
		body = {'el':username, 'pw':password, 'mobile':'', 'callingcode':'', 'type':'json', 'fbid':''}
		body = urllib.urlencode(body)
		try:
			s.headers['Referer']='http://erosnow.com'
			# s.headers['X-Forwarded-For']=ipaddressUK
			s.headers['Content-Type']= 'application/x-www-form-urlencoded; charset=UTF-8'
			response = s.post(url, headers=headers, data=body, cookies=s.cookies, verify=False)
			data = response.text
			return data
		except urllib2.URLError, e:
			print
开发者ID:YoColdRain,项目名称:ErosNow-Rain,代码行数:19,代码来源:default.py

示例9: dir

#from common import functions

## XBMC workaround
import _json
if not 'load' in dir(_json):
    import simplejson as _json
    
    
from library import utils


#### Constants & initialization
buggalo.SUBMIT_URL = 'http://buggalo.tvaddons.ag/submit.php'                    # Official XBMC error report generator
ADDON_NAME = 'plugin.video.XBMCKaraoke'                                         # Addon namespace
__addon__ = xbmcaddon.Addon(ADDON_NAME)                                         # Initializing addon properties
__t0mm0addon__ = Addon(ADDON_NAME, sys.argv)                                    # Initializing addon properties
__language__ = __addon__.getLocalizedString


__addonname__   = __addon__.getAddonInfo('name')                                # Humanly readable addon name
PATH = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')       # Path where the addon resides (needs absolute paths)
TEMP_DL_DIR =  'tempdl'                                                         # Temp download directory. No write permissions in special://temp so using folder inside the addon
jsonurl = 'http://api.xbmckaraoke.com/'                                         # PHP JSON website (database)
url = None                                                                      # Standard value
donotloaddir = 0                                                                # Standard value

THEME = __t0mm0addon__.get_setting('theme')                                     # Theme settings
THEME_PATH = os.path.join(PATH, 'art', 'themes', THEME)                         # Theme dir


开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:28,代码来源:Default.py

示例10: Addon

from __future__ import unicode_literals
from addon.common.addon import Addon
import sys,os
import urlparse,urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control
from resources.lib.modules.log_utils import log

addon = Addon('plugin.video.castaway', sys.argv)
addon_handle = int(sys.argv[1])

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath , "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")
def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)

args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)


if mode is None:
    addon.add_item({'mode': 'live_sport'}, {'title':'Live Sport'}, img=icon_path('live_sport.jpg'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'live_tv'}, {'title':'Live TV'}, img=icon_path('live_tv.jpg'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'p2p_corner'}, {'title':'P2P Corner'}, img=icon_path('p2p_corner.jpg'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'on_demand_sport_categories'}, {'title':'Sport On Demand'}, img=icon_path('sport_on_demand.jpg'), fanart=fanart,is_folder=True)
    #addon.add_item({'mode': 'blogs'}, {'title':'Blogs'}, img=icon_path('blogs.jpg'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'tools'}, {'title':'Tools'}, img=icon_path('tools.jpg'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'my_castaway'}, {'title':'My Castaway'}, img=icon_path('my_castaway.jpg'), fanart=fanart,is_folder=True)
开发者ID:,项目名称:,代码行数:31,代码来源:

示例11: Net

import xbmc,xbmcgui
import os
import urllib, urllib2
import cookielib
import re
import jsunpack

''' Use addon.common library for http calls '''
from addon.common.net import Net
from addon.common.addon import Addon
net = Net()

addon = Addon('plugin.video.icefilms')
datapath = addon.get_profile()

cookie_path = os.path.join(datapath, 'cookies')

USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36'
ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'

def handle_captchas(url, html, data, dialog):

    headers = {'Referer': url}

    puzzle_img = os.path.join(datapath, "solve_puzzle.png")
    
    #Check for type of captcha used
    solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html)
    recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html)
    numeric_captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html)    
开发者ID:tommy1976,项目名称:icefilms-addon,代码行数:30,代码来源:resolvers.py

示例12: Net

import os
import re
import sys
import xbmc,xbmcaddon,xbmcgui,xbmcplugin,xbmcgui

############# A massive thankyou to Jas0n_pc for sending me the code for this twitter window its brilliant#################

from addon.common.net import Net
from addon.common.addon import Addon

net = Net()

addon_id = 'plugin.video.mdsportsextra'
addon = Addon(addon_id, sys.argv)
Addon = xbmcaddon.Addon(addon_id)

sys.path.append(os.path.join(addon.get_path(), 'resources', 'lib'))
data_path = addon.get_profile()

newsurl = 'http://pastebin.com/raw.php?i=uX9XKZtj'

try:
  import StorageServer
except:
  import storageserverdummy as StorageServer
cache = StorageServer.StorageServer(addon_id)
               
def TWITTER(url):
    #test = net.http_GET(newsurl).content
    #r = re.search(r'<message>(.*?)</message>', test, re.I|re.DOTALL)
开发者ID:bialagary,项目名称:mw,代码行数:30,代码来源:utils.py

示例13:

# ===================================================================
# --- #
# ===================================================================
import os,sys,re,socket
import xbmcplugin,xbmcaddon,xbmc
try: 			from addon.common.addon 				import Addon
except:
	try: 		from t0mm0.common.addon 				import Addon
	except: 
		try: from c_t0mm0_common_addon 				import Addon
		except: pass
addon_id="service.lan.ftp"
addon_name="FTP [B]HUB[/B][I] - FTP Server[/I]"
try: 		addon=Addon(addon_id,sys.argv); 
except: 
	try: addon=Addon(addon_id,addon.handle); 
	except: addon=Addon(addon_id,0); 
plugin=xbmcaddon.Addon(id=addon_id); 
print "%s @ %s" % (addon_name,addon_id)
addonPath=xbmc.translatePath(plugin.getAddonInfo('path'))
try:		datapath 		=xbmc.translatePath(addon.get_profile()); 
except: datapath 		=""
try: 		_artIcon		=addon.get_icon(); 
except: _artIcon		=""
try: 		_artFanart	=addon.get_fanart()
except: _artFanart	=""
#_artMessage=xbmc.translatePath(os.path.join(addonPath,"msg.png"))
_artPath		=xbmc.translatePath(os.path.join(addonPath,"art"))
# ===================================================================
# --- Common Functions
# ===================================================================
开发者ID:HIGHWAY99,项目名称:repository.thehighway.br,代码行数:31,代码来源:default.py

示例14: get_video_url

def get_video_url():
	videos = []
	params = []
	addon_log(url)
	quality = (Addon.getSetting('qualityType')).lower()
	html = make_request(url)
	data = html
	html = json.loads(data)
	manifest1 = html['resultObj']['src']
	addon_log('manifest1 is, '+manifest1)
	islive=False
	if '/videos/' not in manifest1:
		islive=True
		quality='let me choose'
	if 'manifest.f4m' in manifest1:
		manifest1 = manifest1.replace('http://','https://')
		manifest1 = manifest1.replace('/z/','/i/')
		manifest1 = manifest1.replace('manifest.f4m', 'master.m3u8')
	if (quality=='highest' and '1300,2000' in manifest1):
		manifest2 = manifest1.replace('1300,2000', '3000,4500')
		manifest_url = make_request(manifest2)
		# print manifest_url
		if 'EXTM3U' in manifest_url:
			matchlist2 = re.compile("x(\d+).+?(http.+?)\n", re.DOTALL).findall(str(manifest_url))
			manifest1 = None
			if matchlist2:
				for (size, video) in matchlist2:
					if size:
						size = int(size)
					else:
						size = 0
					videos.append( [size, video] )
		else:
			manifest1 = manifest2.replace('3000,4500', '1300,2000')

	if manifest1:
		manifest_url = make_request(manifest1)
		addon_log('quality is '+quality)
		addon_log(manifest_url)
		if (manifest_url):
			if (quality=='highest' or quality=='let me choose'):
				matchlist2 = re.compile("x(\d+).+?(http.+?)\n", re.DOTALL).findall(str(manifest_url))
			elif (quality == '720p'):
				matchlist2 = re.compile("x(720)[^\n]*\n([^\n]*)", re.DOTALL).findall(str(manifest_url))
			elif (quality == '404p'):
				matchlist2 = re.compile("x(404).+?(http.+?)\n", re.DOTALL).findall(str(manifest_url))
			else:
				matchlist2 = re.compile("x(360).+?(http.+?)\n", re.DOTALL).findall(str(manifest_url))
			if matchlist2:
				addon_log('inside matchlist2 to separate size,video')
				for (size, video) in matchlist2:
					addon_log(size+'======'+video)
					if size:
						size = int(size)
					else:
						size = 0
					videos.append( [size, video] )
		else:
			videos.append( [-2, match] )

	videos.sort(key=lambda L : L and L[0], reverse=True)
	
	cookieString = ""
	c = s.cookies
	i = c.items()
	for name2, value in i:
		cookieString+= name2 + "=" + value + ";"
	# print 'cookieString is', cookieString

	if (quality == 'let me choose'):
		for video in videos:
			addon_log(video[1])
			size = '(' + str(video[0]) + 'p) '
			if enableip=='true':
				if 'index_1364_av' in video[1]:
					old_size = size
					size = '(720p) '
					old_vid = video[1]
					new_vid = video[1].replace('index_1364_av', 'index_2064_av')
					addDir(0, size + name, new_vid+"|Cookie="+cookieString+"&X-Forwarded-For="+ipaddress, image, isplayable=True)
					addDir(0, old_size + name, old_vid+"|Cookie="+cookieString+"&X-Forwarded-For="+ipaddress, image, isplayable=True)
				else:
					addDir(0, size + name, video[1]+"|Cookie="+cookieString+"&X-Forwarded-For="+ipaddress, image, isplayable=True)
			else:
				if 'index_1364_av' in video[1]:
					old_size = size
					size = '[COLOR green][720p][/COLOR] '
					old_vid = video[1]
					new_vid = video[1].replace('index_1364_av', 'index_2064_av')
					addDir(0, size + name, new_vid+"|Cookie="+cookieString, image, isplayable=True)
					addDir(0, old_size + name, old_vid+"|Cookie="+cookieString, image, isplayable=True)
				else:
					addDir(0, size + name, video[1]+"|Cookie="+cookieString, image, isplayable=True)
	else:
		if videos:
			raw3_start = videos[0][1]
			if enableip=='true':
				high_video = raw3_start+"|Cookie="+cookieString+"&X-Forwarded-For="+ipaddress
			else:
				high_video = raw3_start+"|Cookie="+cookieString
#.........这里部分代码省略.........
开发者ID:gahan9,项目名称:Hotstar-Rain,代码行数:101,代码来源:default.py

示例15: Addon

import xbmcplugin
import xbmcaddon
import xbmcvfs
import log_utils
import sys
import hashlib
import urlparse
import shutil
import urllib
from constants import *
from scrapers import * # import all scrapers into this namespace
from addon.common.addon import Addon
from trakt_api import Trakt_API
from db_utils import DB_Connection

ADDON = Addon('plugin.video.salts')
ICON_PATH = os.path.join(ADDON.get_path(), 'icon.png')
SORT_FIELDS =  [(SORT_LIST[int(ADDON.get_setting('sort1_field'))], SORT_SIGNS[ADDON.get_setting('sort1_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort2_field'))], SORT_SIGNS[ADDON.get_setting('sort2_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort3_field'))], SORT_SIGNS[ADDON.get_setting('sort3_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort4_field'))], SORT_SIGNS[ADDON.get_setting('sort4_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort5_field'))], SORT_SIGNS[ADDON.get_setting('sort5_order')])]

username=ADDON.get_setting('username')
password=ADDON.get_setting('password')
use_https=ADDON.get_setting('use_https')=='true'
trakt_timeout=int(ADDON.get_setting('trakt_timeout'))

P_MODE = int(ADDON.get_setting('parallel_mode'))
if P_MODE == P_MODES.THREADS:
    import threading
开发者ID:SNAPflix,项目名称:salts,代码行数:31,代码来源:utils.py


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