After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 516407 - Extend Rhythmbox DBus Interface
Extend Rhythmbox DBus Interface
Status: RESOLVED OBSOLETE
Product: rhythmbox
Classification: Other
Component: Programmatic interfaces
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks: 510127
 
 
Reported: 2008-02-14 10:15 UTC by John Stowers
Modified: 2018-05-24 13:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Rhythmbox plugin to export a DBus interface to Conduit (9.69 KB, application/x-gzip)
2008-03-13 00:23 UTC, Alexandre Rosenfeld
  Details
generic tree model iterator interface (3.33 KB, application/xml)
2008-05-24 02:19 UTC, Jonathan Matthew
  Details
source list iteration interface (501 bytes, application/xml)
2008-05-24 02:21 UTC, Jonathan Matthew
  Details
interface for rhythmdb query models (2.38 KB, application/xml)
2008-05-24 02:24 UTC, Jonathan Matthew
  Details
sample dbus clients (10.00 KB, application/x-compressed-tar)
2008-05-24 02:28 UTC, Jonathan Matthew
  Details
okay (80.30 KB, patch)
2008-07-27 06:26 UTC, Jonathan Matthew
needs-work Details | Review

Description John Stowers 2008-02-14 10:15:13 UTC
Hiya,

I discussed this briefly at linux.conf.au.

For Conduit [1] to play nicer with Rhythmbox, and to start to experiment with music sync to various things, it would be good if the RB DBus interface had the following methods;
 * List all playlists (dynamic and static)
 * List the contents of said playlists
 * Return the information about a track (i.e. extra information that cannot be got from the file, such as play counts, rating, etc)
 * (optional) Arbitary searches on the DB
 * The ability to add an arbitary (local) URI to the DB, with a flag to 'import to music directory' or not [2]
 * (optional) The ability to set information on a track (rating, play counts, art, etc)

Currently Conduit primitively supports RB by parsing its static playlists. I would like to improve this situation.

[1] http://www.conduit-project.org
[2] Probbably related to bug #323247
Comment 1 Alexandre Rosenfeld 2008-03-13 00:22:05 UTC
Hi,

I wanted to copy my music from Rhythmbox to my iPod through Conduit, so I implemented some of the missing parts, including accessing Rhythmbox through DBus. Because I already knew Python and how to do a plugin for Rhythmbox in Python, I implemented it as a plugin in Python.

This is implemented:

 * List all playlists (dynamic and static)
 * List the contents of said playlists
 * Return the information about a track (i.e. extra information that cannot be
got from the file, such as play counts, rating, etc)

The last one might require a better interface. Right now, any information stored in the db can be retrieved, if you know it's name to rhythmbox (most properties are very easy, but I should document a way to find all availiable properties)

Half-implemented:

 * (optional) Arbitary searches on the DB

This is implemented as a Title and Artist search. It should be improved to support all the other ways to search that Rhythmbox supports.

 * (optional) The ability to set information on a track (rating, play counts,
art, etc)

This is implemented but I've never tested it and thus I have disabled the code. I dont want to take it lightly, I have to test all possible situations.

Not implemented:

 * The ability to add an arbitary (local) URI to the DB, with a flag to 'import
to music directory' or not [2]

I'm not sure I can do this with Python. I'll take a look at it later.

Another thing I've been working on, is a Data Source for Conduit that would use this DBus interface. I've been able to create a source that automatically appears when Rhythmbox is open, and disappears when Rhythmbox is closed, and is able to synchronize any playlist with supporting sinks. I've done a few tests and it worked very well for me so far. But I've done some changes that are not working now. I'll try to post it in a few days.

This is a bit off-topic, but I've implemented the iPod Music Two-Way and I've been able to sync my Rhythmbox playlists with my iPod. I'll try to finish it up and post all my changes later on.
Comment 2 Alexandre Rosenfeld 2008-03-13 00:23:56 UTC
Created attachment 107193 [details]
Rhythmbox plugin to export a DBus interface to Conduit
Comment 3 Alexandre Rosenfeld 2008-03-13 00:25:47 UTC
Comment on attachment 107193 [details]
Rhythmbox plugin to export a DBus interface to Conduit

This should be extracted to ~/.gnome2/rhythmbox/plugins/
Comment 4 John Stowers 2008-03-13 01:07:57 UTC
This is totally awesome! 

Please attach the conduit specific changes to bug #510127
Comment 5 Jonathan Matthew 2008-05-24 02:15:54 UTC
The entry ID that you're using there isn't stable.  Entry IDs are assigned starting from 1 on startup in the order that entries are loaded from the database file or imported (or otherwise created), so you can't rely on them to identify the same entry across rhythmbox restarts.  Also, what is googecode.com?

In other news, I've started working on full built-in dbus interfaces for the source list and for rhythmdb query models, implementing the first three things on the list in comment 0 (the last two are already available).  I'll attach the interface definitions and some sample programs that demonstrate the concepts so far, and once I've sorted out a few more details, I'll attach patches that implement it all.
Comment 6 Jonathan Matthew 2008-05-24 02:19:43 UTC
Created attachment 111442 [details]
generic tree model iterator interface

This interface allows a dbus client to iterate the contents of a tree model.  The usage pattern: the client locates the model object (source list, library, etc.), calls a method on it to get an iterator, uses the iterator to access the contents of the model, and then disposes of the iterator.
Comment 7 Jonathan Matthew 2008-05-24 02:21:18 UTC
Created attachment 111443 [details]
source list iteration interface

This interface allows clients to create iterators for the source list.  It will be available at a well-known object path (/org/gnome/Rhythmbox/SourceList, probably).
Comment 8 Jonathan Matthew 2008-05-24 02:24:01 UTC
Created attachment 111444 [details]
interface for rhythmdb query models

This provides basic information about the query model contents (total size, number of entries, duration), creates iterators, and emits dbus signals when the model changes.  Since signal emission is potentially expensive, it only happens when a reference owner requests it.
Comment 9 Jonathan Matthew 2008-05-24 02:28:35 UTC
Created attachment 111445 [details]
sample dbus clients

These demonstrate iterating the source list and the library query model (the means of accessing that is only temporary, though), and watching the library query model for changes.

Using the GetBatch method with batches of 100 or so, I can retrieve a small set of properties about each of the ~14000 entries in my library in under 2 seconds.  Retrieving one row at a time, this takes about 14 seconds.
Comment 10 Alexandre Rosenfeld 2008-05-27 07:26:50 UTC
Thanks a lot for taking a look at this. A built-in DBus interface would be much better then my plugin. 

I looked at the examples, and it seems it mirrors the internal tree structure in the DBus interface? 
If I want to only list the Playlist source, should I rely on it's name (or it's class name, as you seem to use it one time)?

I want to try it out, does it require more code in Rhythmbox, or is it just the interfaces? Do I need anything in the makefiles to include the interfaces?

It would be just perfect if this could be included in the next Rhythmbox version. If there is anything I can do to help it, let me know.
Comment 11 Jonathan Matthew 2008-05-28 00:01:58 UTC
I've only attached the interfaces that I'm reasonably sure of so far.  No code yet because not enough of the pieces actually fit together yet.

To find playlist sources, you could use sourcelist.GetIterGroup("playlists"), then iterate the children from the resulting iterator.  So far, there's no way to get at the query model for a given source, though.
Comment 12 Jonathan Matthew 2008-07-27 06:26:28 UTC
Created attachment 115360 [details] [review]
okay

This is apparently where I was up to last time I was hacking on this.  I also have a half-implemented interface for rhythmdb itself, which includes creation of new query models and various entry-editing things.
Comment 13 Jonathan Matthew 2010-06-25 07:51:03 UTC
This ancient bitrotten patch needs to be rewritten to use GDBus.  I'm not going to add any new dbus-glib code at this point.
Comment 14 GNOME Infrastructure Team 2018-05-24 13:11:23 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/513.