diff --git a/.gitignore b/.gitignore index 771da14..e742b02 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ celerybeat-schedule* config.py venv *.egg-info +*.pyc \ No newline at end of file diff --git a/woodwind/models.py b/woodwind/models.py index 3432ec7..fd5d091 100644 --- a/woodwind/models.py +++ b/woodwind/models.py @@ -109,7 +109,7 @@ class Feed(db.Model): last_pinged = db.Column(db.DateTime) def get_feed_code(self): - return binascii.hexlify(self.feed.encode()) + return self.feed # binascii.hexlify(self.feed.encode()) def get_or_create_push_secret(self): if not self.push_secret: diff --git a/woodwind/tasks.py b/woodwind/tasks.py index ce7515a..ecc49e0 100644 --- a/woodwind/tasks.py +++ b/woodwind/tasks.py @@ -19,8 +19,8 @@ import sys import time import urllib.parse -config = FlaskConfig('/home/kmahan/projects/woodwind') -config.from_pyfile('/home/kmahan/projects/woodwind.cfg') +config = FlaskConfig('/srv/www/kylewm.com/woodwind') +config.from_pyfile('woodwind.cfg') # normal update interval for polling feeds UPDATE_INTERVAL = datetime.timedelta(hours=1) @@ -38,8 +38,6 @@ VIDEO_ENCLOSURE_TMPL = '

' logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -logger.addHandler(logging.StreamHandler(sys.stdout)) engine = sqlalchemy.create_engine(config['SQLALCHEMY_DATABASE_URI']) @@ -118,7 +116,9 @@ def update_feed(feed_id, content=None, is_polling=True): for entry in result: old = session.query(Entry)\ .filter(Entry.feed == feed)\ - .filter(Entry.uid == entry.uid).first() + .filter(Entry.uid == entry.uid)\ + .order_by(Entry.id.desc())\ + .first() # have we seen this post before if not old or not is_content_equal(old, entry): # set a default value for published if none is provided @@ -324,12 +324,12 @@ def process_xml_feed_for_new_entries(session, feed, content, backfill, now): for link in p_entry.get('links', []): if link.type == 'audio/mpeg': audio = AUDIO_ENCLOSURE_TMPL.format(href=link.get('href')) - content = audio + (content or '') + content = (content or '') + audio if (link.type == 'video/x-m4v' or link.type == 'video/x-mp4' or link.type == 'video/mp4'): video = VIDEO_ENCLOSURE_TMPL.format(href=link.get('href')) - content = video + (content or '') + content = (content or '') + video entry = Entry( published=published, diff --git a/woodwind/templates/_entry.jinja2 b/woodwind/templates/_entry.jinja2 index de1cda2..04e9ebf 100644 --- a/woodwind/templates/_entry.jinja2 +++ b/woodwind/templates/_entry.jinja2 @@ -32,9 +32,10 @@ {{ entry.author_name }} - {% endif %} {% if entry.feed %} - - {{ entry.feed.name }} - + {{ entry.feed.name }} + + more from this feed + {% endif %} {% if entry.title %} @@ -49,6 +50,7 @@