コード例 #1
0
 def add_server(self, server, ssl):
     # Reserved for userclient only
     server_id = server['Id']
     info = {
         'UserId':
         server['UserId'],
         'Server':
         connectionmanager.getServerAddress(server,
                                            server['LastConnectionMode']),
         'Token':
         server['AccessToken'],
         'SSL':
         ssl
     }
     for server_info in self.servers:
         if server_info == server_id:
             server_info.update(info)
             # Set window prop
             self._set_server_properties(server_id, server['Name'], info)
             log.info("updating %s to available servers: %s", server_id,
                      self.servers)
             break
     else:
         self.servers[server_id] = info
         self._set_server_properties(server_id, server['Name'],
                                     json.dumps(info))
         log.info("adding %s to available servers: %s", server_id,
                  self.servers)
コード例 #2
0
    def login(self, server=None):

        ga = GoogleAnalytics()
        ga.sendEventData("Connect", "UserLogin")

        # Return user or raise error
        server = server or self.state['Servers'][0]
        server_address = connectionmanager.getServerAddress(
            server, server['LastConnectionMode'])

        users = ""
        try:
            users = self.emby.getUsers(server_address)
        except Exception as error:
            log.info("Error getting users from server: " + str(error))

        if not users:
            try:
                return self.login_manual(server_address)
            except RuntimeError:
                raise RuntimeError("No user selected")

        dialog = UsersConnect("script-emby-connect-users.xml", *XML_PATH)
        dialog.set_server(server_address)
        dialog.set_users(users)
        dialog.doModal()

        if dialog.is_user_selected():

            user = dialog.get_user()
            username = user['Name']

            if user['HasPassword']:
                log.debug("User has password, present manual login")
                try:
                    return self.login_manual(server_address, username)
                except RuntimeError:
                    return self.login(server)
            else:
                try:
                    user = self.emby.loginUser(server_address, username)
                except Exception as error:
                    log.info("Error logging in user: "******"No user selected")
コード例 #3
0
    def login(self, server=None):

        ga = GoogleAnalytics()
        ga.sendEventData("Connect", "UserLogin")

        # Return user or raise error
        server = server or self.state['Servers'][0]
        server_address = connectionmanager.getServerAddress(server, server['LastConnectionMode'])

        users = "";
        try:
            users = self.emby.getUsers(server_address)
        except Exception as error:
            log.info("Error getting users from server: " + str(error))

        if not users:
            try:
                return self.login_manual(server_address)
            except RuntimeError:
                raise RuntimeError("No user selected")

        dialog = UsersConnect("script-emby-connect-users.xml", *XML_PATH)
        dialog.set_server(server_address)
        dialog.set_users(users)
        dialog.doModal()

        if dialog.is_user_selected():

            user = dialog.get_user()
            username = user['Name']

            if user['HasPassword']:
                log.debug("User has password, present manual login")
                try:
                    return self.login_manual(server_address, username)
                except RuntimeError:
                    return self.login(server)
            else:
                try:
                    user = self.emby.loginUser(server_address, username)
                except Exception as error:
                    log.info("Error logging in user: "******"No user selected")
コード例 #4
0
 def get_address(cls, server):
     return connectionmanager.getServerAddress(server, server['LastConnectionMode'])
コード例 #5
0
 def get_address(cls, server):
     return connectionmanager.getServerAddress(server, server['LastConnectionMode'])