finch/libgnt/pygnt/example/rss/gntrss.py

Tue, 11 Sep 2007 07:06:00 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Tue, 11 Sep 2007 07:06:00 +0000
branch
sadrul.conv.persistent
changeset 19814
05ce6c570b47
parent 19233
50476028f83f
child 20309
b4984f2ca5d4
permissions
-rw-r--r--

Apparently, if the row-keys don't have a destructor function, things can go
unpredictibly crashy.

19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 #!/usr/bin/env python
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2
19179
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
3 """
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
4 gr - An RSS-reader built using libgnt and feedparser.
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
5
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
6 Copyright (C) 2007 Sadrul Habib Chowdhury <sadrul@pidgin.im>
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
7
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
8 This application is free software; you can redistribute it and/or
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
9 modify it under the terms of the GNU Lesser General Public
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
10 License as published by the Free Software Foundation; either
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
11 version 2.1 of the License, or (at your option) any later version.
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
12
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
13 This application is distributed in the hope that it will be useful,
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
16 Lesser General Public License for more details.
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
17
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
18 You should have received a copy of the GNU Lesser General Public
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
19 License along with this application; if not, write to the Free Software
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
21 USA
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
22 """
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
23
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
24 """
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
25 This file deals with the rss parsing part (feedparser) of the application
b3e5a04d839f Update the license info.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19178
diff changeset
26 """
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
27
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
28 import os
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
29 import tempfile, urllib2
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
30 import feedparser
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
31 import gobject
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
32 import sys
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
33 import time
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
34
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
35 ##
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
36 # The FeedItem class. It will update emit 'delete' signal when it's
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
37 # destroyed.
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
38 ##
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
39 class FeedItem(gobject.GObject):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40 __gproperties__ = {
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41 'unread' : (gobject.TYPE_BOOLEAN, 'read',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
42 'The unread state of the item.',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 False, gobject.PARAM_READWRITE)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
44 }
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
45 __gsignals__ = {
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 'delete' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
47 }
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48 def __init__(self, item, parent):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
49 self.__gobject_init__()
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
50 try:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
51 "Apparently some feed items don't have any dates in them"
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
52 self.date = item['date']
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
53 self.date_parsed = item['date_parsed']
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
54 except:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
55 item['date'] = self.date = time.ctime()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
56 self.date_parsed = feedparser._parse_date(self.date)
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
57
19233
50476028f83f Fix a few small bugs in the example code.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19195
diff changeset
58 self.title = item['title'].encode('utf8')
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
59 self.summary = item['summary'].encode('utf8')
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
60 self.link = item['link']
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
61 self.parent = parent
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
62 self.unread = True
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
63
19814
05ce6c570b47 Apparently, if the row-keys don't have a destructor function, things can go
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19233
diff changeset
64 def __del__(self):
05ce6c570b47 Apparently, if the row-keys don't have a destructor function, things can go
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19233
diff changeset
65 pass
05ce6c570b47 Apparently, if the row-keys don't have a destructor function, things can go
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19233
diff changeset
66
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67 def remove(self):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
68 self.emit('delete', self.parent)
19178
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
69 if self.unread:
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
70 self.parent.set_property('unread', self.parent.unread - 1)
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
71
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
72 def do_set_property(self, property, value):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
73 if property.name == 'unread':
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
74 self.unread = value
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
75
19186
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
76 def mark_unread(self, unread):
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
77 if self.unread == unread:
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
78 return
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
79 self.set_property('unread', unread)
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
80
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
81 gobject.type_register(FeedItem)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
82
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
83 def item_hash(item):
19233
50476028f83f Fix a few small bugs in the example code.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19195
diff changeset
84 return str(item['title'])
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
85
19186
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
86 """
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
87 The Feed class. It will update the 'link', 'title', 'desc' and 'items'
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
88 attributes if/when they are updated (triggering 'notify::<attr>' signal)
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
89
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
90 TODO:
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
91 - Add a 'count' attribute
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
92 - Each feed will have a 'uidata', which will be its display window
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
93 - Look into 'category'. Is it something that feed defines, or the user?
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
94 - Have separate refresh times for each feed.
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
95 - Have 'priority' for each feed. (somewhat like category, perhaps?)
6426c0906fc8 Make the rss-reader look and behave nicer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19179
diff changeset
96 """
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
97 class Feed(gobject.GObject):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
98 __gproperties__ = {
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
99 'link' : (gobject.TYPE_STRING, 'link',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100 'The web page this feed is associated with.',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
101 '...', gobject.PARAM_READWRITE),
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
102 'title' : (gobject.TYPE_STRING, 'title',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
103 'The title of the feed.',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
104 '...', gobject.PARAM_READWRITE),
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
105 'desc' : (gobject.TYPE_STRING, 'description',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
106 'The description for the feed.',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
107 '...', gobject.PARAM_READWRITE),
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
108 'items' : (gobject.TYPE_POINTER, 'items',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
109 'The items in the feed.', gobject.PARAM_READWRITE),
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
110 'unread' : (gobject.TYPE_INT, 'unread',
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
111 'Number of unread items in the feed.', 0, 10000, 0, gobject.PARAM_READWRITE)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
112 }
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
113 __gsignals__ = {
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
114 'added' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
115 }
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
116
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
117 def __init__(self, feed):
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
118 self.__gobject_init__()
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
119 url = feed['link']
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
120 name = feed['name']
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
121 self.url = url # The url of the feed itself
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
122 self.link = url # The web page associated with the feed
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
123 self.desc = url
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
124 self.title = (name, url)[not name]
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
125 self.customtitle = name
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
126 self.unread = 0
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
127 self.items = []
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
128 self.hash = {}
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
129 self.pending = False
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
130 self._refresh = {'time' : 30, 'id' : 0}
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
131
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
132 def do_set_property(self, property, value):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
133 if property.name == 'link':
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
134 self.link = value
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
135 elif property.name == 'desc':
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
136 self.desc = value
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
137 elif property.name == 'title':
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
138 self.title = value
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
139 elif property.name == 'unread':
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
140 self.unread = value
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
141 pass
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
142
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
143 def set_result(self, result):
19178
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
144 # XXX Look at result['bozo'] first, and emit some signal that the UI can use
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
145 # to indicate (dim the row?) that the feed has invalid XML format or something
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
146
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
147 try:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
148 channel = result['channel']
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
149 self.set_property('link', channel['link'])
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
150 self.set_property('desc', channel['description'])
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
151 self.set_property('title', channel['title'])
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
152 items = result['items']
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
153 except:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
154 items = ()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
155
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
156 tmp = {}
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
157 for item in self.items:
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
158 tmp[hash(item)] = item
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
159
19178
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
160 unread = self.unread
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
161 for item in items:
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
162 try:
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
163 exist = self.hash[item_hash(item)]
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
164 del tmp[hash(exist)]
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
165 except:
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
166 itm = FeedItem(item, self)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
167 self.items.append(itm)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
168 self.emit('added', itm)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
169 self.hash[item_hash(item)] = itm
19178
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
170 unread = unread + 1
952bf9cb471d A few updates to the rss reader.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19176
diff changeset
171
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
172 if unread != self.unread:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
173 self.set_property('unread', unread)
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
174
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
175 for hv in tmp:
19233
50476028f83f Fix a few small bugs in the example code.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19195
diff changeset
176 self.items.remove(tmp[hv])
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
177 tmp[hv].remove()
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
178 "Also notify the UI about the count change"
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
179
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
180 self.pending = False
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
181 return False
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
182
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
183 def refresh(self):
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
184 if self.pending:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
185 return
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
186 self.pending = True
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
187 FeedReader(self).run()
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
188 return True
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
189
19189
d72a994ca5ac Make things look nice in both 80x25 and in large screens.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19186
diff changeset
190 def mark_read(self):
d72a994ca5ac Make things look nice in both 80x25 and in large screens.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19186
diff changeset
191 for item in self.items:
d72a994ca5ac Make things look nice in both 80x25 and in large screens.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19186
diff changeset
192 item.mark_unread(False)
d72a994ca5ac Make things look nice in both 80x25 and in large screens.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19186
diff changeset
193
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
194 def set_auto_refresh(self, auto):
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
195 if auto:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
196 if self._refresh['id']:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
197 return
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
198 if self._refresh['time'] < 1:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
199 self._refresh['time'] = 1
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
200 self.id = gobject.timeout_add(self._refresh['time'] * 1000 * 60, self.refresh)
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
201 else:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
202 if not self._refresh['id']:
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
203 return
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
204 gobject.source_remove(self._refresh['id'])
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
205 self._refresh['id'] = 0
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
206
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
207 gobject.type_register(Feed)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
208
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
209 """
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
210 The FeedReader updates a Feed. It fork()s off a child to avoid blocking.
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
211 """
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
212 class FeedReader:
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
213 def __init__(self, feed):
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
214 self.feed = feed
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
215
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
216 def reap_child(self, pid, status):
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
217 result = feedparser.parse(self.tmpfile.name)
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
218 self.tmpfile.close()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
219 self.feed.set_result(result)
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
220
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
221 def run(self):
19192
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
222 self.tmpfile = tempfile.NamedTemporaryFile()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
223 self.pid = os.fork()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
224 if self.pid == 0:
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
225 tmp = urllib2.urlopen(self.feed.url)
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
226 content = tmp.read()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
227 tmp.close()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
228 self.tmpfile.write(content)
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
229 self.tmpfile.flush()
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
230 # Do NOT close tmpfile here
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
231 os._exit(os.EX_OK)
2e645328b90a Use pseudo-nonblocking stuff to update the feeds.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19191
diff changeset
232 gobject.child_watch_add(self.pid, self.reap_child)
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
233
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
234 feeds = []
19195
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
235 urls = (
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
236 {'name': '/.',
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
237 'link': "http://rss.slashdot.org/Slashdot/slashdot"},
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
238 {'name': 'KernelTrap',
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
239 'link': "http://kerneltrap.org/node/feed"},
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
240 {'name': None,
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
241 'link': "http://pidgin.im/rss.php"},
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
242 {'name': "F1",
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
243 'link': "http://www.formula1.com/rss/news/latest.rss"},
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
244 {'name': "Freshmeat",
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
245 'link': "http://www.pheedo.com/f/freshmeatnet_announcements_unix"},
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
246 {'name': "Cricinfo",
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
247 'link': "http://www.cricinfo.com/rss/livescores.xml"}
f1aaa37a842a Add support for auto-refreshing. There should be some way to change the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19192
diff changeset
248 )
19175
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
249
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
250 for url in urls:
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
251 feed = Feed(url)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
252 feeds.append(feed)
d6cea4e8560f A proof-of-conecpt RSS reader using pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
253

mercurial