lotan / rhythmbox-ampache

Rhythmbox plugin to stream music from Ampache
GNU General Public License v2.0
21 stars 7 forks source link

Handshake response: g-io-error-quark: Operation not supported (15) #16

Closed megamaced closed 6 years ago

megamaced commented 7 years ago

Hi,

Trying to hook up with an Owncloud Music Ampache server https://github.com/owncloud/music

user@computer:~/workspace/rhythmbox-ampache> rhythmbox -D ampache
(16:12:01) [0x1f27500] [AmpacheBrowser.update] /usr/lib64/rhythmbox/plugins/ampache/AmpacheBrowser.py:922: downloading handshake:  https://domain.co.uk/index.php/apps/music/ampache/server/xml.server.php?action=handshake&auth=edcff5bdd2c4d10049009bc4152413ea7e9318be48977649401abbf10253e83d&timestamp=1510157521&user=user@domain.co.uk&version=350001
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Rhythmbox popup says:

Handshake response: g-io-error-quark: Operation not supported (15)
lotan commented 6 years ago

I'm so sorry for not replying earlier, github didn't notify me by email.

If you are still interested:

Can you try the email shown in your logs in a browser:

https://domain.co.uk/index.php/apps/music/ampache/server/xml.server.php?action=handshake&auth=edcff5bdd2c4d10049009bc4152413ea7e9318be48977649401abbf10253e83d&timestamp=1510157521&user=user@domain.co.uk&version=350001

... and look at what's coming back?

As your request was quite a while ago, your auth will probably have run out (depending on your configuration). You may have to run rhythmbox again and generate a new URI.

The idea is that an information.xml file is generated that contains meta information about your library.

The content looks like:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
    <auth><![CDATA[...]]></auth>
    <api><![CDATA[380001]]></api>
    <session_expire><![CDATA[...]]></session_expire>
    <update><![CDATA[...]]></update>
    <add><![CDATA[...]]></add>
    <clean><![CDATA[...]]></clean>
    <songs><![CDATA[...]]></songs>
    <albums><![CDATA[...]]></albums>
    <artists><![CDATA[...]]></artists>
    <playlists><![CDATA[...]]></playlists>
    <videos><![CDATA[...]]></videos>
    <catalogs><![CDATA[...]]></catalogs>

</root>

The ... should represent the data of your library.

Can you verify that that's the case?

moretocome commented 6 years ago

I'm sorry for hijacking the issue, but I am in a similar situation trying to make rhythmbox-ampache connect to Owncloud Music Ampache server and I seem to have the same issue. Did you manage to solve it @megamaced ?

@lotan I see the same errors as megamaced mentions.

If I call https://mycloud.mydomain.org/apps/music/ampache/server/xml.server.php?action=handshake&auth=4f8510bcbbcdd2b625f1fce61cf1e4bcb710ad30a51e86f0fc20ec2f6dd02a0c&timestamp=1518952645&user=[username]&version=350001 in a browser, I see information.xml with the right content:

<root>
  <auth>[removed-sesitive-value]</auth>
  <version>350001</version>
  <update>2018-02-18T11:17:47+00:00</update
  <add>2018-02-18T11:17:47+00:00</add>
  <clean>2018-02-18T11:17:47+00:00</clean>
  <songs>1016</songs>
  <artists>466</artists>
  <albums>454</albums>
  <playlists>0</playlists>
  <session_expire>2018-02-18T12:57:47+00:00</session_expire>
  <tags>0</tags>
  <videos>0</videos>
</root>

which I guess is the correct response.

The original rhythmbox-ampache dev addressed a similar issue here stating:

I'd say you're suffering from something similar to this:

http://blogs.gnome.org/danni/2011/03/16/quick-tip-gtk_show_uri-operation-not-supported/

Check that gvfs and glib is installed and contains the necessary modules for your ampache uri.

But I am not sure how to check "that gvfs and glib is installed and contains the necessary modules for your ampache uri"

Any help will be greatly appreciated and thanks under all circumstances for reviving the plugin :)

lotan commented 6 years ago

The comment you mentioned is so unspecific, because glib is split into different modules and has a few dependencies. On top of that, each distribution packages it differently. I'm running Arch Linux and some of the relevant packages are:

core/glib2 2.54.3+2+g94b38beff-1
extra/glib-networking 2.54.1-1
extra/python-gobject 3.26.1-1
extra/libsoup 2.60.3-1

I hope that helps you finding the missing parts or a wrong version.

megamaced commented 6 years ago

@moretocome no not working

@lotan

I get this back

<root>
<auth>9e891c14d89269bc05943911351f6ec2</auth>
<version>350001</version>
<update>2018-02-18T22:48:14+00:00</update>
<add>2018-02-18T22:48:14+00:00</add>
<clean>2018-02-18T22:48:14+00:00</clean>
<songs>8304</songs>
<artists>362</artists>
<albums>821</albums>
<playlists>0</playlists>
<session_expire>2018-02-19T00:28:14+00:00</session_expire>
<tags>0</tags>
<videos>0</videos>
</root>
lotan commented 6 years ago

I did some research.

The problematic call seems to be: https://github.com/lotan/rhythmbox-ampache/blob/master/AmpacheBrowser.py#L553

The corresponding c call has been in glib for about 10 years and before that some time in gio. https://github.com/GNOME/glib/blame/master/gio/gfile.h#L1194

That leaves PyGObject. I'm a bit at a loss as to when exactly that functionality was added, but I would argue similarly to issue #15. Try to make sure to use at least version 2.15.

Can you please check which version you have installed?

moretocome commented 6 years ago

Thanks a lot for your efforts @lotan :)

My distro is Linux Mint 18.3. My installed packages are:

libglib2.0-0 2.48.2-0ubuntu1
glib-networking 2.48.2-1~ubuntu16.04.1
python-gobject 3.20.0-0ubuntu1
libsoup2.4-1 2.52.2-1ubuntu0.2
lotan commented 6 years ago

Hmm... On first glance, this looks OK. All of the packages reasonably new. I'll have to setup and test myself. Thanks for the infos.

megamaced commented 6 years ago

I tried it again, this time using openSUSE Tumbleweed. Using Tumbleweed I don't get the g-io-error-quark anymore, but rhythmbox just segfaults and dies instead. Let me know if you need some log

lotan commented 6 years ago

Do you have log output for suse for me?

lotan commented 6 years ago

So I did some test on Linux Mint 18.3 from osboxes.org (https://www.osboxes.org/linux-mint/). Unfortunately, I wasn't able to reproduce your problems:

rhythmbox-log.ampache.txt

I entered URI, username and password:

screenshot from 2018-02-26 02-45-06 2

All the songs and playlists loaded:

screenshot from 2018-02-26 02-44-39 2

I had an error at the very end:

screenshot from 2018-02-26 02-42-47

but I didn't follow up, because everything seemed to work.

For comparison: Here is the list (apt list --installed) of the Linux Mint 18.3 from osboxes.org. Maybe you spot a crucial difference?

Sorry for not being able to help more.

moretocome commented 6 years ago

I do remember doing something stupid at some point, that gave me problems with connecting to sftp/dav-servers and similar. I guess I will have to try and reinstall.

You are providing free, open source software without charge, and you have already done more than enough to try and help me solve my particular problem. If all open source dev were only half as supportive as you ...

Thank you very much for your time and effort! :1st_place_medal: :)

lotan commented 6 years ago

@moretocome: Shame, I'm sorry to hear that. Good luck with the reinstall.

wagnered commented 6 years ago

HI,

I'm a developer on the Ampache project and installed Rythmbox/Rythmbox Ampache to try to duplicate an issue a user has with the Ampache XML API.

I'm assuming the label "password(key)" in the preference dialog means that the API key can be used. I added the URL and my API key and got the same message as @megamaced,

So I started Rythmbox with the -D ampache switch and saw:

192.168.2.3//server/xml.server.php?action=handshake&auth=0feeb81e6c61d421fb6eb62cad3d24eea7fae0dfe0bb00af73abcfbf58fbcfb9&timestamp=1527886302&user=&version=350001

That is not the key I entered in the preference dialog. What's there looks like it was encrypted with the timestamp even though I did not enter a username.

Also, even with the username blank, it is included in the url but shouldn't be for accessing with the API key. Nor should the timestamp be included when using the API key. So maybe, the "Password(key)" label doesn't mean API key. :smile:

I still will probably get the same popup because I did try entering my username and account password and got it. My system is Fedora 27.

Regards,

lotan commented 6 years ago

@wagnered: I'm not quite sure I understand everything you're saying. Do I understand correctly that instead of user/password you'd like to enter the auth string directly? And you would like to do that by entering it into the 'password (key)' field and omitting the user?

And did entering username/password of your account work in the end?

Omitting the user= argument when there is no user seems the right thing to do and I'll change that asap.

wagnered commented 6 years ago

@lotan You wrote:

Do I understand correctly that instead of user/password you'd like to enter the auth string directly? And you would like to do that by entering it into the 'password (key)' field and omitting the user?

Ampache allows the use of the user's unique API key which is generated by the administrator. I noticed that when running rhythmbox -D ampache the auth did not look anything like the API key I entered. It appears that the API key might have been processed with a time stamp. It shouldn't be.

Also, per the example in the wiki, when using the API version of the handshake URL, the user name is not not included and shouldn't be added because it appears to confuse the logic.

And did entering username/password of your account work in the end?

I didn't actually try it yet but I will as I would like to continue with the Ampache issue that I am currently working on. :smile:

wagnered commented 6 years ago

Now I tried it and no success.

I get the same error as @megamaced

Handshake response: g-io-error-quark: Operation not supported (15)

And only the "downloading handshake" line on the CLI, nothing else.

So I did some test on Linux Mint 18.3 from osboxes.org (https://www.osboxes.org/linux-mint/). Unfortunately, I wasn't able to reproduce your problems:

So it seems to be specific to some Linux distributions?

lotan commented 6 years ago

What is specific is, on the one hand, the location of the plugins files and on the other hand the dependencies for rhythmbox. If I understand correctly, the error message g-io-error-quark: Operation not supported (15) points to functionality that is not available, either due to a 'plugin' library that is not installed (e.g. libsoup) or a version of glib that doesn't provide this functionality yet.

lotan commented 6 years ago

Would you be so kind as to test this version of AmpacheBrowser.py and see if your requirements above are fulfilled?

https://github.com/lotan/rhythmbox-ampache/blob/apikey_auth/AmpacheBrowser.py

To test it, you can just copy it over the current one in your <lib>/rhythmbox/plugins/ampache folder, where <lib> is the library path in your distribution - often /usr/lib64.

wagnered commented 6 years ago

Sorry to say, that after copying AmpacheBrowser.py to /rhythmbox/plugins/ampache the plug in no longer loaded.

The debug messages were:

rhythmbox:22281): libpeas-WARNING : Error loading plugin 'ampache' (rhythmbox:22281): libsoup-CRITICAL : soup_server_run_async: assertion 'priv->legacy_iface != NULL' failed.

I know very little about Python, but I'll help in whatever way I can.

lotan commented 6 years ago

Are there any other error messages regarding the ampache plugin? No line number that failed?

Can you copy the master version of the file over the non-working one? https://github.com/lotan/rhythmbox-ampache/blob/master/AmpacheBrowser.py

... and see if it works again? Were you actually working on the newest version or some older one?

wagnered commented 6 years ago

Were you actually working on the newest version or some older one?

There is no version number in the scripts that I could find, so I installed the master version from your repository and I am back to start: incorrect API key seen in debug URL :smile:

lotan commented 6 years ago

Ok, now copy over the AmpacheBrowser.py from branch 'apikey_auth'.

https://github.com/lotan/rhythmbox-ampache/blob/apikey_auth/AmpacheBrowser.py

Alternatively you could have installed everything from branch 'apikey_auth'.

wagnered commented 6 years ago

Same errors as above. [EDIT] meaning the plugin won't load.

Gotta run some errands. I'll get back to it shortly.

wagnered commented 6 years ago

I am assuming that you have an Ampache installation to try it on and are successful. If so, could I have a missing Python module?

If you don't have an Ampache installation, I have a demo setup with username/password as guest/guest. The music collection is "Creative Commons".

lotan commented 6 years ago

Sorry to hear that. I do have ampache running and it works at least as far as the handshake request here. The changes are quite few and not including any new python modules.

You didn't answer my last question on further debug output w/r to ampache plug in.

wagnered commented 6 years ago

Sorry, I've been going in circles trying to assist Ampache users with their issues and finally found out that I've been starting rhythmbox with -D ampache instead of -D Ampache. The only debug output I see is:

[0x55babadd2350] [AmpacheBrowser.update] AmpacheBrowser.py:944: downloading handshake: 192.168.2.3/server/xml.server.php?action=handshake&auth=4ffe179174961089c68b4dfc2619ee7b&version=350001

That is the correct API key. Does the 944 indicate the line number or what? The file doesn't have 944 lines :smile:

lotan commented 6 years ago

It seems you just entered the server IP address. What you need is a URI. At the very least prepend a protocol (probably http:// or https://).

I can't tell you what the number means. I'm only printing from 'downloading [...]' in the plugin. If you're interested, I'd look in the libpeas source code.

wagnered commented 6 years ago

It seems you just entered the server IP address

Thank you for noticing that, I'm so used to the web browser only needing the ip to automatically form the URL and with things being so hectic yesterday...

But yes it is now working with with the user's API key.

Thanks again for adding this method of accessing Ampache.

That's probably why it didn't work with the username/password earlier :flushed:

wagnered commented 6 years ago

if you're interested, I'd look in the libpeas source code.

Not necessary, those messages seemed to show up even with the Ampache plugin removed.

lotan commented 6 years ago

I also guess that that was the reason. Glad it worked.

ilmagico commented 2 years ago

Ok, I know this is an old issue, but I'm still seeing this, both with my nextcloud instance (via Music app, as in original comment) as well as with the official ampache demo server: https://demo.ampache.dev/

I'm running this under Manjaro, full OS updated a few days ago. Is this plugin still supported/actively developed, and if so, can this be looked at again?

lotan commented 2 years ago

Hi ilmagico, to be honest, I'm not using the plugin anymore and there has been no development for a while. My best advice to you is to enable rhythmbox debugging and open the URLs in a browser to see where the problem lies. See comments above on how to do that. You're welcome to post any findings in this issue and I'll have a look to see whether I can help.

ilmagico commented 2 years ago

Oh, I already looked, the issue is the following call (line 696):

                ampache_server_file.load_contents_async(
                        Gio.Cancellable(),
                        handshake_cb,
                        parser)

The call immediately fails as "Operation not supported" (and calls the handshake_cb callback, which reports the error), no data is sent over the network at all, I checked with wireshark. It seems to me whatever operation that triggers, it's not supported by ... something. Do I need to install an additional library? Enable some kernel option? not sure.

lotan commented 2 years ago

load_contents_async() is part of GIO which is part of GObject. Can you check whether GObject is installed for the Python version that you're using.