diff --git a/rtv/content.py b/rtv/content.py index f172986..6ee6d44 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -100,6 +100,7 @@ class Content(object): sub_name = getattr(sub_author, 'name', '[deleted]') flair = getattr(comment, 'author_flair_text', '') permalink = getattr(comment, 'permalink', None) + stickied = getattr(comment, 'stickied', False) data['type'] = 'Comment' data['body'] = comment.body @@ -112,6 +113,7 @@ class Content(object): data['likes'] = comment.likes data['gold'] = comment.gilded > 0 data['permalink'] = permalink + data['stickied'] = stickied return data @@ -151,6 +153,7 @@ class Content(object): data['likes'] = sub.likes data['gold'] = sub.gilded > 0 data['nsfw'] = sub.over_18 + data['stickied'] = sub.stickied data['index'] = None # This is filled in later by the method caller if sub.url.split('/r/')[-1] == sub.permalink.split('/r/')[-1]: diff --git a/rtv/submission.py b/rtv/submission.py index 8e0d04f..959ff0c 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -163,6 +163,10 @@ class SubmissionPage(Page): text, attr = self.term.guilded self.term.add_line(win, text, attr=attr) + if data['stickied']: + text, attr = self.term.stickied + self.term.add_line(win, text, attr=attr) + for row, text in enumerate(data['split_body'], start=offset+1): if row in valid_rows: self.term.add_line(win, text, row, 1) diff --git a/rtv/subreddit.py b/rtv/subreddit.py index 63432f0..2d79133 100644 --- a/rtv/subreddit.py +++ b/rtv/subreddit.py @@ -191,6 +191,9 @@ class SubredditPage(Page): text, attr = self.term.get_arrow(data['likes']) self.term.add_line(win, text, attr=attr) self.term.add_line(win, ' {created} {comments} '.format(**data)) + if data['stickied']: + text, attr = self.term.stickied + self.term.add_line(win, text, attr=attr) if data['gold']: text, attr = self.term.guilded diff --git a/rtv/terminal.py b/rtv/terminal.py index 7094f20..39da5b8 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -67,6 +67,12 @@ class Terminal(object): attr = curses.A_BOLD | Color.YELLOW return symbol, attr + @property + def stickied(self): + text = '[stickied]' + attr = Color.GREEN + return text, attr + @property def vline(self): return getattr(curses, 'ACS_VLINE', ord('|'))