コード例 #1
0
def upload_LogFile(name):
	from resources.lib.modules.control import notification
	url = 'https://paste.kodi.tv/'
	log_file = joinPath(LOGPATH, '%s.log' % name.lower())
	if not existsPath(log_file):
		return notification(message='Log File not found, likely logging is not enabled.')
	try:
		import requests
		from resources.lib.modules.control import addonVersion, selectDialog, getHighlightColor
		f = open(log_file, 'r', encoding='utf-8', errors='ignore')
		text = f.read()
		f.close()
		UserAgent = 'Venom %s' % addonVersion('plugin.video.venom')
		response = requests.post(url + 'documents', data=text.encode('utf-8', errors='ignore'), headers={'User-Agent': UserAgent})
		if 'key' in response.json():
			result = url + response.json()['key']
			log('%s log file uploaded to: %s' % (name, result))
			from sys import platform as sys_platform
			supported_platform = any(value in sys_platform for value in ('win32', 'linux2'))
			highlight_color = getHighlightColor()
			list = [('[COLOR %s]url:[/COLOR]  %s' % (highlight_color, str(result)), str(result))]
			if supported_platform: list += [('[COLOR %s]  -- Copy url To Clipboard[/COLOR]' % highlight_color, ' ')]
			select = selectDialog([i[0] for i in list], lang(32196) if name.lower() == 'venom' else lang(32199))
			if 'Copy url To Clipboard' in list[select][0]:
				from resources.lib.modules.source_utils import copy2clip
				copy2clip(list[select - 1][1])
		elif 'message' in response.json():
			notification(message='%s Log upload failed: %s' % (name, str(response.json()['message'])))
			log('%s Log upload failed: %s' % (name, str(response.json()['message'])), level=LOGERROR)
		else:
			notification(message='%s Log upload failed' % name)
			log('%s Log upload failed: %s' % (name, response.text), level=LOGERROR)
	except:
		error('%s log upload failed' % name)
		notification(message='pastebin post failed: See log for more info')
コード例 #2
0
def scrobbleUpdate(action,
                   type,
                   imdb=None,
                   tvdb=None,
                   season=None,
                   episode=None,
                   progress=0):
    try:
        if action:
            type = _scrobbleType(type)
            if imdb is not None:
                imdb = str(imdb)
            if tvdb is not None:
                tvdb = int(tvdb)
            if season is not None:
                season = int(season)
            if episode is not None:
                episode = int(episode)
            if imdb:
                link = '/search/imdb/' + str(imdb)
            elif tvdb:
                link = '/search/tvdb/' + str(tvdb)
            if type == 'episode':
                link += '?type=show'
            else:
                link += '?type=movie'
            items = cache.get(getTraktAsJson, 760, link)
            if len(items) > 0:
                item = items[0]
                if type == 'episode':
                    slug = item['show']['ids']['slug']
                    link = '/shows/%s/seasons/%d/episodes/%d' % (slug, season,
                                                                 episode)
                    item = cache.get(getTraktAsJson, 760, link)
                else:
                    item = item['movie']
                if item:
                    link = '/scrobble/' + action
                    data = {
                        type:
                        item,
                        'progress':
                        progress,
                        'app_version':
                        control.addonVersion(addon='plugin.video.venom'),
                    }
                    result = getTrakt(url=link, post=data)
                    return 'progress' in result
    except:
        log_utils.error()
        pass
    return False
コード例 #3
0
def get(name):
    nameDict = {
        'DG': 'plugin.video.dg',
        'MyAccounts': 'script.module.myaccounts',
        'FenomScrapers': 'script.module.fenomscrapers'
    }
    addon_path = addonPath(nameDict[name])
    addon_version = addonVersion(nameDict[name])
    changelog_file = joinPath(addon_path, 'changelog.txt')
    if not existsPath(changelog_file):
        from resources.lib.modules.control import notification
        return notification(message='ChangeLog File not found.')
    f = open(changelog_file, 'r', encoding='utf-8', errors='ignore')
    text = f.read()
    f.close()
    heading = '[B]%s -  v%s - ChangeLog[/B]' % (name, addon_version)
    windows = TextViewerXML('textviewer.xml',
                            addonPath('plugin.video.dg'),
                            heading=heading,
                            text=text)
    windows.run()
    del windows
コード例 #4
0
# -*- coding: utf-8 -*-
"""
	Venom Add-on
"""

from resources.lib.modules import control

venom_path = control.addonPath(control.addonId())
venom_version = control.addonVersion(control.addonId())
changelogfile = control.joinPath(venom_path, 'changelog.txt')


def get():
    r = open(changelogfile)
    text = r.read()
    r.close()
    control.dialog.textviewer(
        '[COLOR red]Venom[/COLOR] -  v%s - %s' %
        (venom_version, 'changelog.txt'), text)
コード例 #5
0
# -*- coding: utf-8 -*-
"""
	Kraken Add-on
"""

from resources.lib.modules import control

kraken_path = control.addonPath(control.addonId())
kraken_version = control.addonVersion(control.addonId())


def get(file):
    helpFile = control.joinPath(kraken_path, 'resources', 'help',
                                file + '.txt')
    r = open(helpFile)
    text = r.read()
    r.close()
    control.dialog.textviewer(
        '[COLOR red]Kraken[/COLOR] -  v%s - %s' % (kraken_version, file), text)