Unknown URI of song

Bug #380151 reported by Milan Knizek
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rhythmbox Playlist Synchronizer
Fix Committed
Critical
Kevin Mehall

Bug Description

Sync functionality of your script looks promising, however it does not work for me yet - Jaunty amd64

$ ./sync /media/HTC-MK8G/
/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/rhythmbox.py:57: RuntimeWarning: tempnam is a potential security risk to your program
  fname=os.tempnam()
Traceback (most recent call last):
  File "./sync", line 13, in <module>
    core.run_config(r, sys.argv[1])
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/core.py", line 55, in run_config
    c, r=compare_dir(l, fullpath, change_name)
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/core.py", line 18, in compare_dir
    n=i.dest_name(change_name).encode()
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/rhythmbox.py", line 31, in dest_name
    return "%s - %s.mp3"%(self.get_artist(), self.get_title())
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/rhythmbox.py", line 21, in get_artist
    return self.get_props()['artist']
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/rhythmbox.py", line 14, in get_props
    self.props=self.source.rbshell.getSongProperties(self.uri())
  File "/var/lib/python-support/python2.6/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/var/lib/python-support/python2.6/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/var/lib/python-support/python2.6/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.GLib.UnmappedError.RbShellError.Code0: Neznámé URI skladby: file://%23EXTM3U

$ cat /media/HTC-MK8G/.sync-config
Test Music, test, --abr 96

$ ls -la /media/HTC-MK8G/Test\ Music
total 64
drwx------ 2 modeluser root 32768 May 25 08:00 .
drwx------ 15 modeluser root 32768 May 25 08:00 ..

The "test" playlist has just one song.

Revision history for this message
Kevin Mehall (kevin-mehall) wrote :

Confirmed this on Jaunty: rhythmbox now puts a comment at the top of the M3U file, which was interpreted as an invalid song URI

The script now properly ignores M3U comments.

Update your bzr branch, and it should work. Thanks for letting me know about this issue.

Changed in rhythmbox-playlist-sync:
assignee: nobody → Kevin Mehall (kevin-mehall)
importance: Undecided → Critical
status: New → Fix Committed
Revision history for this message
Milan Knizek (knizek) wrote :

Thanks for a quick reaction. I got a bit further now, but the script still fails: it cannot find the playlist "test".

$ ./sync /media/HTC-MK8G
Traceback (most recent call last):
  File "./sync", line 13, in <module>
    core.run_config(r, sys.argv[1])
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/core.py", line 53, in run_config
    l=source.get_rhythmbox_playlist(playlist)
  File "/home/modeluser/src/rhytmbox_sync/rhythmbox-playlist-sync/rhythmbox.py", line 59, in get_rhythmbox_playlist
    self.rbplaylistmgr.exportPlaylist(name, 'file:///'+fname, True)
  File "/var/lib/python-support/python2.6/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/var/lib/python-support/python2.6/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/var/lib/python-support/python2.6/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.GLib.UnmappedError.RbPlaylistManagerError.Code2: Neznámý seznam skladeb: test

$ cat /home/modeluser/.local/share/rhythmbox/playlists.xml
<?xml version="1.0"?>
<rhythmdb-playlists>
  <playlist name="P&#x159;ehr&#xE1;vat frontu" type="queue"/>
  <playlist name="Ned&#xE1;vno p&#x159;ehran&#xE9;" type="automatic" sort-key="LastPlayed" sort-direction="1">
    <conjunction>
      <equals prop="type">song</equals>
      <subquery>
        <conjunction>
          <current-time-within prop="last-played">604800</current-time-within>
        </conjunction>
      </subquery>
    </conjunction>
  </playlist>
  <playlist name="Ned&#xE1;vno p&#x159;idan&#xE9;" type="automatic" sort-key="FirstSeen" sort-direction="1">
    <conjunction>
      <equals prop="type">song</equals>
      <subquery>
        <conjunction>
          <current-time-within prop="first-seen">604800</current-time-within>
        </conjunction>
      </subquery>
    </conjunction>
  </playlist>
  <playlist name="Nejl&#xE9;pe hodnocen&#xE9;" type="automatic" sort-key="Rating" sort-direction="1">
    <conjunction>
      <equals prop="type">song</equals>
      <subquery>
        <conjunction>
          <greater prop="rating">4.000000</greater>
        </conjunction>
      </subquery>
    </conjunction>
  </playlist>
  <playlist name="test" type="static">
    <location>file:///media/Data/Various_01/Music/Abba%20-%20Master%20Series/Abba%20-%2004%20-%20One%20Of%20Us.mp3</location>
  </playlist>
</rhythmdb-playlists>

Revision history for this message
Kevin Mehall (kevin-mehall) wrote :

I've seen that error if Rhythmbox isn't already running when the script is run. DBUS auto-launches Rhythmbox, but doesn't always give it time to load its playlists. Not sure if that's a DBUS/Rhythmbox bug.

I should probably add code to preemptively check for Rhythmbox and launch it if necessary first, or something, but for now the workaround is to have it running first. Hopefully that helps.

Revision history for this message
Milan Knizek (knizek) wrote :

You are right, running Rhythmbox before the script helped.

One more topic - syncing fails with files having brackets () in the file names. (The URI is unknown then.)

I guess these characters are valid for both linux and vfat filesystems. Would it be possible to correct it?

Revision history for this message
Milan Knizek (knizek) wrote :

Ye, the script also does not like &

Revision history for this message
Milan Knizek (knizek) wrote :

And a comma ,

I have not tested others, these are just the once in my playlist which caused the failure.

Revision history for this message
Kevin Mehall (kevin-mehall) wrote :

Huh. Rhythmbox apparently doesn't want () escaped in its URIs (but does want [] escaped!)

Try the latest revision in bzr.

Revision history for this message
Kevin Mehall (kevin-mehall) wrote :

I'm in the process of fixing & and ,

I'll do more comprehensive testing to find others.

Revision history for this message
Kevin Mehall (kevin-mehall) wrote :

Found that
()@,&$!~' are not escaped
#[]<>?" are escaped

(just documenting this here, in case someone else trying to use the Rhythmbox DBUS api needs this)

I couldn't find any documentation from Rhythmbox on this, so there are probably more cases where it's broken, but these are fixed in bzr now.

Revision history for this message
Liron Tal (liricooli) wrote :

Hi Kevin,
I've opened a bug in Rhythmbox here:
https://bugs.launchpad.net/ubuntu/+source/rhythmbox/+bug/815129

if you have any more information on this issue please comment in the bug.

Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.