in progress
This commit is contained in:
@@ -127,10 +127,11 @@ class Content(object):
|
|||||||
displayed through the terminal.
|
displayed through the terminal.
|
||||||
|
|
||||||
Definitions:
|
Definitions:
|
||||||
permalink - Full URL to the submission comments.
|
permalink - URL to the reddit page with submission comments.
|
||||||
url_full - Link that the submission points to.
|
url_full - URL that the submission points to.
|
||||||
url - URL that is displayed on the subreddit page, may be
|
url - URL that will be displayed on the subreddit page, may be
|
||||||
"selfpost" or "x-post" or a link.
|
"selfpost", "x-post submission", "x-post subreddit", or an
|
||||||
|
external link.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reddit_link = re.compile(
|
reddit_link = re.compile(
|
||||||
@@ -146,8 +147,7 @@ class Content(object):
|
|||||||
data['text'] = sub.selftext
|
data['text'] = sub.selftext
|
||||||
data['created'] = cls.humanize_timestamp(sub.created_utc)
|
data['created'] = cls.humanize_timestamp(sub.created_utc)
|
||||||
data['comments'] = '{0} comments'.format(sub.num_comments)
|
data['comments'] = '{0} comments'.format(sub.num_comments)
|
||||||
data['score'] = '{0} pts'.format(
|
data['score'] = '{0} pts'.format('-' if sub.hide_score else sub.score)
|
||||||
'-' if sub.hide_score else sub.score)
|
|
||||||
data['author'] = name
|
data['author'] = name
|
||||||
data['permalink'] = sub.permalink
|
data['permalink'] = sub.permalink
|
||||||
data['subreddit'] = six.text_type(sub.subreddit)
|
data['subreddit'] = six.text_type(sub.subreddit)
|
||||||
@@ -166,8 +166,12 @@ class Content(object):
|
|||||||
elif reddit_link.match(sub.url):
|
elif reddit_link.match(sub.url):
|
||||||
# Strip the subreddit name from the permalink to avoid having
|
# Strip the subreddit name from the permalink to avoid having
|
||||||
# submission.subreddit.url make a separate API call
|
# submission.subreddit.url make a separate API call
|
||||||
data['url'] = 'self.{0}'.format(sub.url.split('/')[4])
|
url_parts = sub.url.split('/')
|
||||||
data['url_type'] = 'x-post'
|
data['url'] = 'self.{0}'.format(url_parts[4])
|
||||||
|
if 'comments' in url_parts:
|
||||||
|
data['url_type'] = 'x-post submission'
|
||||||
|
else:
|
||||||
|
data['url_type'] = 'x-post subreddit'
|
||||||
else:
|
else:
|
||||||
data['url'] = sub.url
|
data['url'] = sub.url
|
||||||
data['url_type'] = 'external'
|
data['url_type'] = 'external'
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class SubredditPage(Page):
|
|||||||
data = self.content.get(self.nav.absolute_index)
|
data = self.content.get(self.nav.absolute_index)
|
||||||
if data['url_type'] == 'selfpost':
|
if data['url_type'] == 'selfpost':
|
||||||
self.open_submission()
|
self.open_submission()
|
||||||
elif data['url_type'] == 'x-post':
|
elif data['url_type'] == 'x-post comment':
|
||||||
self.open_submission(url=data['url_full'])
|
self.open_submission(url=data['url_full'])
|
||||||
self.config.history.add(data['url_full'])
|
self.config.history.add(data['url_full'])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user