added nsfw tags

This commit is contained in:
Brobin
2015-04-16 10:34:49 -05:00
parent fa63247f5f
commit 9edbd9317f
3 changed files with 9 additions and 0 deletions

View File

@@ -109,6 +109,7 @@ class BaseContent(object):
data['url'] = ('selfpost' if is_selfpost(sub.url) else sub.url)
data['likes'] = sub.likes
data['gold'] = sub.gilded > 0
data['nsfw'] = sub.over_18
return data

View File

@@ -266,4 +266,8 @@ class SubmissionPage(BasePage):
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW)
win.addnstr(text, n_cols - win.getyx()[1], attr)
if data['nsfw']:
text, attr = 'NSFW', (curses.A_BOLD | Color.RED)
win.addnstr(text, n_cols - win.getyx()[1], attr)
win.border()

View File

@@ -195,6 +195,10 @@ class SubredditPage(BasePage):
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW)
win.addnstr(text, n_cols - win.getyx()[1], attr)
if data['nsfw']:
text, attr = 'NSFW', (curses.A_BOLD | Color.RED)
win.addnstr(text, n_cols - win.getyx()[1], attr)
row = n_title + offset + 2
if row in valid_rows:
text = clean(u'{author}'.format(**data))