summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-04-01 00:03:40 +0200
committermakefu <github@syntax-fehler.de>2020-04-01 00:03:40 +0200
commit6c54ff705e5c1133a46039cf654ac54cd4179955 (patch)
tree87ab794382758b27ccdfb7b3bfb9a48cd84f5663
parentffef23f1854d8166eec75a5d94b2524a63e6e06c (diff)
ebknotify: add more info
-rw-r--r--ebknotify/cache.py12
-rw-r--r--ebknotify/cli.py2
-rw-r--r--ebknotify/feed.py7
3 files changed, 17 insertions, 4 deletions
diff --git a/ebknotify/cache.py b/ebknotify/cache.py
index fbc4b9b..d1188dd 100644
--- a/ebknotify/cache.py
+++ b/ebknotify/cache.py
@@ -47,10 +47,16 @@ class Cache():
title = ad.get('title', {}).get('value', '').encode('utf-8')
title_unescaped = html_unescape(title)
try:
- img = ad['pictures']['picture'][0]['link'][4]['href']
+ img = ad['pictures']['picture'][0]['link'][3]['href']
except Exception as e:
- print(e)
img = None
+ try:
+ place = ad['locations']['location'][0]['localized-name']['value']
+ radius = ad['locations']['location'][0]['radius']['value']
+ except Exception as e:
+ print(e)
+ place = None
+ radius = None
# TODO: fetch detailed article
ad['notify'] = {
'filter': searchquery,
@@ -59,6 +65,8 @@ class Cache():
'first-seen': now.isoformat(),
'title-unescaped': title_unescaped,
'age_in_h': age_in_h,
+ 'place': place,
+ 'radius': radius,
'price': price,
'image': img,
'url': ad['link'][1]['href'],
diff --git a/ebknotify/cli.py b/ebknotify/cli.py
index ad7d0b7..7b9e612 100644
--- a/ebknotify/cli.py
+++ b/ebknotify/cli.py
@@ -7,7 +7,7 @@ options:
if not set ebk-notify will check in config unter the 'items' key
--cache=FILE Path to cache file [Default: ~/.config/ebk-notify/cache.json]
--atom Write atom files
- --outdir=DIR Write atom files to folder [Default: ~/.config/ebk-notify/feeds]
+ --outdir=DIR Write atom files to folder [Default: ~/.config/ebk-notify]
"""
diff --git a/ebknotify/feed.py b/ebknotify/feed.py
index a09b79a..8d267a5 100644
--- a/ebknotify/feed.py
+++ b/ebknotify/feed.py
@@ -20,11 +20,16 @@ class Feed(FeedGenerator):
fe.category({'term':item['category']['localized-name']['value']})
fe.link({'href':item['notify']['url'],'title':'Link to item'})
fe.pubDate(item['notify']['creation'])
- fe.title(f"{item['title']['value']} ({available})")
+ fe.title(f"{item['title']['value']} {item['notify']['price']}€ ({available})")
fe.content(f'''
<a href="{item['notify']['url']}">
<img src="{item['notify']['image']}" />
</a>
+ <ul>
+ <li>Created: {item['notify']['creation'].split("+")[0]}</li>
+ <li>Place: {item['notify']['place']} ({item['notify']['radius']} km)</li>
+ <li>Filter: {item['notify']['filter-name']}</li>
+ </ul>
<div>
{item['description']['value']}
</div>