コード例 #1
0
def renameDevice():
    import xbmcgui
    from lib import devices
    from lib import pbclient
    from lib import util
    
    dev = devices.getDefaultKodiDevice(util.getSetting('pb_client_iden'),util.getSetting('pb_client_nickname'))
    if not dev or not dev.ID:
        xbmcgui.Dialog().ok(localise(32076),localise(32077))
    name = xbmcgui.Dialog().input('{0}:'.format(localise(32078)),dev.name or '')
    if not name: return
    if name == dev.name: return
    
    token = util.getSetting('pb_access_token')
    
    client = pbclient.Client(token)
    
    while deviceNameExists(client,name):
        name = xbmcgui.Dialog().input(localise(32079),dev.name or '')
        if not name: return
        if name == dev.name: return

    if not token:
        xbmcgui.Dialog().ok(localise(32068),localise(32080),localise(32081))
        return
        
    try:
        if client.updateDevice(dev,nickname=name):
            util.setSetting('pb_client_nickname',dev.name)
            xbmcgui.Dialog().ok(localise(32062),'{0}: '.format(localise(32082)),'',dev.name)
            
    except pbclient.PushbulletException, e:
        showError(e.message)
コード例 #2
0
def renameDevice():
    import xbmcgui
    from lib import devices
    from lib import PushbulletTargets
    from lib import util

    dev = devices.getDefaultKodiDevice(util.getSetting('device_iden'),
                                       util.getSetting('device_name'))
    if not dev or not dev.ID:
        xbmcgui.Dialog().ok(T(32076), T(32077))
    name = xbmcgui.Dialog().input('{0}:'.format(T(32078)), dev.name or '')
    if not name: return
    if name == dev.name: return

    token = util.getSetting('token')

    client = PushbulletTargets.Client(token)

    while deviceNameExists(client, name):
        name = xbmcgui.Dialog().input(T(32079), dev.name or '')
        if not name: return
        if name == dev.name: return

    if not token:
        xbmcgui.Dialog().ok(T(32068), T(32080), T(32081))
        return

    try:
        if client.updateDevice(dev, nickname=name):
            util.setSetting('device_name', dev.name)
            xbmcgui.Dialog().ok(T(32062), '{0}: '.format(T(32082)), '',
                                dev.name)

    except PushbulletTargets.PushbulletException, e:
        showError(e.message)
コード例 #3
0
    def start(self):
        self.targets = PushbulletTargets.Targets(
            self.token,
            most_recent=util.getSetting('most_recent', 0),
            most_recent_callback=self.mostRecentUpdated)

        self.device = devices.getDefaultKodiDevice(self.deviceID,
                                                   self.deviceName)
        self.targets.registerDevice(self.device)
コード例 #4
0
	def start(self):
		self.targets = PushbulletTargets.Targets(
			self.token,
			most_recent=util.getSetting('most_recent',0),
			most_recent_callback=self.mostRecentUpdated
		)

		self.device = devices.getDefaultKodiDevice(self.deviceID,self.deviceName)
		self.targets.registerDevice(self.device)