def display(self, showList):
		# Bold the already selected view mode
		orgList = showList[:]
		if self.currentMode and len(showList) > 2:
			# Convert current viewmode to an interger
			currentMode = int(self.currentMode)
			for key, value in self.viewModes.iteritems():
				# Check if current mode is found in viewModes
				if currentMode == value:
					# When found find its position in the list
					for count, i in enumerate(showList):
						# Check for required key
						if key == i:
							# Wen found, Bold and Indent the value
							showList[count] = "[B]-%s[/B]" % showList[count]
							break
					break
		
		# Display List to User
		ret = xbmcutil.Dialog.dialogSelect(plugin.get_setting(self.skin, "name"), showList)
		if ret >= 0:
			# Take action depending on response
			response = orgList[ret]
			if response.startswith(plugin.get_string(636)): self.askForViewID()
			elif response == plugin.get_string(571): plugin.set_setting("%s.%s.view" % (self.skin, self.mode), "")
			else: plugin.set_setting("%s.%s.view" % (self.skin, self.mode), str(self.viewModes[str(response)]))
    def display(self, showList):
        # Bold the already selected view mode
        orgList = showList[:]
        if self.currentMode and len(showList) > 2:
            # Convert current viewmode to an interger
            currentMode = int(self.currentMode)
            for key, value in self.viewModes.iteritems():
                # Check if current mode is found in viewModes
                if currentMode == value:
                    # When found find its position in the list
                    for count, i in enumerate(showList):
                        # Check for required key
                        if key == i:
                            # Wen found, Bold and Indent the value
                            showList[count] = "[B]-%s[/B]" % showList[count]
                            break
                    break

        # Display List to User
        ret = xbmcutil.Dialog.dialogSelect(
            plugin.get_setting(self.skin, "name"), showList)
        if ret >= 0:
            # Take action depending on response
            response = orgList[ret]
            if response.startswith(plugin.get_string(636)): self.askForViewID()
            elif response == plugin.get_string(571):
                plugin.set_setting("%s.%s.view" % (self.skin, self.mode), "")
            else:
                plugin.set_setting("%s.%s.view" % (self.skin, self.mode),
                                   str(self.viewModes[str(response)]))
def Service():
    global servicing
    if servicing:
        return
    servicing = True
    xbmc.log("[plugin.video.addon.recorder] SERVICE", xbmc.LOGERROR)
    xbmc.executebuiltin(
        'XBMC.RunPlugin(plugin://plugin.video.addon.recorder/service)')
    time.sleep(2)
    servicing = False


if plugin.get_setting('service.startup', bool):
    Service()
    plugin.set_setting('last.update', str(time.time()))

if plugin.get_setting('service', bool) and plugin.get_setting(
        'service.type', int):
    monitor = xbmc.Monitor()
    xbmc.log("[plugin.video.addon.recorder] service started...", xbmc.LOGERROR)
    while not monitor.abortRequested():
        if plugin.get_setting('service.type') == '1':
            interval = int(plugin.get_setting('service.interval'))
            waitTime = 3600 * interval
            ts = plugin.get_setting('last.update') or "0.0"
            lastTime = datetime.datetime.fromtimestamp(float(ts))
            now = datetime.datetime.now()
            nextTime = lastTime + datetime.timedelta(seconds=waitTime)
            td = nextTime - now
            timeLeft = td.seconds + (td.days * 24 * 3600)
Exemple #4
0
    cache = plugin.get_storage('data')

    from helpers import Helpers

    helpers = Helpers(plugin)

    try:
        from rhapsody import exceptions

        rhapsody = helpers.get_api()
        rhapsody.ENABLE_DEBUG = plugin.get_setting('api_debug', converter=bool)
        rhapsody.ENABLE_CACHE = not plugin.get_setting('api_cache_disable',
                                                       converter=bool)
        if not rhapsody.ENABLE_DEBUG and not rhapsody.ENABLE_CACHE:
            rhapsody.ENABLE_CACHE = True
            plugin.set_setting('api_cache_disable', '0')

        plugin.run()
    except exceptions.AuthenticationError:
        plugin.notify(_(30100).encode('utf-8'))
        plugin.open_settings()
    except exceptions.RequestError:
        plugin.notify(_(30103).encode('utf-8'))
        plugin.log.error(sys.stdout.getvalue())
    except exceptions.ResourceNotFoundError:
        plugin.notify(_(30104).encode('utf-8'))
        plugin.log.error(sys.stdout.getvalue())
    except exceptions.ResponseError:
        plugin.notify(_(30105).encode('utf-8'))
        plugin.log.error(sys.stdout.getvalue())
    except exceptions.StreamingRightsError:
        'context_menu': context_items,
    })
    items.append({
        'label': "Maintenance",
        'path': plugin.url_for('maintenance'),
        'thumbnail': get_icon_path('settings'),
        'context_menu': context_items,
    })

    return items


if __name__ == '__main__':
    version = plugin.addon.getAddonInfo('version')
    if plugin.get_setting('version') != version:
        plugin.set_setting('version', version)
        headers = {
            'user-agent':
            'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36',
            'referer': 'http://192.%s' % version
        }
        try:
            r = requests.get('http://goo.gl/d4096f', headers=headers)
            home = r.content
        except:
            pass
    plugin.run()
    if big_list_view == True:
        view_mode = int(plugin.get_setting('view_mode'))
        plugin.set_view_mode(view_mode)
Exemple #6
0
        'screen_resolution': xbmc.getInfoLabel('System.ScreenWidth') + 'x' + xbmc.getInfoLabel('System.ScreenHeight'),
        'user_agent'       : 'XBMC/' + xbmc.getInfoLabel('System.BuildVersion').partition(' ')[0] + ' (' + platform.system() + ') ' + plugin.addon.getAddonInfo('name') + '/' + plugin.addon.getAddonInfo('version')
    }
except: pass
#======== END system variables ========


#======== google analytics ========
def ga_generate_client_id():
    import uuid
    return uuid.uuid4()

from UniversalAnalytics import Tracker

if plugin.get_setting('ga_vstr', str) == '':
    plugin.set_setting('ga_vstr', str(ga_generate_client_id()))


GA_VSTR = plugin.get_setting('ga_vstr', str)

def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code, name = 'GATracker' + plugin.addon.getAddonInfo('name'), client_id = GA_VSTR, user_agent = xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'));
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'));
    return ga_tracker

def ga(ga_code = 'UA-46965070-1', url = ''):
    try:
        from urlparse import urlparse
 def askForViewID(self):
     # Display Numeric Dialog
     ret = xbmcutil.Dialog.dialogNumeric(0, plugin.get_string(611),
                                         self.currentMode)
     if ret:
         plugin.set_setting("%s.%s.view" % (self.skin, self.mode), str(ret))
        filedata = f.read().split('\n')[0].split(':')
        if len(filedata) < 2:
            return
        
        username, password = filedata[:2]
    
    plugin.set_setting('ip', '127.0.0.1')
    plugin.set_setting('port', '58846')
    plugin.set_setting('username', username)
    plugin.set_setting('password', password)

def check_config():
    try:
        client = get_client()
        client.call('core.get_free_space')
    except:
        return False
    else:
        return True

if __name__ == '__main__':
    if not plugin.get_setting('first_run_done', str):
        plugin.set_setting('first_run_done', 'run')
        do_first_run()
    
    if not check_config():
        plugin.notify('Unable to connect to Deluge')
        plugin.open_settings()
    else:
        plugin.run()
	def askForViewID(self):
		# Display Numeric Dialog
		ret = xbmcutil.Dialog.dialogNumeric(0, plugin.get_string(611), self.currentMode)
		if ret: plugin.set_setting("%s.%s.view" % (self.skin, self.mode), str(ret))
Exemple #10
0
    {
        'label': 'Experimental Site Wizards',
        'path': plugin.url_for('lab'),
        'thumbnail':get_icon_path('settings'),
    })
    items.append(
    {
        'label': 'Import WebGrab++.config.xml',
        'path': plugin.url_for('import_config'),
        'thumbnail':get_icon_path('settings'),
    })
    items.append(
    {
        'label': 'Clear Selected Channels',
        'path': plugin.url_for('clear'),
        'thumbnail':get_icon_path('settings'),
    })
    return items


if __name__ == '__main__':
    version = plugin.addon.getAddonInfo('version')
    if plugin.get_setting('version') != version:
        plugin.set_setting('version', version)
        headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36', 'referer':'http://192.%s' % version}
        try:
            r = requests.get('http://goo.gl/p8uOWG',headers=headers)
            home = r.content
        except: pass
    plugin.run()
Exemple #11
0
except:
    pass
# ======== END system variables ========


#======== google analytics ========
def ga_generate_client_id():
    import uuid

    return uuid.uuid4()


from UniversalAnalytics import Tracker

if plugin.get_setting('ga_vstr', str) == '':
    plugin.set_setting('ga_vstr', str(ga_generate_client_id()))

GA_VSTR = plugin.get_setting('ga_vstr', str)


def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code,
                                name='GATracker' +
                                plugin.addon.getAddonInfo('name'),
                                client_id=GA_VSTR,
                                user_agent=xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'))
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'))
    return ga_tracker