Merge branch 'master' of https://github.com/shanhind/rtv into shanhind-master
This commit is contained in:
@@ -140,6 +140,7 @@ class BaseContent(object):
|
|||||||
sub_author = (clean(comment.submission.author.name) if
|
sub_author = (clean(comment.submission.author.name) if
|
||||||
getattr(comment.submission, 'author') else '[deleted]')
|
getattr(comment.submission, 'author') else '[deleted]')
|
||||||
data['is_author'] = (data['author'] == sub_author)
|
data['is_author'] = (data['author'] == sub_author)
|
||||||
|
data['flair'] = (clean(comment.author_flair_text) if comment.author_flair_text else "")
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@@ -161,9 +162,11 @@ class BaseContent(object):
|
|||||||
data['comments'] = '{} comments'.format(sub.num_comments)
|
data['comments'] = '{} comments'.format(sub.num_comments)
|
||||||
data['score'] = '{} pts'.format(sub.score)
|
data['score'] = '{} pts'.format(sub.score)
|
||||||
data['author'] = (clean(sub.author.name) if getattr(sub, 'author')
|
data['author'] = (clean(sub.author.name) if getattr(sub, 'author')
|
||||||
|
|
||||||
else '[deleted]')
|
else '[deleted]')
|
||||||
data['permalink'] = clean(sub.permalink)
|
data['permalink'] = clean(sub.permalink)
|
||||||
data['subreddit'] = strip_subreddit_url(sub.permalink)
|
data['subreddit'] = strip_subreddit_url(sub.permalink)
|
||||||
|
data['flair'] = (clean(sub.link_flair_text) if sub.link_flair_text else "")
|
||||||
data['url_full'] = clean(sub.url)
|
data['url_full'] = clean(sub.url)
|
||||||
data['url'] = ('selfpost' if is_selfpost(sub.url) else clean(sub.url))
|
data['url'] = ('selfpost' if is_selfpost(sub.url) else clean(sub.url))
|
||||||
|
|
||||||
@@ -365,6 +368,7 @@ class SubredditContent(BaseContent):
|
|||||||
# TODO: Trap specific errors
|
# TODO: Trap specific errors
|
||||||
raise SubredditNameError(display_name)
|
raise SubredditNameError(display_name)
|
||||||
|
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def get(self, index, n_cols=70):
|
def get(self, index, n_cols=70):
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ class SubmissionPage(BasePage):
|
|||||||
attr = curses.A_BOLD
|
attr = curses.A_BOLD
|
||||||
attr |= (Color.BLUE if not data['is_author'] else Color.GREEN)
|
attr |= (Color.BLUE if not data['is_author'] else Color.GREEN)
|
||||||
win.addnstr(row, 1, text, n_cols-1, attr)
|
win.addnstr(row, 1, text, n_cols-1, attr)
|
||||||
|
text = ' {flair}'.format(**data)
|
||||||
|
win.addnstr(text, n_cols-win.getyx()[1], curses.A_BOLD | Color.YELLOW)
|
||||||
text = ' {score} {created}'.format(**data)
|
text = ' {score} {created}'.format(**data)
|
||||||
win.addnstr(text, n_cols - win.getyx()[1])
|
win.addnstr(text, n_cols - win.getyx()[1])
|
||||||
|
|
||||||
@@ -173,6 +175,8 @@ class SubmissionPage(BasePage):
|
|||||||
attr = curses.A_BOLD | Color.GREEN
|
attr = curses.A_BOLD | Color.GREEN
|
||||||
text = '{author}'.format(**data)
|
text = '{author}'.format(**data)
|
||||||
win.addnstr(row, 1, text, n_cols, attr)
|
win.addnstr(row, 1, text, n_cols, attr)
|
||||||
|
text = ' {flair}'.format(**data)
|
||||||
|
win.addnstr(text, n_cols-win.getyx()[1], curses.A_BOLD | Color.YELLOW)
|
||||||
text = ' {created} {subreddit}'.format(**data)
|
text = ' {created} {subreddit}'.format(**data)
|
||||||
win.addnstr(text, n_cols - win.getyx()[1])
|
win.addnstr(text, n_cols - win.getyx()[1])
|
||||||
|
|
||||||
|
|||||||
@@ -148,5 +148,7 @@ class SubredditPage(BasePage):
|
|||||||
if row in valid_rows:
|
if row in valid_rows:
|
||||||
text = '{author}'.format(**data)
|
text = '{author}'.format(**data)
|
||||||
win.addnstr(row, 1, text, n_cols-1, curses.A_BOLD)
|
win.addnstr(row, 1, text, n_cols-1, curses.A_BOLD)
|
||||||
|
text = ' {flair}'.format(**data)
|
||||||
|
win.addnstr(text, n_cols - 1, curses.A_BOLD | Color.GREEN)
|
||||||
text = ' {subreddit}'.format(**data)
|
text = ' {subreddit}'.format(**data)
|
||||||
win.addnstr(text, n_cols - win.getyx()[1], Color.YELLOW)
|
win.addnstr(text, n_cols - win.getyx()[1], Color.YELLOW)
|
||||||
|
|||||||
Reference in New Issue
Block a user