Skip to content

Commit 4400a85

Browse files
committed
Improve reddit formatting
1 parent 1bdb972 commit 4400a85

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

plugins/reddit.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
def format_output(item, show_url=False):
2121
""" takes a reddit post and returns a formatted sting """
22-
item["title"] = formatting.truncate(item["title"], 60)
22+
item["title"] = formatting.truncate(item["title"], 70)
2323
item["link"] = short_url.format(item["id"])
2424

2525
raw_time = datetime.fromtimestamp(int(item["created_utc"]))
26-
item["timesince"] = timeformat.time_since(raw_time, count=1)
26+
item["timesince"] = timeformat.time_since(raw_time, count=1, simple=True)
2727

2828
item["comments"] = formatting.pluralize(item["num_comments"], 'comment')
2929
item["points"] = formatting.pluralize(item["score"], 'point')
@@ -34,12 +34,11 @@ def format_output(item, show_url=False):
3434
item["warning"] = ""
3535

3636
if show_url:
37-
return "\x02{title} : {subreddit}\x02 - by \x02{author}\x02" \
38-
" {timesince} ago - {comments}, {points} -" \
39-
" {link}{warning}".format(**item)
37+
return "\x02{title} : {subreddit}\x02 - {comments}, {points}" \
38+
" - \x02{author}\x02 {timesince} ago - {link}{warning}".format(**item)
4039
else:
41-
return "\x02{title} : {subreddit}\x02 - by \x02{author}\x02" \
42-
" {timesince} ago - {comments}, {points}{warning}".format(**item)
40+
return "\x02{title} : {subreddit}\x02 - {comments}, {points}" \
41+
" - \x02{author}\x02, {timesince} ago{warning}".format(**item)
4342

4443

4544
@hook.regex(reddit_re)

0 commit comments

Comments
 (0)