示例#1
0
def browse_repository():
	from libs import github
	xml = github.browse_repository(kodi.arg('url'))
	heading = "%s/%s" % (kodi.arg('full_name'), kodi.arg('file'))
	options = []
	if xml:
		for addon in xml.findAll('addon'):
			options.append("%s (%s)" % (addon['name'], addon['version']))

		kodi.dialog_select(heading, sorted(options))
示例#2
0
def browse_repository():
	from libs import github
	xml = github.browse_repository(kodi.arg('url'))
	heading = "%s/%s" % (kodi.arg('full_name'), kodi.arg('file'))
	options = []
	if xml:
		for addon in xml.findAll('addon'):
			options.append("%s (%s)" % (addon['name'], addon['version']))

		kodi.dialog_select(heading, sorted(options))
示例#3
0
        def github_resolver(unmet):
            results = github.web_search(unmet)
            c = kodi.dialog_select("GitHub Search Results for %s" % unmet,
                                   [r['full_name'] for r in results['items']])
            if c is not False:
                dep = results['items'][c]
                dep_url = url = "https://github.com/%s/archive/master.zip" % (
                    dep['full_name'])
                self.met_addons.append(unmet)
                dep_filename = "%s.zip" % unmet
                self.sources[unmet] = {
                    "type": SOURCES.REPO,
                    "url": dep_url,
                    "user": user,
                    "repo": repo,
                    "version": ""
                }
                kodi.log("%s dependency met in %s" % (unmet, dep_url))
                self.install_addon(unmet,
                                   dep_url,
                                   dep['full_name'],
                                   master=True)

                return True
            return False
示例#4
0
def master_control():
    options = [
        "Send to Master Control", "Stream with Master Control",
        "Master Control Queue"
    ]
    c = kodi.dialog_select("Master Control Menu", options)
    if c is False: return
    if c == 2:
        kodi.execute_url("plugin://master.control?mode=queue")
    elif c == 1:
        from scrapecore import scrapers
        resolved_url = scrapers.get_scraper_by_name(
            kodi.args['service']).resolve_url(kodi.args['raw_url'])
        if not resolved_url: return
        from mastercontrol import api as master_control
        stream_url = master_control.get_streaming_url(resolved_url)
        kodi.play_url(stream_url)
    elif c == 0:
        ids = kodi.arg('ids', decode='json')
        from commoncore import trakt
        from mastercontrol import api as master_control
        if kodi.args['media'] == 'movie':
            media = 'movie'
            title = "%s (%s)" % (kodi.args['title'], kodi.args['year'])
            filename = kodi.vfs.clean_file_name(title)
            destination = ''
        else:
            media = 'tvshow'
            destination = kodi.vfs.join(kodi.args['title'],
                                        "Season %s" % kodi.args['season'])
            title = "%s - S%02dE%02d" % (kodi.args['title'],
                                         int(kodi.args['season']),
                                         int(kodi.args['episode']))
            filename = kodi.vfs.clean_file_name(title)

        from scrapecore import scrapers
        resolved_url = scrapers.get_scraper_by_name(
            kodi.args['service']).resolve_url(kodi.args['raw_url'])
        if not resolved_url: return
        video = {
            "type": media,
            "filename": filename,
            "url": resolved_url,
            "title": title,
            "addon": kodi.get_id(),
            "destination": destination,
            "trakt_id": kodi.args['trakt_id']
        }
        response = master_control.enqueue(video)
        kodi.log(response)
        message = 'Failed Adding to Queue %s.' % (title)
        try:
            if response['status'] == 200:
                message = 'Added to Queue %s.' % (title)
        except:
            pass
        kodi.notify(kodi.get_name(), message)
def add_to_list(media, trakt_id):
    options = ['Watchlist', 'Collection']
    lists = get_custom_lists()
    for li in lists['items']:
        options.append(li['name'])
    c = kodi.dialog_select("Add to list", options)
    if c is False: return
    elif c == 0:
        add_to_watchlist(media, trakt_id)
    elif c == 1:
        add_to_collection(media, trakt_id)
    else:
        slug = lists['items'][c - 2]['ids']['slug']
        add_to_custom_list(media, slug, trakt_id)
示例#6
0
def add_to_list(media, trakt_id):
	options = ['Watchlist', 'Collection']
	lists = get_custom_lists()
	for li in lists['items']:
		options.append(li['name'])
	c = kodi.dialog_select("Add to list", options)
	if c is False: return
	elif c == 0:
		add_to_watchlist(media,trakt_id)
	elif c == 1:
		add_to_collection(media,trakt_id)
	else:
		slug = lists['items'][c-2]['ids']['slug']
		add_to_custom_list(media, slug, trakt_id)
示例#7
0
		def	github_resolver(unmet):
			results = github.web_search(unmet)
			c = kodi.dialog_select("GitHub Search Results for %s" % unmet, [r['full_name'] for r in results['items']])
			if c is not False:
				dep = results['items'][c]
				dep_url = url = "https://github.com/%s/archive/master.zip" % (dep['full_name'])
				self.met_addons.append(unmet)
				dep_filename = "%s.zip" % unmet
				self.sources[unmet] = {"type": SOURCES.REPO, "url": dep_url, "user": user, "repo": repo, "version": ""}
				kodi.log("%s dependency met in %s" % (unmet, dep_url))
				self.install_addon(unmet, dep_url, dep['full_name'], master=True)
				
				return True
			return False	
示例#8
0
def search_filter():
	from commoncore.core import format_color
	options = display =['None', 'Repository', 'Feed', 'Music Plugin', 'Video Plugin', 'Script']
	filter = kodi.get_property('search.filter')
	if filter in options:
		index = options.index(filter)
		display[index] = format_color(display[index], 'yellow')
	else:
		display[0] = format_color(display[0], 'yellow')
		
	c = kodi.dialog_select("Filter Results by:", display)
	if c is not False:
		if c is 0:
			kodi.set_property('search.filter', '')
		else:
			kodi.set_property('search.filter', options[c])
示例#9
0
def search_filter():
	from commoncore.core import format_color
	options = display =['None', 'Repository', 'Feed', 'Music Plugin', 'Video Plugin', 'Script']
	filter = kodi.get_property('search.filter')
	if filter in options:
		index = options.index(filter)
		display[index] = format_color(display[index], 'yellow')
	else:
		display[0] = format_color(display[0], 'yellow')
		
	c = kodi.dialog_select("Filter Results by:", display)
	if c is not False:
		if c is 0:
			kodi.set_property('search.filter', '')
		else:
			kodi.set_property('search.filter', options[c])