本文整理汇总了Python中addon.common.addon.Addon.log方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.log方法的具体用法?Python Addon.log怎么用?Python Addon.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon.common.addon.Addon
的用法示例。
在下文中一共展示了Addon.log方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Addon
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
_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')
except:
try:
from sqlite3 import dbapi2 as orm
_1CH.log('Loading sqlite3 as DB engine')
except:
from pysqlite2 import dbapi2 as orm
_1CH.log('pysqlite2 as DB engine')
DB = 'sqlite'
__translated__ = xbmc.translatePath("special://database")
示例2: _convert_date
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
Returns:
DICT of meta data found on TMDB
Returns None when not found or error requesting page
'''
url = "%s/%s?language=%s&api_key=%s&%s" % (self.url_prefix, method, self.lang, self.api_key, values)
addon.log('Requesting TMDB : %s' % url, 0)
try:
meta = simplejson.loads(net.http_GET(url,{"Accept":"application/json"}).content)
except Exception, e:
addon.log("Error connecting to TMDB: %s " % e, 4)
return None
if meta == 'Nothing found.':
return None
else:
addon.log('TMDB Meta: %s' % meta, 0)
return meta
def _convert_date(self, string, in_format, out_format):
''' Helper method to convert a string date to a given format '''
strptime = lambda date_string, format: datetime(*(time.strptime(date_string, format)[0:6]))
try:
a = strptime(string, in_format).strftime(out_format)
except Exception, e:
addon.log('************* Error Date conversion failed: %s' % e, 4)
return None
return a
def _upd_key(self, meta, key):
示例3: Addon
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
from addon.common.net import Net
except:
xbmc.log('Failed to import script.module.addon.common, attempting t0mm0.common')
xbmcgui.Dialog().ok("Import Failure", "Failed to import addon.common", "A component needed by this addon is missing on your system", "Please visit www.xbmc.org for support")
addon = Addon('plugin.video.redlettermedia', sys.argv)
net = Net()
##### Queries ##########
play = addon.queries.get('play', None)
mode = addon.queries['mode']
url = addon.queries.get('url', None)
page_num = addon.queries.get('page_num', None)
addon.log('-----------------RedLetterMedia Addon Params------------------')
addon.log('--- Version: ' + str(addon.get_version()))
addon.log('--- Mode: ' + str(mode))
addon.log('--- Play: ' + str(play))
addon.log('--- URL: ' + str(url))
addon.log('--- Page: ' + str(page_num))
addon.log('---------------------------------------------------------------')
################### Global Constants #################################
MainUrl = 'http://redlettermedia.com/'
APIPath = 'http://blip.tv/players/episode/%s?skin=api'
AddonPath = addon.get_path()
IconPath = AddonPath + "/icons/"
示例4: str
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
datapath = addon.get_profile()
##### Paths ##########
cookie_path = os.path.join(datapath, 'cookies')
cookie_jar = os.path.join(cookie_path, "cookiejar.lwp")
if os.path.exists(cookie_path) == False:
os.makedirs(cookie_path)
##### Queries ##########
play = addon.queries.get('play', None)
mode = addon.queries['mode']
page_num = addon.queries.get('page_num', None)
url = addon.queries.get('url', None)
addon.log('----------------------TGUN Addon Params------------------------')
addon.log('--- Version: ' + str(addon.get_version()))
addon.log('--- Mode: ' + str(mode))
addon.log('--- Play: ' + str(play))
addon.log('--- URL: ' + str(url))
addon.log('--- Page: ' + str(page_num))
addon.log('---------------------------------------------------------------')
################### Global Constants #################################
main_url = 'http://www.tgun.tv/'
shows_url = main_url + 'shows/'
#showlist_url = 'http://www.tgun.tv/menus2/shows/chmenu%s.php'
showlist_url = 'http://www.tgun.tv/menus/shows/chmenu.php'
num_showpages = 4
classic_url = main_url + 'classic/'
示例5: Addon
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
addon = Addon(addon_id, sys.argv)
Addon = xbmcaddon.Addon(addon_id)
netError = os.path.join(addon.get_path(), 'resources', 'skins', 'Default', 'media', 'network_error.png')
sys.path.append(os.path.join(addon.get_path(), 'resources', 'lib'))
data_path = addon.get_profile()
cookie_file = os.path.join(data_path, 'bu.cookie')
name = addon.queries.get('name', '')
url = addon.queries.get('url', '')
alt = addon.queries.get('alt', '')
mode = addon.queries['mode']
img = addon.queries.get('img', '')
addon.log('Version %s'%addon.get_version())
import utils
def MAIN():
Menu()
def Menu():
html = GetUrl(base_url)
match = 'description\=\*ANNOUNCEMENT\*\s+(\d+\/\d+\/\d+)\.(.*?)\/des'
announce = re.search(r''+match+'', html, re.I|re.DOTALL)
fanart = ''
try:
示例6: Notify
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
urlresolver.display_settings()
elif mode=='meta_settings':
print "Metahandler Settings"
import metahandler
metahandler.display_settings()
elif mode=='delete_favs':
dialog = xbmcgui.Dialog()
ret = dialog.yesno('Delete Favourites', 'Do you wish to delete %s PFTV Favourites?' % video_type.upper(), '','This cannot be undone!')
if ret == True:
addon.log("Deleting favourites: %s" % video_type)
if video_type == 'all':
cache.delete('favourites_%s' % VideoType_Movies)
cache.delete('favourites_%s' % VideoType_TV)
cache.delete('favourites_%s' % VideoType_Season)
cache.delete('favourites_%s' % VideoType_Episode)
else:
cache.delete('favourites_%s' % video_type)
Notify('small', 'PFTV Favourites', 'PFTV %s Favourites Deleted' % video_type.title())
elif mode=='delete_search_history':
dialog = xbmcgui.Dialog()
ret = dialog.yesno('Delete Search History', 'Do you wish to delete PFTV Search History', '','This cannot be undone!')
if ret == True:
示例7: open
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
if xbmcvfs.exists(xbmc.translatePath('special://home/userdata/sources.xml')):
with open(xbmc.translatePath('special://home/userdata/sources.xml'), 'r+') as f:
my_file = f.read()
if re.search(r'http://muckys.mediaportal4kodi.ml', my_file):
addon.log('Muckys Source Found in sources.xml, Not Deleting.')
else:
line1 = "you have Installed The MDrepo From An"
line2 = "Unofficial Source And Will Now Delete Please"
line3 = "Install From [COLOR red]http://muckys.mediaportal4kodi.ml[/COLOR]"
line4 = "Removed Repo And Addon"
line5 = "successfully"
xbmcgui.Dialog().ok(addon_name, line1, line2, line3)
delete_addon = xbmc.translatePath('special://home/addons/'+addon_id)
delete_repo = xbmc.translatePath('special://home/addons/repository.mdrepo')
shutil.rmtree(delete_addon, ignore_errors=True)
shutil.rmtree(delete_repo, ignore_errors=True)
dialog = xbmcgui.Dialog()
addon.log('===DELETING===ADDON+===REPO===')
xbmcgui.Dialog().ok(addon_name, line4, line5)
示例8: str
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
mode = addon.queries['mode']
url = addon.queries.get('url', None)
section = addon.queries.get('section', None)
img = addon.queries.get('img', None)
genre = addon.queries.get('genre', None)
year = addon.queries.get('year', None)
letter = addon.queries.get('letter', None)
page = addon.queries.get('page', None)
episodes = addon.queries.get('episodes', None)
listitem = addon.queries.get('listitem', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
play = ''
addon.log('---------------------------------------------------------------')
addon.log('--- Addon Version: ' + addon.get_version())
addon.log('--- Mode: ' + str(mode))
addon.log('--- URL: ' + str(url))
addon.log('--- Genre: ' + str(genre))
addon.log('--- Section: ' + str(section))
addon.log('--- Letter: ' + str(letter))
addon.log('--- Year: ' + str(year))
#addon.log('--- IMDB: ' + str(imdb_id))
#addon.log('--- Season: ' + str(season))
#addon.log('--- Episode: ' + str(episode))
addon.log('---------------------------------------------------------------')
def get_html(page_url):
示例9: Notify
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
filename = '%s.strm' % name
final_path = os.path.join(save_path, name, filename)
final_path = xbmc.makeLegalFilename(final_path)
if not xbmcvfs.exists(os.path.dirname(final_path)):
try:
xbmcvfs.mkdirs(os.path.dirname(final_path))
except Exception, e:
addon.log('Failed to create directory %s' % final_path)
try:
file_desc = xbmcvfs.File(final_path, 'w')
file_desc.write(strm_string)
file_desc.close()
Notify('small',name, 'Added to Library' ,8000)
except Exception, e:
Notify('small',name, 'ERROR adding to Library' ,8000)
addon.log('Failed to create .strm file: %s\n%s' % (final_path, e))
#Play from the Library STRM file *no directories
def LIBRARYPLAY(name,url):
EnableMeta = local.getSetting('Enable-Meta')
iconimage = ''
name2 = name
if EnableMeta == 'true':
infoLabels = GRABMETA(name2,'')
try: img = infoLabels['cover_url']
except: img = iconimage
match=re.compile('<li class="link_name">\n (.+?) </li>\n <li class="playing_button"><span><a href="(.+?)"').findall(net.http_GET(url).content)
List=[]; ListU=[]; c=0
for name,url in match:
url = 'http://www.movie25.so'+url+'@'+name2
c=c+1; List.append(str(c)+'.) '+name); ListU.append(url)
示例10: filename_from_title
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
elif video_type == 'movie':
save_path = IW_addon.get_setting('movie-folder')
save_path = xbmc.translatePath(save_path)
strm_string = IW_addon.build_plugin_url(
{'mode': 'DocSubMenu','dialog': '1', 'movie_num': movie_num})
if year: title = '%s (%s)' % (title, year)
filename = filename_from_title(title, 'movie')
title = re.sub(r'[^\w\-_\. ]', '_', title)
final_path = os.path.join(save_path, title, filename)
final_path = xbmc.makeLegalFilename(final_path)
if not xbmcvfs.exists(os.path.dirname(final_path)):
try:
try: xbmcvfs.mkdirs(os.path.dirname(final_path))
except: os.path.mkdir(os.path.dirname(final_path))
except Exception, e:
try: IW_addon.log('Failed to create directory %s' % final_path)
except: pass
try:
file_desc = xbmcvfs.File(final_path, 'w')
file_desc.write(strm_string)
file_desc.close()
except Exception, e:
IW_addon.log('Failed to create .strm file: %s\n%s' % (final_path, e))
### ############################################################################################################
### ############################################################################################################
##### Queries #####
_param={}
##Notes-> add more here for whatever params you want to use then you can just put the tagname within _param[''] to fetch it later. or you can use addpr('tagname','defaultvalue').
_param['mode']=addpr('mode',''); _param['url']=addpr('url',''); _param['pagesource'],_param['pageurl'],_param['pageno'],_param['pagecount']=addpr('pagesource',''),addpr('pageurl',''),addpr('pageno',0),addpr('pagecount',1)
示例11: Notify
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import log [as 别名]
elif mode == 'resolver_settings':
import urlresolver
urlresolver.display_settings()
elif mode=='meta_settings':
print "Metahandler Settings"
import metahandler
metahandler.display_settings()
elif mode=='delete_favs':
dialog = xbmcgui.Dialog()
ret = dialog.yesno('Delete Favourites', 'Do you wish to delete %s PFTV Favourites?' % video_type.upper(), '','This cannot be undone!')
if ret == True:
addon.log("Deleting favourites: %s" % video_type)
if video_type == 'all':
cache.delete('favourites_%s' % VideoType_Movies)
cache.delete('favourites_%s' % VideoType_TV)
cache.delete('favourites_%s' % VideoType_Season)
cache.delete('favourites_%s' % VideoType_Episode)
else:
cache.delete('favourites_%s' % video_type)
Notify('small', 'PFTV Favourites', 'PFTV %s Favourites Deleted' % video_type.title())
if not play:
addon.end_of_directory()