コード例 #1
0
ファイル: core.py プロジェクト: moonranger/feedonkey
    def read_feeds(self):
        """read the feeds and their latest update time"""
        if not os.path.exists(FEED_LIST_FILE):
            log.warn("feeds.list not found")
            return ([], None)

        histories = {}
        if os.path.exists(HISTORY_FILE):
            for parts in line_token_iterator(HISTORY_FILE):
                histories[parts[0]] = float(parts[1])

        feeds = []
        for parts in line_token_iterator(FEED_LIST_FILE, support_comment=True):
            total_parts = len(parts)
            url = parts[0]
            filter = total_parts > 1 and parts[1] or '.*'

            try:
                last_update_time = histories[url]
            except KeyError, e:
                last_update_time = None
                pass

            if last_update_time == None and total_parts > 2:
                try:
                    tmp_time_struct = datetime.strptime(parts[2], INTERNAL_DATE_FORMAT).timetuple()
                    last_update_time = time.mktime(tmp_time_struct)
                except ValueError, e:
                    log.error('invalid date: %s' % parts[2], e)
                    pass
コード例 #2
0
ファイル: notify.py プロジェクト: moonranger/feedonkey
def show_notification_msg(title, msg):
    """show a notification message"""
    try:
        import pynotify
        if pynotify.init("Feed Donkey"):
            n = pynotify.Notification(title, msg, 'stock_view-details')
            n.show()
    except Exception, e:
        log.warn('pynotify is not installed on this machine, notification off')