Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no notifications on new updates to old posts #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def load_revision():
# Application Settings
APP_ID = 'FeedNotifier'
APP_NAME = 'Feed Notifier'
APP_VERSION = '2.6'
APP_VERSION = '2.6.1'
APP_URL = 'http://www.feednotifier.com/'
USER_AGENT = '%s/%s +%s' % (APP_ID, APP_VERSION, APP_URL)
DEFAULT_POLLING_INTERVAL = 60 * 15
Expand Down
9 changes: 6 additions & 3 deletions feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def cmp_timestamp(a, b):

def create_id(entry):
keys = ['id', 'link', 'title']
values = tuple(util.get(entry, key, None) for key in keys)
values = list(util.get(entry, key, None) for key in keys)
pubDate_value = util.get_pubDate(entry, None) # Default should be None
values.append(pubDate_value)
values = tuple(values)
return values if any(values) else uuid.uuid4().hex

class Item(object):
Expand Down Expand Up @@ -131,9 +134,9 @@ def poll(self, timestamp, filters):
self.id_list.append(id)
self.id_set.add(id)
item = Item(self, id)
item.timestamp = calendar.timegm(util.get(entry, 'date_parsed', time.gmtime()))
item.title = util.format(util.get(entry, 'title', ''), settings.POPUP_TITLE_LENGTH)
item.description = util.format(util.get(entry, 'description', ''), settings.POPUP_BODY_LENGTH)
item.timestamp = util.get_pubDate(entry, time.gmtime())# Default should be current time
item.link = util.get(entry, 'link', '')
item.author = util.format(util.get(entry, 'author', '')) # TODO: max length
if all(filter.filter(item) for filter in filters):
Expand Down Expand Up @@ -272,4 +275,4 @@ def clear_feed_cache(self):
logging.info('Clearing feed caches')
for feed in self.feeds:
feed.clear_cache()

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name="Feed Notifier"
type="win32"
/>
<description>Feed Notifier 2.6</description>
<description>Feed Notifier 2.6.1</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
Expand Down
15 changes: 12 additions & 3 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re
import time
import calendar
import base64
import calendar
import urllib2
Expand Down Expand Up @@ -70,7 +71,15 @@ def get_top_window(window):
def get(obj, key, default):
value = obj.get(key, None)
return value or default


def get_pubDate(obj, default):
value = get(obj, 'published_parsed', None)
if value == None:
value = get(obj, 'updated_parsed', default)# Default None for create_id , Default current_time for timestamp
if not value == None :
value = calendar.timegm(value)
return value or default

def abspath(path):
path = os.path.abspath(path)
path = 'file:///%s' % path.replace('\\', '/')
Expand Down Expand Up @@ -143,7 +152,7 @@ def guess_polling_interval(entries):
return settings.DEFAULT_POLLING_INTERVAL
timestamps = []
for entry in entries:
timestamp = calendar.timegm(get(entry, 'date_parsed', time.gmtime()))
timestamp = calendar.timegm(get(entry, 'published_parsed', time.gmtime()))
timestamps.append(timestamp)
timestamps.sort()
durations = [b - a for a, b in zip(timestamps, timestamps[1:])]
Expand Down Expand Up @@ -260,4 +269,4 @@ def format(text, max_length=400):
text.append('[...]')
text = ' '.join(text)
return text