Re: [Rhythmbox-devel] List of all podcasts and their items via Python plugin
- From: "Jonathan Matthew" <notverysmart gmail com>
- To: rhythmbox-devel gnome org
- Subject: Re: [Rhythmbox-devel] List of all podcasts and their items via Python plugin
- Date: Mon, 19 May 2008 08:58:53 +1000
On Mon, May 12, 2008 at 9:22 AM, Matej Cepl <mcepl redhat com> wrote:
> Hi, could anybody point me to the way how to get %subj%? Even
> after studying
> http://live.gnome.org/RhythmboxPlugins/WritingGuide I didn't grok
> the way how to do it. Could anybody help me (with an example if
> possible), please?
With some trial and error in the python console:
# get all podcast feeds
def process_podcast(feed, data):
print "feed: " + db.entry_get(feed, rhythmdb.PROP_LOCATION)
db.entry_foreach_by_type(db.entry_type_get_by_name("podcast-feed"),
process_podcast, None)
# create query matching entries from a particular podcast,
# based on the podcast feed URL
q = db.query_new()
db.query_append(q, (rhythmdb.QUERY_PROP_EQUALS,
rhythmdb.PROP_TYPE,
db.entry_type_get_by_name("podcast-post"),
rhythmdb.QUERY_PROP_EQUALS,
rhythmdb.PROP_SUBTITLE,
"http://some-podcast.com"))
# create a query model based on the query
qm = db.query_model_new(q)
d.do_full_query_parsed(qm, q)
# process each entry:
def process_entry(model, path, iter, data):
(entry,) = model.get(iter, 0)
print "entry: " + db.entry_get(entry, rhythmdb.PROP_LOCATION)
qm.foreach(process_entry, None)
It probably isn't a good idea to do the query from the
entry_foreach_by_type callback, but it might work..
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]