[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok-bugs-dist
Subject:    [amarok] [Bug 327547] Last.fm Invalid session key error not handled: scrobbles silently lost until a
From:       <kiwiiii () gmail ! com>
Date:       2013-11-18 0:37:51
Message-ID: bug-327547-71684-6lauWvCYmH () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=327547

--- Comment #2 from kiwiiii@gmail.com ---
It's not easy to reproduce the issue: I can't just let my amarok process not
used for two weeks..

In this example of liblastfm they explain a little more the error handling:
https://github.com/lastfm/liblastfm/blob/master/demos/demo2.cpp

private slots:
    void onWsError( lastfm::ws::Error e )
    {
        // QNetworkReply will invoke this slot on application level errors
        // mostly this is only stuff like Ws::InvalidSessionKey and
        // Ws::InvalidApiKey    
        qWarning() << e;
    }


From the liblastfm code (XmlQuery.cpp):
    if ( d->error.enumValue() != lastfm::ws::NoError )
    {
        qDebug() << bytes;

        switch ( d->error.enumValue() )
        {
            case lastfm::ws::OperationFailed:
            case lastfm::ws::InvalidApiKey:
            case lastfm::ws::InvalidSessionKey:
                // NOTE will never be received during the LoginDialog stage
                // since that happens before this slot is registered with
                // QMetaObject in App::App(). Neat :)
                QMetaObject::invokeMethod( qApp, "onWsError", Q_ARG(
lastfm::ws::Error, d->error.enumValue() ) );
                break;
            default:
                //do nothing
            break;
        }
    }



And finally from Amarok git master: 
- no onWsError, this explains the log "QMetaObject::invokeMethod: No such
method App::onWsError(lastfm::ws::Error)".
- no InvalidSessionKey, so the error code isn't properly handled, so the issue
is probably still there.
- error handling in src/services/lastfm/ScrobblerAdapter.cpp only returns a
generic error in scrobble(), and logs a warning in slotScrobblesSubmitted().
This hasn't changed much since tag v2.7.1.

In liblastfm (Audioscrobbler.cpp) the api error code is set via
mTrack.setScrobbleError(), so we could check for that in
ScrobblerAdapter::slotScrobblesSubmitted(), and restart the session there.
Or we could add onWsError to avoid the warning anyway.
liblastfm keeps the tracks in its cache when a temporary error like that
happens, so we only need to do a submit() again after the re-authentication.

Maybe other parts of amarok that use liblastfm could gain from that too.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Amarok-bugs-dist mailing list
Amarok-bugs-dist@kde.org
https://mail.kde.org/mailman/listinfo/amarok-bugs-dist
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic