38 |
self._feed.channel_description = parsed.description |
self._feed.channel_description = parsed.description |
39 |
self._feed.channel_copyright = parsed.copyright |
self._feed.channel_copyright = parsed.copyright |
40 |
self._feed.channel_link = parsed.link |
self._feed.channel_link = parsed.link |
|
self._feed.channel_subscriptions_location = parsed.subscriptions |
|
|
self._feed.channel_blogroll_location = parsed.blogroll |
|
|
self._feed.channel_blink = parsed.blink |
|
41 |
self._feed.channel_creator = parsed.creator |
self._feed.channel_creator = parsed.creator |
42 |
parsed.items.reverse() |
parsed.items.reverse() |
43 |
self._feed.add_items(parsed.items) |
self._feed.add_items(parsed.items) |
56 |
# if we don't get the images, we can probably still show |
# if we don't get the images, we can probably still show |
57 |
# the text |
# the text |
58 |
pass |
pass |
|
if (len(self._feed.channel_blogroll_location)): |
|
|
self._wait_subscriptions = 1 |
|
|
bc = ExtrasConsumer(self.blogroll_success, self.blogroll_fail) |
|
|
straw.URLFetch.connection_manager.request(self._feed.channel_blogroll_location, bc) |
|
|
if (len(self._feed.channel_subscriptions_location)): |
|
|
sc = ExtrasConsumer(self.subscriptions_success, self.subscriptions_fail) |
|
|
straw.URLFetch.connection_manager.request(self._feed.channel_subscriptions_location, sc) |
|
59 |
self.update_process_status() |
self.update_process_status() |
60 |
|
|
61 |
def set_error(self, error): |
def set_error(self, error): |
71 |
del self._wait_images[signal.url] |
del self._wait_images[signal.url] |
72 |
self.update_process_status() |
self.update_process_status() |
73 |
|
|
|
def blogroll_success(self, data): |
|
|
self._feed.channel_blogroll = data |
|
|
self._wait_blogroll = 0 |
|
|
self.update_process_status() |
|
|
|
|
|
def blogroll_fail(self, exception): |
|
|
self._wait_blogroll = 0 |
|
|
self.update_process_status() |
|
|
|
|
|
def subscriptions_success(self, data): |
|
|
self._feed.channel_subscriptions = data |
|
|
self._wait_subscriptions = 0 |
|
|
self.update_process_status() |
|
|
|
|
|
def subscriptions_fail(self, exception): |
|
|
self._wait_subscriptions = 0 |
|
|
self.update_process_status() |
|
|
|
|
74 |
def update_process_status(self): |
def update_process_status(self): |
75 |
length_images = len(self._wait_images) |
length_images = len(self._wait_images) |
76 |
if self._wait_data or length_images or self._wait_subscriptions or self._wait_blogroll: |
if self._wait_data or length_images or self._wait_subscriptions or self._wait_blogroll: |
77 |
self._feed.process_status = self._feed.STATUS_POLLING |
self._feed.process_status = self._feed.STATUS_POLLING |
78 |
else: |
else: |
79 |
self._feed.process_status = self._feed.STATUS_IDLE |
self._feed.process_status = self._feed.STATUS_IDLE |
|
|
|
|
class ExtrasConsumer: |
|
|
def __init__(self, cb_success, cb_fail): |
|
|
self.cb_success = cb_success |
|
|
self.cb_fail = cb_fail |
|
|
|
|
|
def http_results(self, status, headers, data): |
|
|
if status[1] == 200: |
|
|
self.cb_success(data) |
|
|
|
|
|
def http_failed(self, exception): |
|
|
self.cb_fail(exception) |
|