Exemplo n.º 1
0
	def get_user_agent(self):
		if self.user_agent: return self.user_agent
		user_agent = kodi.get_property('user_agent')
		try: agent_refresh_time = int(kodi.get_property('agent_refresh_time'))
		except: agent_refresh_time = 0
		if not user_agent or agent_refresh_time < (time.time() - (7 * 24 * 60 * 60)):
			user_agent = self.generate_user_agent()
			kodi.set_property('user_agent', user_agent)
			kodi.set_property('agent_refresh_time', str(int(time.time())))
		return user_agent
Exemplo n.º 2
0
	def get_user_agent(self):
		if self.user_agent: return self.user_agent
		user_agent = kodi.get_property('user_agent')
		try: agent_refresh_time = int(kodi.get_property('agent_refresh_time'))
		except: agent_refresh_time = 0
		if not user_agent or agent_refresh_time < (time.time() - (7 * 24 * 60 * 60)):
			user_agent = self.generate_user_agent()
			kodi.set_property('user_agent', user_agent)
			kodi.set_property('agent_refresh_time', str(int(time.time())))
		return user_agent
Exemplo n.º 3
0
def find_zips(user, repo=None):
    filters = {
        'Repository': '*repository*.zip',
        'Feed': '*gitbrowser.feed*.zip',
        'Installer': '*gitbrowser.installer*.zip',
        'Music Plugin': '*plugin.audio*.zip',
        'Video Plugin': '*plugin.video*.zip',
        'Script': '*script*.zip'
    }
    filter = kodi.get_property('search.filter')
    if filter in filters:
        q = filters[filter]
    else:
        q = '*.zip'
    if repo is None:
        results = limit_versions(
            GH.request("/search/code",
                       query={
                           "per_page": page_limit,
                           "q": "user:%s+filename:%s" % (user, q)
                       },
                       cache_limit=EXPIRE_TIMES.HOUR))
    else:
        results = limit_versions(
            GH.request("/search/code",
                       query={
                           "per_page": page_limit,
                           "q": "user:%s+repo:%s+filename:%s" % (user, repo, q)
                       },
                       cache_limit=EXPIRE_TIMES.HOUR))
    return results
Exemplo n.º 4
0
def find_zips(user, repo=None):
    filters = {
        "Repository": "*repository*.zip",
        "Feed": "*gitbrowser.feed*.zip",
        "Installer": "*gitbrowser.installer*.zip",
        "Music Plugin": "*plugin.audio*.zip",
        "Video Plugin": "*plugin.video*.zip",
        "Script": "*script*.zip",
    }
    filter = kodi.get_property("search.filter")
    if filter in filters:
        q = filters[filter]
    else:
        q = "*.zip"
    if repo is None:
        results = limit_versions(
            GH.request(
                "/search/code",
                query={
                    "per_page": page_limit,
                    "q": "user:%s filename:%s" % (user, q)
                },
                cache_limit=EXPIRE_TIMES.HOUR,
            ))
    else:
        results = limit_versions(
            GH.request(
                "/search/code",
                query={
                    "per_page": page_limit,
                    "q": "user:%s repo:%s filename:%s" % (user, repo, q),
                },
                cache_limit=EXPIRE_TIMES.HOUR,
            ))
    return results
Exemplo n.º 5
0
    def authorize(self):
        token = kodi.get_property("TVDB_API_token")
        if not token:
            response = self.request('/login', data={"apikey": TVDB_KEY})
            if 'token' in response:
                token = response['token']
                kodi.set_property("TVDB_API_token", token)
            else:
                response.raise_for_status()

        self.headers["Authorization"] = "Bearer %s" % token
Exemplo n.º 6
0
def find_zips(user, repo=None):
	filters = {'Repository': '*repository*.zip', 'Feed': '*gitbrowser.feed*.zip', 'Installer': '*gitbrowser.installer*.zip', 'Music Plugin': '*plugin.audio*.zip', 'Video Plugin': '*plugin.video*.zip', 'Script': '*script*.zip'}
	filter = kodi.get_property('search.filter')
	if filter in filters:
		q = filters[filter]
	else:
		q = '*.zip'
	if repo is None:
		results = limit_versions(GH.request("/search/code", query={"per_page": page_limit, "q":"user:%s+filename:%s" % (user, q)}, cache_limit=EXPIRE_TIMES.HOUR))
	else:
		results = limit_versions(GH.request("/search/code", query={"per_page": page_limit, "q":"user:%s+repo:%s+filename:%s" % (user, repo, q)}, cache_limit=EXPIRE_TIMES.HOUR))
	return results
Exemplo n.º 7
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])
Exemplo n.º 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])
Exemplo n.º 9
0
				except ScraperCoreException as e:
					kodi.log(e)
					kodi.log("Invalid scraper: %s" % name)
					continue
				""" Scrape checks out, now access obtain an instance of the main class and store it in the list of _active_scrapers """
				classname = name+'Scraper'
				scraper = __import__('', globals(), locals(), [classname], -1)
				klass = getattr(scraper, classname)
				scraper = klass()
				""" Install the scraper if it has not already been installed """
				scrapecore.install_scraper(scraper)
				supported_scrapers.append(name)
				active_scrapers.append(scraper.service)
				_active_scrapers.append(scraper)
""" Re-write the scrapers settings xml if scraper count has changed """
if kodi.get_property("new_scraper", 'script.module.scrapecore'):
	scrapecore.write_settings_file()
	kodi.set_property("new_scraper", "false", 'script.module.scrapecore')
temp = []
_temp = []
""" Now verify each scraper is valid """
for s in supported_scrapers:
	scraper = _active_scrapers[supported_scrapers.index(s)]
	if kodi.get_setting(s +'_enable', addon_id=ADDON_ID) == 'true' and scraper.valid:
		temp.append(s)
		_temp.append(scraper)
active_scrapers = temp
_active_scrapers = _temp
del temp
del _temp