From d52f5747463645cc5e520daf9c40d08db43c84d8 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Wed, 14 Oct 2015 18:06:30 -0700 Subject: [PATCH] Post count is now displayed before each submission's title. #154. --- rtv/content.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtv/content.py b/rtv/content.py index 62cfaaf..17c02a3 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -130,6 +130,10 @@ class BaseContent(object): data['subreddit'] = str(sub.subreddit) data['flair'] = flair data['url_full'] = sub.url + data['likes'] = sub.likes + data['gold'] = sub.gilded > 0 + data['nsfw'] = sub.over_18 + data['index'] = None # This is filled in later by the method caller if data['permalink'].split('/r/')[-1] == data['url_full'].split('/r/')[-1]: data['url_type'] = 'selfpost' @@ -143,10 +147,6 @@ class BaseContent(object): data['url_type'] = 'external' data['url'] = data['url_full'] - data['likes'] = sub.likes - data['gold'] = sub.gilded > 0 - data['nsfw'] = sub.over_18 - return data @staticmethod @@ -374,6 +374,9 @@ class SubredditContent(BaseContent): raise IndexError else: data = self.strip_praw_submission(submission) + data['index'] = index + # Add the post number to the beginning of the title + data['title'] = u'{}. {}'.format(index+1, data['title']) self._submission_data.append(data) # Modifies the original dict, faster than copying