Exemple #1
0
	def addonid():
		from commoncore.core import highlight
		from libs.github import re_version, content_url
		from distutils.version import LooseVersion
		rtype = 'api'
		results = github.search(q, 'id')
		if results is None: return

		def version_sort(name):
			v = re_version.search(name)
			if v:
				return LooseVersion(v.group(1))
			else: 
				return LooseVersion('0.0.0')
		
		results.sort(key=lambda x:version_sort(x['name']), reverse=True)
			
		for i in results:
			menu = kodi.ContextMenu()
			r = i['repository']
			full_name = r['full_name']
			title = highlight("%s/%s" % (full_name, i['name']), q, 'yellow')
			url = content_url % (full_name, i['path'])
			menu.add("Search Username", {'mode': 'search', 'type': 'username', 'query': r['owner']['login']})
			kodi.add_menu_item({'mode': 'github_install', "url": url, "file": i['name'], "full_name": full_name}, {'title': title}, menu=menu, icon='null')
Exemple #2
0
	def addonid():
		from commoncore.core import highlight
		from libs.github import version_sort
		rtype = 'api'
		results = github.search(q, 'id')
		if results is None: return
		results.sort(key=lambda x:version_sort(x['name']), reverse=True)
			
		for i in results:
			menu = kodi.ContextMenu()
			r = i['repository']
			full_name = r['full_name']
			title = highlight("%s/%s" % (full_name, i['name']), q, 'yellow')
			url = get_download_url(full_name, i['path'])
			menu.add("Search Username", {'mode': 'search', 'type': 'username', 'query': r['owner']['login']})
			kodi.add_menu_item({'mode': 'github_install', "url": url, "file": i['name'], "full_name": full_name}, {'title': title}, menu=menu, icon='null')
Exemple #3
0
	def repository():
		rtype = 'api'
		results = github.search(q, 'title')
		if results is None: return
		for i in results['items']:
			user = i['owner']['login']
			response = github.find_zips(user)
			if response is None: continue
			for r in github.sort_results(response['items']):
				url = github.content_url % (r['repository']['full_name'], r['path'])
				menu = kodi.ContextMenu()
				if r['is_repository']:
					menu.add('Browse Repository Contents', {"mode": "browse_repository", "url": url, "file": r['name'], "full_name": "%s/%s" % (q, r['repository']['name'])})
				if r['is_feed']:
					kodi.add_menu_item({'mode': 'install_feed', "url": url}, {'title': r['name']}, menu=menu, icon='null')
				else:
					kodi.add_menu_item({'mode': 'github_install', "url": url, "user": q, "file": r['name'], "full_name": "%s/%s" % (q, r['repository']['name'])}, {'title': r['name']}, menu=menu, icon='null')
Exemple #4
0
	def repository():
		rtype = 'api'
		results = github.search(q, 'title')
		if results is None: return
		for i in results['items']:
			user = i['owner']['login']
			response = github.find_zips(user)
			if response is None: continue
			for r in github.sort_results(response['items']):
				url = get_download_url(r['repository']['full_name'], r['path'])
				menu = kodi.ContextMenu()
				if r['is_repository']:
					menu.add('Browse Repository Contents', {"mode": "browse_repository", "url": url, "file": r['name'], "full_name": "%s/%s" % (q, r['repository']['name'])})
				if r['is_feed']:
					r['display'] = "[COLOR yellow]%s[/COLOR]" % r['name']
					kodi.add_menu_item({'mode': 'install_feed', "url": url}, {'title': r['name']}, menu=menu, icon='null')
				elif r['is_installer']:
					r['display'] = "[COLOR orange]%s[/COLOR]" % r['name']
					kodi.add_menu_item({'mode': 'install_batch', "url": url}, {'title': r['name'], 'display': r['display']}, menu=menu, icon='null')	
				else:
					kodi.add_menu_item({'mode': 'github_install', "url": url, "user": q, "file": r['name'], "full_name": "%s/%s" % (q, r['repository']['name'])}, {'title': r['name']}, menu=menu, icon='null')