Exemplo n.º 1
0
    def check_login(self):
        """
            Tries to connect to the AudioScrobbler
            service with the existing login data
        """
        username = settings.get_option('plugin/ascrobbler/user', '')
        password = settings.get_option('plugin/ascrobbler/password', '')
        url = settings.get_option(
            'plugin/ascrobbler/url', 'http://post.audioscrobbler.com/'
        )
        login_verified = False

        try:
            _scrobbler.login(username, password, post_url=url)
        except _scrobbler.AuthError:
            try:
                _scrobbler.login(username, password, hashpw=True, post_url=url)
            except _scrobbler.AuthError:
                pass
            else:
                login_verified = True
        else:
            login_verified = True

        if login_verified:
            GLib.idle_add(self.message.show_info, _('Verification successful'), '')
        else:
            GLib.idle_add(
                self.message.show_error,
                _('Verification failed'),
                _('Please make sure the entered data is correct.'),
            )

        GLib.idle_add(self.widget.set_sensitive, True)
Exemplo n.º 2
0
    def check_login(self):
        """
            Tries to connect to the AudioScrobbler
            service with the existing login data
        """
        username = settings.get_option('plugin/ascrobbler/user', '')
        password = settings.get_option('plugin/ascrobbler/password', '')
        url = settings.get_option('plugin/ascrobbler/url',
                                  'http://post.audioscrobbler.com/')
        login_verified = False

        try:
            _scrobbler.login(username, password, post_url=url)
        except _scrobbler.AuthError:
            try:
                _scrobbler.login(username, password, hashpw=True, post_url=url)
            except _scrobbler.AuthError:
                pass
            else:
                login_verified = True
        else:
            login_verified = True

        if login_verified:
            glib.idle_add(self.message.show_info, _('Verification successful'),
                          '')
        else:
            glib.idle_add(self.message.show_error, _('Verification failed'),
                          _('Please make sure the entered data is correct.'))

        glib.idle_add(self.widget.set_sensitive, True)
Exemplo n.º 3
0
    def initialize(self, username, password, server):
        try:
            logger.info("Attempting to connect to AudioScrobbler (%s)" % server)
            scrobbler.login(username, password, hashpw=False, post_url=server)
        except:

            try:
                scrobbler.login(username, password, hashpw=True, post_url=server)
            except:
                self.connecting = False
                logger.exception("Error logging in")
                return

        logger.info("Connected to AudioScrobbler")

        event.add_callback(self.on_play, 'playback_track_start', player.PLAYER)
        event.add_callback(self.on_stop, 'playback_track_end', player.PLAYER)
        self.connected = True
        self.connecting = False
Exemplo n.º 4
0
    def initialize(self, username, password, server):
        try:
            logger.info("Attempting to connect to AudioScrobbler (%s)" % server)
            scrobbler.login(username, password, hashpw=False, post_url=server)
        except:

            try:
                scrobbler.login(username, password, hashpw=True, post_url=server)
            except:
                self.connecting = False
                common.log_exception()
                return

        logger.info("Connected to AudioScrobbler")

        event.add_callback(self.on_play, "playback_track_start", player.PLAYER)
        event.add_callback(self.on_stop, "playback_track_end", player.PLAYER)
        self.connected = True
        self.connecting = False
Exemplo n.º 5
0
    def initialize(self, username, password, server):
        try:
            logger.info("Attempting to connect to AudioScrobbler (%s)", server)
            scrobbler.login(username, password, hashpw=False, post_url=server)
        except Exception:

            try:
                scrobbler.login(username, password, hashpw=True, post_url=server)
            except Exception:
                self.connecting = False
                logger.exception("Error logging in")
                return

        logger.info("Connected to AudioScrobbler")

        event.add_callback(self.on_play, 'playback_track_start', player.PLAYER)
        event.add_callback(self.on_stop, 'playback_track_end', player.PLAYER)
        self.connected = True
        self.connecting = False