Re: [Rhythmbox-devel] db.entry_get changes for plugins



This is the way i've found, I'm facing the same problem:

    def some_method()
        return self.get_value(entry, RB.RhythmDBPropType.ENTRY_ID)


    def get_value(self, entry, property_type):

        t = self.db.get_property_type(property_type)
        value = GObject.Value()
        value.init(t)
        
        self.db.entry_get(entry, property_type, value)
        
        if t.name == 'gulong':
            return value.get_ulong()
            
        elif t.name == 'gchararray':
            return value.get_string()
            
        elif t.name == 'gboolean':
            return value.get_boolean()
            
        elif t.name == 'gboxed':
            return value.get_boxed()
            
        elif t.name == 'gchar':
            return value.get_char()
            
        elif t.name == 'gdouble':
            return value.get_double()
            
        elif t.name == 'genum':
            return value.get_enum()
            
        elif t.name == 'gflags':
            return value.get_flags()
            
        elif t.name == 'gfloat':
            return value.get_float()
            
        elif t.name == 'gint':
            return value.get_int()
            
        elif t.name == 'gint64':
            return value.get_int64()
            
        elif t.name == 'glong':
            return value.get_long()
            
        elif t.name == 'gobject':
            return value.get_object()
            
        elif t.name == 'gparam':
            return value.get_param()
            
        elif t.name == 'gpointer':
            return value.get_pointer()
            
        elif t.name == 'gstring':
            return value.get_string()
            
        elif t.name == 'guchar':
            return value.get_uchar()
            
        elif t.name == 'guint':
            return value.get_uint()
            
        elif t.name == 'guint64':
            return value.get_uint64()
            
        elif t.name == 'gvariant':
            return value.get_variant()
            
        else:
            self.warning('Unknown type %s' % t.name)
            return None


There sure is a better way to do it, but this one is working right now

https://bitbucket.org/jimcerberus/rhythmweb/src/1aecaaf32892/rbhandle/entry.py



On Thu, Nov 24, 2011 at 9:03 AM, Lachlan <lachlan 00 gmail com> wrote:
So now that Debian testing is running git versions of Rhythmbox I've
been updating my plugin.

So far i have it activating and the menu items are populating which is
awesome, now i just have to work out functionality

from what i've found on the net it should be changing from one line to
the next one:
self.db.entry_get(db_entry, rhythmdb.PROP_ALBUM)
self.db.entry_get(db_entry, RB.RhythmDBPropType.ALBUM)

When i run this though i get told that entry_get() takes 4 arguments (3 given)

I think this has to do with self.db but i'm unsure about where to check.

Lachlan
_______________________________________________
rhythmbox-devel mailing list
rhythmbox-devel gnome org
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel



--
Pablo Carranza


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