Re: [Rhythmbox-devel] How to access RB.LibraryBrowser from Python

Hi everyone,

Just a quick follow up to my previous emails. In case anyone is interested, I've finally finished my RatingFilters plugin. You can download a copy from the Rhythmbox third party plugins page. I think it's relatively bug-free, but feel free to drop me an email if you spot any problems.

Happy filtering!

All the best,

On Fri, Feb 1, 2013 at 12:02 AM, Donagh Horgan <donagh horgan gmail com> wrote:
Hi Jonathan,

Thanks for your email, and apologies for my late reply - I've been really busy with college work lately. I wanted to know how to use the RB.BrowserSource for an idea I had for a rating filter plugin for Rhythmbox (I'll get to this in a bit). Long story short, I found some time during the week to sit down and have a think about it week and realised I'd taken a rather hamfisted approach to the problem I was trying to tackle. I've since tried a new approach and everything seems to be working now - no need to tap into the RB.BrowserSource after all... I'm going to bug test it for a few more days and, after, I'll post download links on the Rhythmbox third party plugins page.

I'll try to give a brief explanation of the whys and hows of a rating filter: I have lots of automatic playlists (e.g. 1960s Music, Recently Added, Recently Played), and I often want to listen to either my favourite tracks or some random unrated tracks from those playlists. This could be, for instance, all the unrated tracks from my 1990s Music playlist (when I'm in the mood to listen to something new), or favourites I've recently played (when I'm not). Sure, I could go create a load of automatic playlists, but it's laborious, and if I wanted to listen to my favourite Bowie tracks, or my favourite Bjork tracks, etc, I'd have to create a new playlist for each artist, and clutter up my playlists tree. To appease my inner pedant, I decided I'd try to code up a rating filter. Rather than add a new column to the library browser (not that I have any idea how to do this), I thought it would be cleaner to add three self-explanatory buttons to the bar above the browser: Favourites, Unrated and All. I reasoned that this would meet most people's needs, without cluttering up the display too much:

Inline image 1

Hopefully, my layout and spelling choices won't offend too many people. If you enable the plugin, the new buttons appear in the main music library and on manual and automatic playlists. You can also set the threshold for determining what rating constitutes a favourite using the plugin preferences manager. I count anything greater than or equal to four stars, but it's probably a controversial opinion.

As usual, I'm standing on the shoulders of giants and owe an enormous code debt to all the other plugin developers and John Jetmore for his Python bindings documentation.

All the best, from an overly self-satisfied Python amateur,

On Sat, Jan 12, 2013 at 8:26 AM, Jonathan Matthew <jonathan d14n org> wrote:
On Sat, Jan 5, 2013 at 8:47 AM, Donagh Horgan <donagh horgan gmail com> wrote:
Hi all,

I've been reading the unofficial Rhythmbox 2.97 Python documentation here, but I'm a bit stumped on how to access the output-model property of the RB.LibraryBrowser from the shell (assuming that it's actually possible in the first place)? You might need to do this, for example, if you wanted to manually update an RB.EntryView for a source based on some selections made in the RB.LibraryBrowser of that source.

Sources based on RB.BrowserSource use the output model of the browser as the source query model, so you can get at it using source.props.query_model. The browser is an implementation detail of the source, and you generally shouldn't need to do anything to it, though.  What do you intend to do to the entry view, and why do you need the model to do that?
The documentation mentions a notify signal for the output-model property, but I've no idea how to connect to this either (or whether the callback comes with the query model I'm after).

Whenever a property on a GObject changes, it emits a signal named "notify", with the property name as the signal detail. So, for the output-model property on a browser object, you'd do browser.connect("notify::output-model", callback).

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]