Bug 485415

Summary: Login to last.fm doesn't work if amarok is run with --debug
Product: [Applications] amarok Reporter: robert marshall <robert>
Component: Services/Last.fmAssignee: Tuomas Nurmi <tuomas>
Status: RESOLVED FIXED    
Severity: normal CC: sam, tuomas
Priority: NOR    
Version First Reported In: 2.9.71   
Target Milestone: kf5   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description robert marshall 2024-04-12 07:48:13 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
If amarok is run `amarok --debug` then if the last.fm plugin is already enabled the connection is not made. 


If you go to the plugin and try 'Test Login' it times out. If amarok is run without the debug switch it connects and tests ok 



SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Comment 1 Tuomas Nurmi 2024-04-12 08:52:43 UTC
Ok, found the reason. The normal hostname for last.fm API calls is ws.audioscrobbler.com, but in liblastfm, src/ws.cpp, lastfm::ws::host():
    QStringList const args = QCoreApplication::arguments();
    if (args.contains( "--debug"))
        return "ws.staging.audioscrobbler.com";

which is apparently not functional (anymore?).
Comment 2 robert marshall 2024-04-12 10:19:03 UTC
Yes, I see there's an open PR https://github.com/lastfm/liblastfm/pull/37
Comment 3 Tuomas Nurmi 2024-04-12 11:45:15 UTC
Git commit 4533d9c8f60457a0e4f70a6c0d3bd97ca689514b by Tuomas Nurmi.
Committed on 12/04/2024 at 11:45.
Pushed by nurmi into branch 'master'.

Add workaround to enable last.fm debugging.

liblastfm checks QCoreApplication::arguments() for "--debug". That's not
easy to avoid, so add a synonym debug flag "--debug-last-fm" which has identical
functionality in Amarok, but doesn't trigger the non-functional last.fm debug
mode.

This is not pretty, but it is pretty contained and makes reasonable last.fm
bughunting possible. Should https://github.com/lastfm/liblastfm/pull/37 ever
get merged, this commit can be reverted, but that might not happen anytime soon
as the PR has been pending for 4 years and latest liblastfm release was almost
10 years ago.

M  +2    -0    src/App.cpp
M  +1    -1    src/main.cpp

https://invent.kde.org/multimedia/amarok/-/commit/4533d9c8f60457a0e4f70a6c0d3bd97ca689514b