Re: [Rhythmbox-devel] How to add an entry to a source?
- From: Jonathan Matthew <jonathan d14n org>
- To: rhythmbox-devel gnome org
- Subject: Re: [Rhythmbox-devel] How to add an entry to a source?
- Date: Thu, 6 May 2010 06:53:46 +1000
On Thu, May 6, 2010 at 4:48 AM, Jannik Heller <scrawl baseoftrash de> wrote:
> This is maybe a stupid question, but how can I add an entry to a
> BrowserSource created in a Python Plugin? In the C doc i found
> rb_source_add_uri (), but there doesnt seem to be a Python equivalent on
> this one.
A browser source will automatically display all entries of the entry
type it is given on construction. So, what you need to do is to create
a new database entry. I'd suggest looking at the jamendo and magnatune
plugins, however..
> I also searched the web and looked at the Jamendo/Magnatune plugins, but
> i have no clue!
The relevant part of the Jamendo plugin is
JamendoSaxHandler.endElement, which does this (more or less):
entry = self.__db.entry_new(self.__entry_type, track_url)
self.__db.set(entry, rhythmdb.PROP_ARTIST, self.__data["artist"]["name"])
self.__db.set(entry, rhythmdb.PROP_ALBUM, self.__data["album"]["name"])
self.__db.set(entry, rhythmdb.PROP_TITLE, self.__data["track"]["name"])
self.__db.set(entry, rhythmdb.PROP_TRACK_NUMBER,
int(self.__data["track"]["numalbum"]))
self.__db.set(entry, rhythmdb.PROP_DATE, date)
self.__db.set(entry, rhythmdb.PROP_GENRE, albumgenre)
self.__db.set(entry, rhythmdb.PROP_DURATION, duration)
self.__db.commit()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]