Browse Source

Change :first for :newest

i.e. toggle default for the more-obvious option
master
pictuga 4 weeks ago
parent
commit
f18a128ee6
3 changed files with 9 additions and 9 deletions
  1. +1
    -1
      README.md
  2. +6
    -6
      morss/morss.py
  3. +2
    -2
      www/sheet.xsl

+ 1
- 1
README.md View File

@ -91,7 +91,7 @@ The arguments are:
- `debug`: to have some feedback from the script execution. Useful for debugging
- `force`: force refetch the rss feed and articles
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
- `first`: return the feed items in the order they initially appear in the feed (morss ohterwise shows the newest items first)
- `newest`: return the feed items in chronological order (morss ohterwise shows the items by appearing order)
- http server only
- `callback=NAME`: for JSONP calls
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)

+ 6
- 6
morss/morss.py View File

@ -343,15 +343,15 @@ def FeedGather(rss, url, options):
if options.cache:
max_time = 0
if options.first:
# :first to just take the first items in the feed (in sequence)
sorted_items = rss.items
else:
# otherwise, take the _newest_, i.e. sort by time
if options.newest:
# :newest take the newest items
now = datetime.now(tz.tzutc())
sorted_items = sorted(rss.items, key=lambda x:x.updated or x.time or now, reverse=True)
else:
# default behavior, take the first items (in appearing order)
sorted_items = rss.items
for i, item in enumerate(sorted_items):
if time.time() - start_time > lim_time >= 0 or i + 1 > lim_item >= 0:
log('dropped')

+ 2
- 2
www/sheet.xsl View File

@ -192,8 +192,8 @@
</select>
link of the
<select>
<option value="">newest</option>
<option value=":first" title="Return the feed items in the order they appear in the feed (morss ohterwise shows the newest items first)">first (?)</option>
<option value="">first</option>
<option value=":newest" title="Select feed items by publication date (instead of appearing order)">newest (?)</option>
</select>
items and
<select>

Loading…
Cancel
Save