Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampache api always returning empty contents with amarok #854

Closed
aleixq opened this issue May 4, 2021 · 4 comments
Closed

Ampache api always returning empty contents with amarok #854

aleixq opened this issue May 4, 2021 · 4 comments

Comments

@aleixq
Copy link

aleixq commented May 4, 2021

Amarok player always adds the "limit=0" when fetching the collection via ampache. And when limit=0 is there ampache endpoint returns

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <total_count>0</total_count>
</root>

Testing the same with curl happens the same.

curl "https://example.com/apps/music/ampache/server/json.server.php?auth=xxxxxxxxxxx&action=artists&limit=1&filter=django"
[]

Not checking the type when testing if 0 in

private static function validateLimitOrOffset($value) : ?int {
solves the issue:


        private static function validateLimitOrOffset($value) : ?int { 
                //print_r(strval($value) == 0? "zero":"nozero"); 
-                if (\ctype_digit(\strval($value)) && $value !== 0) { 
+               if (\ctype_digit(\strval($value)) && $value != 0) {
                        return \intval($value);
                } else {
                        return null;
                }
        }
@paulijar
Copy link
Collaborator

paulijar commented May 5, 2021

Okay, thanks for digging. I feel that Amarok is at fault here, as the Ampache API documentation does not state that the value limit=0 would have any special purpose, instead of being interpreted literally. What it does say, is that limit=none could be used to unset the limit. But as the real Ampache server seems to disregard also the 0 limit arguments, I guess we need to follow.

Btw, are you using the Linux version of Amarok? Because I have never managed to make the Windows version of the app connect my cloud. It seems to communicate with a malformed URL. I suspect that this is because the Win version has not been updated for ages (it's still 2.8.0 which was apparently released in 2013).

@aleixq
Copy link
Author

aleixq commented May 5, 2021

That's right Pauli, sorry for not reading the note about limit in ampache api docs... So I guess that this bug must be enqueued in amarok bugtracker...

About the amarok version I use: Yes it's the last linux version (2.9.71) , and It's working fine with nc music ampache api.
I came to the good and old amarok because I cannot find any desktop player that connects to ampache in gnu/linux... But is just to inspect a good ampache client implementation to look for ideas to create a new ampache/subsonic player using kde's kirigami.

Thank's Pauli It can be closed .

paulijar added a commit that referenced this issue May 8, 2021
This is how the "real" Ampache server works, too, although this is not
documented in the current API specification for v4 or v5 API. The Amarok
player uses this argument value, and there should be no real-life case where
the client actually would want to have 0 interpreted as literal value of the
limit.

Furthermore, the Music app already tried to interpret zero as "unlimited" but
this worked only with integer 0 and not with string "0". Whether the numeric
arguments come as strings or integers, depends on the details of the hosting
cloud, and may differ between versions of ownCloud and Nextcloud.

refs #854
@paulijar
Copy link
Collaborator

paulijar commented May 8, 2021

No reason to be sorry. The whole point of the $value !== 0 check was anyway to allow using the argument limit=0 to specify "no limit" but it didn't now work as intended. It will be fixed in the next Music app release.

@paulijar
Copy link
Collaborator

The fix for this problem has now been released in Music v1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants