audioscrobbler won't login/submit problems

Bug #406231 reported by Yakov Mindelis
264
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Exaile
Invalid
Undecided
Mathias Brodala

Bug Description

Audioscroblet plugin doesn't login properly, here's the output.

INFO : AS: attempting to connect to audioscrobbler
INFO : Loading collection...
INFO : AS: Connected to audioscrobbler
INFO : Loading devices...
WARNING : Failed to connect to HAL, autodetection of devices will be disabled.
INFO : Loading interface...
INFO : Playing file:///Users/jack/mp3/Bad_Plus%2C_The/2003-These_Are_The_Vistas/01-Big_Eater.mp3
INFO : Attempting to submit now playing information...
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py", line 486, in __bootstrap_inner
    self.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py", line 446, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/jack/exaile_bazaar/exaile/data/plugins/audioscrobbler/__init__.py", line 110, in now_playing
    track.get_duration(), track.get_track())
  File "/Users/jack/exaile_bazaar/exaile/data/plugins/audioscrobbler/_scrobbler.py", line 152, in now_playing
    raise AuthError("Please 'login()' first. (No session available)")
AuthError: Please 'login()' first. (No session available)

Problem is: if non-md5 password is used in login() with hashpw=False, first call in initialize() routine for some reason doesn't raise the exceptions and the next call (wh haspw=True) isn't triggered.
When setting both calls of login to use hashpw=True, the iniitial login succeeds and proper cookie value is obtained,

Reworked initialize():

    def initialize(self, username, password, server):
        logger.info("AS: attempting to connect to audioscrobbler")
        try:
            scrobbler.login(username, password, hashpw=True, post_url=server)
        except:

            try:
                scrobbler.login(username, password, hashpw=True, post_url=server)
            except:
                self.connecting = False
                common.log_exception()
                return
        logger.info("AS: Connected to audioscrobbler")

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

    @common.threaded

Anyway, reviewing the _scrobbler.py and __init.py login procedures raised some questions:

1. Lastfm expects md5-hashed passwords.

2. settings.ini should always have md5-hashed pw stored, or and indication if the password is md5 or no.
Actually, during my investigation, if my memory doesn't betray me, at some point it did store md5 password iside the ini file.

I think the ideal behaviour should be one of these:

1. store md5 digest of pw in the file and use login(hashpw=False)

2. store plain text pw and use login(hashpw=True)

3. store either pw with propper marker of it md5-ness and use login(hashpw=(not md5-ness of the pw))

Off course security-wise non-md5 pw in setting.ini file isn't good.

System used: OSX10.4.11
python 2.5.4

Revision history for this message
Mathias Brodala (mathbr) wrote :

The idea here was to first try to login via an unhashed password (suggesting that it already is hashed) and if that fails again with a hashed password. This is meant to allow older versions of Exaile 0.3.x to be able to login, even if the password has not been hashed.

By default the password is always hashed in the preference and saved as such. If we now force the first call to login to hash the password, login with an already hashed password is likely to fail the same way it is currently for unhashed passwords.

There is no way that we can save an indication if the password has already been hashed or not, we cannot know about that.

Anyways, I could not reproduce the issue if I restore my plain text password and the password is hashed as soon as you re-enter the password in the preferences dialog.

Changed in exaile:
assignee: nobody → Mathias Brodala (mathbr)
status: New → Invalid
Revision history for this message
Yakov Mindelis (jackitg) wrote : Re: [Bug 406231] Re: audioscrobbler won't login/submit problems

Hi Mathias,

On Wed, 29 Jul 2009, Mathias Brodala wrote:
> Anyways, I could not reproduce the issue if I restore my plain text
> password and the password is hashed as soon as you re-enter the password
> in the preferences dialog.

Oh, this is the action that triggered the md5 in the ini file,
With this I still don't get the login confirmation in the log, message
beginning with "[AS]" and stating the logn success shoul apear between
these two lines:

07-29 12:23 INFO : AS: attempting to connect to audioscrobbler (audioscrobbler)
07-29 12:23 INFO : AS: Connected to audioscrobbler (audioscrobbler)

Any idea?
when hardcoding the login() to hashpw=True inside the routine, login
works as expected.

Jack

Revision history for this message
Mathias Brodala (mathbr) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

Yakov Mindelis, 29.07.2009 11:27:
> On Wed, 29 Jul 2009, Mathias Brodala wrote:
>> Anyways, I could not reproduce the issue if I restore my plain text
>> password and the password is hashed as soon as you re-enter the password
>> in the preferences dialog.
>
> Oh, this is the action that triggered the md5 in the ini file,
> With this I still don't get the login confirmation in the log,

So your password is written as hash in the settings.ini after this?

> message
> beginning with "[AS]" and stating the logn success shoul apear between
> these two lines:
>
> 07-29 12:23 INFO : AS: attempting to connect to audioscrobbler (audioscrobbler)
> 07-29 12:23 INFO : AS: Connected to audioscrobbler (audioscrobbler)
>
>
> Any idea?

Can you please try the following:

1. Fire up a terminal and go to the directory of the audioscrobbler
plugin (where __init__.py and all the others are located)

2. Launch the python interactive console

3. Import _scrobbler

4. Try _scrobbler.login($username, $password_hash, hashpw=False,
post_url='http://post.audioscrobbler.com/')

5. Try _scrobbler.login($username, $password, hashpw=True,
post_url='http://post.audioscrobbler.com/')

Both 4. and 5. should yield no exceptions.

Regards, Mathias

- --
debian/rules
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpwGXEACgkQYfUFJ3ewsJhY8QCeN2a7hLueLZvcmQXPVDiNzufL
6xQAn3RGBpQMcL/GDTGSEyBCeH0EkaQK
=LxBQ
-----END PGP SIGNATURE-----

Revision history for this message
Yakov Mindelis (jackitg) wrote :

Hi Mathias,

On Wed, 29 Jul 2009, Mathias Brodala wrote:
> Anyways, I could not reproduce the issue if I restore my plain text
> password and the password is hashed as soon as you re-enter the password
> in the preferences dialog.

Oh, this is the action that triggered the md5 in the ini file,
With this I still don't get the login confirmation in the log, message
beginning with
"[AS]" and stating the logn success shoul apear between these two lines:

07-29 12:23 INFO : AS: attempting to connect to audioscrobbler
(audioscrobbler)
07-29 12:23 INFO : AS: Connected to audioscrobbler (audioscrobbler)

Any idea?
when hardcoding the login() to hashpw=True inside the routine, login
works as expected.

Jack

Revision history for this message
Yakov Mindelis (jackitg) wrote :
Download full text (5.4 KiB)

Hi Mathis,

On Wed, 29 Jul 2009, Mathias Brodala wrote:

> So your password is written as hash in the settings.ini after this?

Yes, after tryng your suggestion, it changed, I think it happened during
yesterday's investigations as well, but I reset it to text again.

> Can you please try the following:
>
> 1. Fire up a terminal and go to the directory of the audioscrobbler
> plugin (where __init__.py and all the others are located)
>
> 2. Launch the python interactive console
>
> 3. Import _scrobbler
>
> 4. Try _scrobbler.login($username, $password_hash, hashpw=False,
> post_url='http://post.audioscrobbler.com/')
>
> 5. Try _scrobbler.login($username, $password, hashpw=True,
> post_url='http://post.audioscrobbler.com/')
>
> Both 4. and 5. should yield no exceptions.
>

Ok, and added one more, text passwor with Fale hashpw:

[vincent:~/exaile/plugins/audioscrobbler] jack% ipython2.5
Python 2.5.4 (r254:67916, Jul 6 2009, 09:34:22)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import _scrobbler

In [2]: pw5=...

In [3]: pw=...

In [4]: _scrobbler.login("jitg", pw, hashpw=False,
post_url='http://post.audioscrobbler.com/')

In [5]: _scrobbler.login("jitg", pw, hashpw=True,
post_url='http://post.audioscrobbler.com/')

In [6]: _scrobbler.login("jitg", pw5, hashpw=False,
post_url='http://post.audioscrobbler.com/')

As you see, non-hash pw + hashpw=False doesn't rase a thing, and it
should, the reply contains nothing hence no cookie for the session
(SESSION_ID)

Jack

>
> Regards, Mathias
>
> - --
> debian/rules
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkpwGXEACgkQYfUFJ3ewsJhY8QCeN2a7hLueLZvcmQXPVDiNzufL
> 6xQAn3RGBpQMcL/GDTGSEyBCeH0EkaQK
> =LxBQ
> -----END PGP SIGNATURE-----
>
> --
> audioscrobbler won't login/submit problems
> https://bugs.launchpad.net/bugs/406231
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Exaile: Invalid
>
> Bug description:
> Audioscroblet plugin doesn't login properly, here's the output.
>
>
> INFO : AS: attempting to connect to audioscrobbler
> INFO : Loading collection...
> INFO : AS: Connected to audioscrobbler
> INFO : Loading devices...
> WARNING : Failed to connect to HAL, autodetection of devices will be disabled.
> INFO : Loading interface...
> INFO : Playing file:///Users/jack/mp3/Bad_Plus%2C_The/2003-These_Are_The_Vistas/01-Big_Eater.mp3
> INFO : Attempting to submit now playing information...
> Exception in thread Thread-8:
> Traceback (most recent call last):
> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py", line 486, in __bootstrap_inner
> self.run()
> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py", line 446, in run
> self.__target(*self.__args,...

Read more...

Revision history for this message
Mathias Brodala (mathbr) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

Yakov Mindelis, 29.07.2009 14:32:
> In [4]: _scrobbler.login("jitg", pw, hashpw=False,
> post_url='http://post.audioscrobbler.com/')
>
> […]
>
> As you see, non-hash pw + hashpw=False doesn't rase a thing, and it
> should, the reply contains nothing hence no cookie for the session
> (SESSION_ID)

That’s odd. If I try plain text password + hashpw=False here, I get a
clear exception:

> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "_scrobbler.py", line 93, in login
> raise AuthError('Bad username/password')
> _scrobbler.AuthError: Bad username/password

And obviously that’s how it’s supposed to work. Not sure what’s wrong at
your place then.

Regards, Mathias

- --
debian/rules
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpwRCEACgkQYfUFJ3ewsJjRFQCdGaCnD2+QkvFIIL22xZeDh/da
xZgAoIJda87kY6aUaYGrZSJJI+8S+5V/
=r58A
-----END PGP SIGNATURE-----

Revision history for this message
Yakov Mindelis (jackitg) wrote :

On Wed, 29 Jul 2009 12:44:17 -0000
Mathias Brodala <email address hidden> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi.
>
> Yakov Mindelis, 29.07.2009 14:32:
> > In [4]: _scrobbler.login("jitg", pw, hashpw=False,
> > post_url='http://post.audioscrobbler.com/')
> >
> > […]
> >
> > As you see, non-hash pw + hashpw=False doesn't rase a thing, and it
> > should, the reply contains nothing hence no cookie for the session
> > (SESSION_ID)
>
> That’s odd. If I try plain text password + hashpw=False here, I get a
> clear exception:
>
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File "_scrobbler.py", line 93, in login
> > raise AuthError('Bad username/password')
> > _scrobbler.AuthError: Bad username/password

> And obviously that’s how it’s supposed to work. Not sure what’s wrong at
> your place then.

Just did it again and got BADAUTH as expected. Strange. I'll keep an
eye on it. The only difference is different network (provider).

And another (a bit OT) question: submitting occurs at the beginning of
playback of the track. Afair, lastfm rules are to submit at min(240
seconds, length/2). after playback begins. I guess this comes from
solution a bug where scanning through the song prevented from exaile to
submit songs. Maybe a more elegant solution is possible?
(in any case, at least I can live with the current state)

Next time I'll at the previous place is Monday so I won't bother anyone
with issue till then (using my own player + scrobbler here, also
written in python (and rexx) :-), exaile is used instead of itunes on
mac use at work)

Jack

Revision history for this message
Adam Olsen (arolsen) wrote :

No, the "Now Playing" is submitted at the beginning of playback. That's what you're seeing when it says this:

INFO : Attempting to submit now playing information...
INFO : [AS]: Submitted 'now playing' succesfully

The actual track played information isn't submitted until after track playback stops, and only if the user listened to 240 seconds of the track, or length/2. You can see this in the audioscrobbler plugin, __init__.py:

    def on_stop(self, type, player, track):
        if not track or not track.is_local() \
           or track['playtime'] is None:
            return
        playtime = (track['playtime'] or 0) - \
                (track['__audioscrobbler_playtime'] or 0)
        if playtime > 240 or playtime > float(track['__length']) / 2.0:
            if self.submit and track['__length'] > 30:
                self.submit_to_scrobbler(track,
                    track['__audioscrobbler_starttime'], playtime)

        track['__audioscrobbler_starttime'] = None
        track['__audioscrobbler_playtime'] = None

visibility: private → public
Revision history for this message
Yakov Mindelis (jackitg) wrote :
Download full text (4.8 KiB)

Hi Mathias,

On Wed, 29 Jul 2009, Mathias Brodala wrote:

>
> 1. Fire up a terminal and go to the directory of the audioscrobbler
> plugin (where __init__.py and all the others are located)
>
> 2. Launch the python interactive console
>
> 3. Import _scrobbler
>
> 4. Try _scrobbler.login($username, $password_hash, hashpw=False,
> post_url='http://post.audioscrobbler.com/')
>
> 5. Try _scrobbler.login($username, $password, hashpw=True,
> post_url='http://post.audioscrobbler.com/')
>
> Both 4. and 5. should yield no exceptions.
>
It depend on the network I'm using. At home no problems, at work: (after
modifying default post_url value of login() to have http://):

In [15]: _scrobbler.login("jitg", pw, hashpw=True,
post_url='http://post.audioscrobbler.com/' )
['OK', '7a237448f6a942f58c1ee537c2c4205e',
'http://post.audioscrobbler.com:80/np_1.2',
'http://post2.audioscrobbler.com:80/protocol_1.2', '']

In [16]: _scrobbler.login("jitg", pw, hashpw=True,
post_url='http://post.audioscrobbler.com/' )
['']

In [17]: _scrobbler.login("jitg", pw, hashpw=True)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (105, 0))

---------------------------------------------------------------------------
BadStatusLine Traceback (most recent call
last)

/Users/jack/exaile_bazaar/exaile/plugins/audioscrobbler/<ipython console>
in <module>()

/Users/jack/exaile_bazaar/exaile/plugins/audioscrobbler/_scrobbler.py in
login(user, password, hashpw, client, post_url)
      85 data = urllib.urlencode(values)
      86 req = urllib2.Request("%s?%s" % (url, data) )
---> 87 response = urllib2.urlopen(req)
      88 result = response.read()
      89 lines = result.split('\n')

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in urlopen(url, data)
     122 if _opener is None:
     123 _opener = build_opener()
--> 124 return _opener.open(url, data)
     125
     126 def install_opener(opener):

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in open(self, fullurl, data)
     379 req = meth(req)
     380
--> 381 response = self._open(req, data)
     382
     383 # post-process response

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in _open(self, req, data)
     397 protocol = req.get_type()
     398 result = self._call_chain(self.handle_open, protocol,
protocol +
--> 399 '_open', req)
     400 if result:
     401 return result

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in _call_chain(self, chain, kind, meth_name, *args)
     358 func = getattr(handler, meth_name)
     359
--> 360 result = func(*args)
     361 if result is not None:
     362 return result

/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.pyc
in http_open(self, req)
    1105
    1106 def http_open...

Read more...

Revision history for this message
Xanuricus (aynuryanturin) wrote :

Dear Aren,
Thank you for your advice. The trouble is, the bug still remains
unfixed, which will eventually force me to consider other applications
that can provide the necessary feature, which I don't want to to,
considering Exaile to be a marvelous creation perfectly suited to my
needs but for this nasty bug. For me this bug remains valid, and I have
absolutely no idea where to dig.
Besides, I did provide additional information: no output to the console
during the apparently failed attempt to handshake with
Audioscrobbler.com is a thing to sleep on. Moreover, this means that
this bug is not only OSX-specific, but also affects Zenwalk 6.2
GNU\Linux. Finally, this bug is not only Exaile-specific, I've had the
same issues with Amarok 2.x on my Ubuntu 9.04 distro.
Anyways, I thank you for your attention, and I'd be grateful if you
provided me with any information as to what might help.

Best regards,
Aynur.

Aren Olson wrote:
> Xanuricus, please don't comment on closed bugs (Invalid, WontFix, or
> duplicates) unless you have clear and useful information on the problem.
> "me too" responses are not helpful unless they include additional
> information.
>
>
>> Could you possibly direct me to the page where I can file an improvement suggestion?
>>
> Just file a new bug requesting the feature. Be sure to only suggest one feature (or one set of closely-related features) per bug.
>
>

Revision history for this message
Xanuricus (aynuryanturin) wrote :

I also have problems with audioscrobbler.
GNU\Linux, Zenwalk 6.2, Exaile 0.3.0.2 built from source.
Console output:
Loading Exaile 0.3.0.2...
INFO : Loading settings...

(exaile.py:1575): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstdvdread.so': libdvdread.so.4: невозможно открыть разделяемый объектный файл: Нет такого файла или каталога

(exaile.py:1575): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libresindvd.so': libdvdread.so.4: невозможно открыть разделяемый объектный файл: Нет такого файла или каталога
INFO : Setting up deferred idle manager function...
INFO : Loading plugins...
INFO : Attempting to connect to AudioScrobbler (http://post.audioscrobbler.com/)
INFO : Loading collection...
INFO : Loading devices...
INFO : HAL Providers: [<cd.CDHandler object at 0x8a69d4c>]
INFO : Loading interface...
INFO : Loading main window...
INFO : Loading panels...
INFO : Connecting panel events...
INFO : Connecting main window events...
INFO : Done loading main window...
INFO : Playing file:///mnt/samsung/%D0%9C%D1%83%D0%B7%D1%8B%D0%BA%D0%B0/Summoning/2006%20-%20Oath%20Bound/08%20Land%20of%20the%20dead.mp3
INFO : Playing file:///mnt/samsung/%D0%9C%D1%83%D0%B7%D1%8B%D0%BA%D0%B0/Summoning/2006%20-%20Oath%20Bound/05%20Beleriand.mp3
INFO : Attempting to connect to AudioScrobbler (http://post.audioscrobbler.com/)

-- i.e., no errors, and still no change in my lastfm profile.
Using the repo versions, deleting profiles and settings, recompiling didn't help. The lastfm login and passsword are correct.

I'm very new to Linux, so any guidance would be helpful.

PS. Could you possibly direct me to the page where I can file an improvement suggestion? I'd like to suggest adding a "Verify login" button (and the "Login successful / Login failed" label), like in Banshee and Amarok players, to the Audiscrobbler plugin window. I'd also like to suggest displaying any plugin output / error messages to the Exaile status bar. Thank you.

Revision history for this message
reacocard (reacocard) wrote :

Xanuricus, please don't comment on closed bugs (Invalid, WontFix, or duplicates) unless you have clear and useful information on the problem. "me too" responses are not helpful unless they include additional information.

> Could you possibly direct me to the page where I can file an improvement suggestion?
Just file a new bug requesting the feature. Be sure to only suggest one feature (or one set of closely-related features) per bug.

Revision history for this message
reacocard (reacocard) wrote :

My definition of useful information is "information that leads directly to progress on the bug." I cannot reproduce this myself, so unless you can give me specific instructions on how to make it happen on my system or some hint as to WHY it happens on yours and not mine, its not particularly helpful to actually resolving the bug. I realize not everyone is very good at knowing which information is relevant, but its important that reporter at least try to follow these guidelines, as otherwise the useless comments start to make it hard to actually find the useful information and solve the bug.

Its now fairly clear that this is a different bug than the OP had, despite the similar symptoms. I've opened a new bug to follow this issue, please continue discussion there: https://bugs.launchpad.net/exaile/+bug/499303

btw, your timestamp is messed up and made the order of comments on lp wrong (your latest comment appears 22 hours before mine) - please set your mail program to use the correct time and timezone. Also, please don't include unnecessary quotes when replying to bugs, it makes it harder to find the parts that are actually relevant.

To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.