Closed facetoe closed 8 years ago
First of all: You may know it already, but rhythmbox debugging can be done by specifying -d
or -D <search term>
on the command line.
Can you confirm that indeed the time (duration of the song) is missing from the XML by manually downloading the XML that the plugin gets? You can glean the URI from the output of the rhythmbox-ampache plugin (rhythmbox -D rhythmbox-ampache
). That would be very strange and probably an error in ampache.
Next: From your limited output I understand that rhythmbox is trying to play your song by using an XML decoder. That, of course, doesn't make any sense. It should be a media decoder of some sort. Can you debug rhythmbox again and try to find the play URI that rhythmbox tries to play, download that URI manually (through a browser) and have a look at it?
The plugin itself doesn't play anything but hands a URI to rhythmbox. My suspicion is that that URI is wrong for some reason.
Thanks for the quick response @lotan. Here is an example XML snippet where the time
element is empty:
<song id="837">
<title>01 Vicarious.mp3</title>
<artist id="12"/>
<album id="108">Music</album>
<url>https://facetoe.com.au/owncloud/apps/music/ampache/server/xml.server.php?action=play&filter=837&auth=...</url>
<time/>
<track/>
<size>0</size>
<art/>
<rating>0</rating>
<preciserating>0</preciserating>
</song>
Although now the error is being thrown on the track element:
(18:42:59) [0x19ca210] [AmpacheBrowser.songs_downloaded_cb] /usr/lib/rhythmbox/plugins/ampache/AmpacheBrowser.py:568: parse chunk _songs[0]...
Traceback (most recent call last):
File "/usr/lib/rhythmbox/plugins/ampache/AmpacheBrowser.py", line 302, in songs_downloaded_cb
parser.feed(contents)
File "/usr/lib/python3.5/xml/sax/expatreader.py", line 210, in feed
self._parser.Parse(data, isFinal)
File "/build/python/src/Python-3.5.1/Modules/pyexpat.c", line 468, in EndElement
File "/usr/lib/python3.5/xml/sax/expatreader.py", line 325, in end_element
self._cont_handler.endElement(name)
File "/usr/lib/rhythmbox/plugins/ampache/AmpacheBrowser.py", line 158, in endElement
self.__track = int(self.__text)
ValueError: invalid literal for int() with base 10: ''
<song id="847">
<title>00 - Bob Dylan - All Along The Watchtower</title>
<artist id="14">Bob Dylan</artist>
<album id="111">Best Of</album>
<url>https://facetoe.com.au/owncloud/apps/music/ampache/server/xml.server.php?action=play&filter=847&auth=...</url>
<time>152</time>
<track/>
<size>0</size>
<art/>
<rating>0</rating>
<preciserating>0</preciserating>
</song>
If I paste the URL into a web browser it plays fine. It's likely my Ampache is all messed up, I'm using ownCloud and have been pulling my hair out all day. Not sure if it's worth modifying the plugin if my Ampache is serving up invalid XML...
This is strange indeed.
I guess I should change the XML parsers to accept tags without any values (or default values where no value is not an option) in order to make the plugin more robust.
Let me think about whether I want to make those changes. A patch would be welcome.
It could well be that owncloud is not set up properly as I haven't received similar error reports before and I've seen people using owncloud before.
As to why the song doesn't play: I didn't mean for you to check the value of the URL tag but the URI that rhythmbox uses to play the song as per rhythmbox's debug output. Lines like:
(15:28:07) [0x2861040] [state_change_finished] rb-player-gst.c:438: setting new playback URI https://myserver.net:443/ampache/play/index.php?ssid=ab6bf1ab6b0a4b7c29d5492a69ab6a6b&type=song&oid=27810&uid=3&player=api&name=test.flac
or
(15:28:08) [0x2861040] [playing_stream_cb] rb-shell-player.c:2512: new playing stream: https://myserver.net:443/ampache/play/index.php?ssid=ab6bf1ab6b0a4b7c29d5492a69ab6a6b&type=song&oid=27810&uid=3&player=api&name=test.flac
Then compare that with the URL tag or try to find out why it's not working.
I can verify I'm seeing the same issue on Fedora 24.
(15:11:23) [0x558efbac7f60] [rb_statusbar_sync_status] rb-statusbar.c:297: updating status with: 'Download songs from Ampache server...', '', 0.000000
(15:11:24) [0x558efbac7f60] [sync_window_settings] rb-shell.c:1924: paned position 160
(15:11:24) [0x558efbac7f60] [sync_window_settings] rb-shell.c:1931: right_paned position 955
(15:11:24) [0x558efbac7f60] [sync_window_settings] rb-shell.c:1938: sidebar paned position 300
(15:11:26) [0x558efbac7f60] [rb_audioscrobbler_should_handshake] rb-audioscrobbler.c:839: No username set
(15:11:26) [0x558efbac7f60] [rb_audioscrobbler_should_handshake] rb-audioscrobbler.c:839: No username set
(15:11:28) [0x558efbac7f60] [rb_statusbar_page_status_changed_cb] rb-statusbar.c:334: source status changed
(15:11:28) [0x558efbac7f60] [rb_statusbar_page_status_changed_cb] rb-statusbar.c:334: source status changed
Traceback (most recent call last):
File "/usr/lib64/rhythmbox/plugins/ampache/AmpacheBrowser.py", line 285, in songs_downloaded_cb
parser.feed(contents)
File "/usr/lib64/python3.5/xml/sax/expatreader.py", line 210, in feed
self._parser.Parse(data, isFinal)
File "/builddir/build/BUILD/Python-3.5.1/Modules/pyexpat.c", line 468, in EndElement
File "/usr/lib64/python3.5/xml/sax/expatreader.py", line 325, in end_element
self._cont_handler.endElement(name)
File "/usr/lib64/rhythmbox/plugins/ampache/AmpacheBrowser.py", line 134, in endElement
self.__track = int(self.__text)
ValueError: invalid literal for int() with base 10: ''
Example of XML without time:
<song id='4643'>
<title>.1 - The Spy Hunter.ogg</title>
<artist id='323'></artist>
<album id='935'>Songs To Burn Your Bridges By</album>
<url>[[redacted]]</url>
<time></time>
<track></track>
<size>0</size>
<art></art>
<rating>0</rating>
<preciserating>0</preciserating>
</song>
I'm also using owncloud 9.
Right. I'm still not quite sure whether it makes sense to import a song without artist information, run time and the file's name as title. @vwbusguy, did you try and configure ampache in your owncloud to have more meaningful API content?
In the spirit of "be liberal in what you accept" I'd argue that runtime and filename could be empty in the XML.
Ok guys, I've made a change to the SongsParser, checking whether any of the tags has content before assigning it. Feel free to test and I'd be grateful for feedback.
i had a similar problem, i noticed that i had urls with ssid= instead of auth= after.
in apps/music/middleware/ampachemiddleware.php
i changed:
$token = $this->request['auth'];
to:
if (isset($this->request['auth'])) $token = $this->request['auth'];
else $token = $this->request['ssid'];
now its streaming :)
what i do not understand is that in cache/rhythmbox/ampache/_songs.xml the song urls have auth= instead of ssid=
Sorry, I can't help you with that. _songs.xml only writes to file what it receives from the Ampache server. You can confirm that by downloading the request (as seen in the rhythmbox debug output) in a browser. The result should be identical.
the thing is rhythmbox-ampache/AmpacheBrowser.py replaces auth= for ssid=, but ssid= does not work with owncloud it expects "auth="
so you say we need to change owncloud?
No, I won't say that.
Looking at the Ampache XML API:
https://github.com/ampache/ampache/wiki/XML-API
this aspect has changed. Now there's no mention of ssid
anymore.
Unfortunately, I can't see a hint that they have changed the version of the API. Could you please check the version of the handshake response you're getting (by downloading the handshake request (as seen in the rhythmbox debug output), the
If you have a version later than mine I can add a condition to return auth
instead of ssid
after a certain version.
<version>350001</version>
using latest nextcloud with Music app version 0.3.11
Ok, that's odd.
My pure Ampache installation shows:
<api>380001</api>
I don't know what to think about that...
In my code I used to change ssid|auth
to ssid
as you rightly discovered.
I don't know anymore why I did that. Maybe it was uninteded.
I now changed the behaviour to keep the authentication parameter name, whichever it was before, and hope I'm not breaking other people's setup.
@brrrrrrrt I'd be grateful if you could try it out and tell me if the change is working for you.
just tried with the updated plugin, works great! (without hacking the owncloud app)
Great. Thanks for letting me know!
thank you for the fix!
i also hope it still works for others :dancers:
Hi, I'm unable to play the songs that are displayed with the Ampache plugin. I get the following error in the console when I try:
I had to patch the plugin as my
time
elements are empty and it was causing a crash - https://github.com/lotan/rhythmbox-ampache/compare/master...facetoe:master.Any idea what's causing this? I'm running Arch Linux and have all the gstreamer plugins installed:
Any help would be greatly appreciated!