Bug 831594

Summary: can't register a new lastfm session
Product: [Fedora] Fedora Reporter: Karel Volný <kvolny>
Component: qmmpAssignee: Karel Volný <kvolny>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: 17CC: gbcox, kvolny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-13 13:34:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Volný 2012-06-13 11:48:02 UTC
Description of problem:
After activationg the scrobbler plugin and choosing to register a new session, the session id is not saved.
Manually copying the id from the authorization request URL and storing it in the configfuration doesn't help.

Version-Release number of selected component (if applicable):
qmmp-0.5.5

How reproducible:
always

Additional info:
see bug #828257

Comment 1 Karel Volný 2012-06-13 13:34:15 UTC
after all, it looks like PEBKAC combined with last.fm service outage/unresponsiveness

also, there is a problem with saving settings from the configuration dialogue which contributes to the problem, see below, but that is out of scope here ...

from the commandline:

1) delete the session key from ~/.qmmp/qmmp.rc so that it reads:

[Scrobbler]
use_lastfm=true
lastfm_session=
use_librefm=false
librefm_login=
librefm_password=

2) run qmmp, let it play something

3) as the session key is empty, qmmp calls getToken which queries m_server (ws.audiosrobbler.com) for the API token, using qmmp API key and hardcoded (!) SECRET

4) the contents of the reply should be printed at the console like:

Scrobbler2[lastfm]: token: 397c072c10fa4667f4e51663fdd790ab

then openUrl is called with the API_KEY and the received token which opens the authorization request in your preset browser

5) after two minutes qmmp calls getSession which asks for the session key

6) when it receives the reply, it prints it at the console:

Scrobbler2[lastfm]: name: kavol
Scrobbler2[lastfm]: key: your_key_as_a_long_hex_number___
Scrobbler2[lastfm]: subscriber: 0

if it receives a known error, it either re-requests the session or the token, otherwise it gives up completely (until restarted)

7) *after* the song is finished when the new one is started, it submits the song and sends now playing notification

Scrobbler2[lastfm]: submit request
===== metadata ======
ARTIST = Glenn Miller
TITLE = A String Of Pearls
ALBUM = The Swing Aera
COMMENT = 
GENRE = 
YEAR = 
TRACK = 8
== end of metadata ==
Scrobbler2[lastfm]: submited 1 song(s)
Scrobbler2[lastfm] sending notification
Scrobbler2[lastfm]: Now-Playing notification done

8) close qmmp, check ~/.qmmp/qmmp.rc - now it should have the session key stored:

lastfm_session=your_key_as_a_long_hex_number___

- note that it is stored only on regular quit

there is

            QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
            settings.setValue("Scrobbler/lastfm_session", m_session);

right after printing the reply (step 6) - but it seems that the file is not written immediately, then when you open the configuration dialogue the session key is lost (it is not re-read from the file; and it cannot be as the file is not saved yet)

so do not touch the scrobbler configuration dialogue in the process of registering new session, just close qmmp to have the key stored (compare the configfile with the console output)

after restarting qmmp, you can now see the session key also in the scrobbler configuration dialogue

Comment 2 Gerald Cox 2012-06-15 05:47:03 UTC
Thanks for the explanation... working for me now also...