Bug 485415 - Login to last.fm doesn't work if amarok is run with --debug
Summary: Login to last.fm doesn't work if amarok is run with --debug
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Services/Last.fm (other bugs)
Version First Reported In: 2.9.71
Platform: Kubuntu Linux
: NOR normal
Target Milestone: kf5
Assignee: Tuomas Nurmi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 07:48 UTC by robert marshall
Modified: 2024-04-12 11:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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