Re: [Rhythmbox-devel] Saving Import Errors

On Sun, 2009-01-11 at 14:29 -0600, Duncan McGreggor wrote:
> On Sun, 2009-01-11 at 19:30 +1000, Jonathan Matthew wrote:
> > On Sat, Jan 10, 2009 at 03:23:35PM -0600, Duncan McGreggor wrote:
> > > Hey everyone,
> > > 
> > > I spent a couple of hours today digging around in the RB Python console
> > > looking for an object that would give me access to the list of files
> > > that show up in my import errors (~400 songs) so that I could save them
> > > to disk.
> > > 
> > > 1) Is there a better way to do this?
> > > 
> > > 2) If not, can someone point me to the right object? and method
> > > call(s)/parameters?
> > 
> > I'd suggest locating the import errors source in the source list, then
> > iterating the contents of its query model.
> Hrm, that's what I'd tried to do, but was unable to find it. I thought
> that maybe the import errors source wasn't exposed in the Python code.
> I'll have another look. If I still can't find it, I'll a concise Python
> console session (I don't read C, so looking through the .c files has
> only been helpful at the most intuitive level).

Okay, it looks like I found the import errors... but I can't get the
data out of any objects. Here's how I got them:

source_list = shell.get_property("sourcelist")
library, playlists = source_list.get_property("model")
sources = library.iterchildren()
import_errors = [x for x in sources if x[2] == "Import Errors"][0]

Or, if you prefer something more legible:

for child in library.iterchildren():
  x, pixbuf, name, source, pango_attrs, y, z, enum = child
  if name == "Import Errors":
    import_errors = source

x, pixbuf, name, source, pango_attrs, y, z, enum = import_errors
query_model = source.get_property("query-model")

The number of elements in qm matches the number of import errors, so
that checks out. The following gives me a list of the entries
(RhythmDBEntry instances):

[entry for entry, count in query_model]

However, I have not been able to get actual data from these objects.
Each entry object has three methods (copy, get_entry_type,
get_playback_uri), but when I execute the following:

[entry.get_playback_uri() for entry, count in query_model]

I get a long list of "None"s.

What am I missing? I'd like to get the full path name for each file with
errors, as it is presenting in the rhythmbox UI. What do I need to do?



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