Update documentation regarding v4 changes

as-module.rst: List how Post and Profile is created

Describe new filename specification logic

Update filter-posts section
This commit is contained in:
Alexander Graf
2018-04-29 11:57:28 +02:00
parent 5036cc7b44
commit 7c76202f1c
5 changed files with 142 additions and 59 deletions

View File

@@ -264,12 +264,10 @@ def main():
'{target} is replaced by the target you specified, i.e. either :feed, #hashtag or the '
'profile name. Defaults to \'{target}\'.')
g_how.add_argument('--filename-pattern',
help='Prefix of filenames. Posts are stored in the directory whose pattern is given with '
'--dirname-pattern. {profile} is replaced by the profile name, '
'{target} is replaced by the target you specified, i.e. either :feed, #hashtag or the '
'profile name. Also, the fields {date} and {shortcode} can be specified. In case of not '
'downloading stories, the attributes of the Post class can be used in addition, e.g. '
'{post.owner_id} or {post.mediaid}. Defaults to \'{date:%%Y-%%m-%%d_%%H-%%M-%%S}\'.')
help='Prefix of filenames, relative to the directory given with '
'--dirname-pattern. {profile} is replaced by the profile name,'
'{target} is replaced by the target you specified, i.e. either :feed'
'#hashtag or the profile name. Defaults to \'{date_utc}_UTC\'')
g_how.add_argument('--user-agent',
help='User Agent to use for HTTP requests. Defaults to \'{}\'.'.format(default_user_agent()))
g_how.add_argument('-S', '--no-sleep', action='store_true', help=SUPPRESS)

View File

@@ -177,12 +177,12 @@ class Post:
@property
def date(self) -> datetime:
"""Synonym to :meth:`.date_utc`"""
"""Synonym to :attr:`~Post.date_utc`"""
return self.date_utc
@property
def profile(self) -> str:
"""Synonym to :meth:`.owner_username`"""
"""Synonym to :attr:`~Post.owner_username`"""
return self.owner_username
@property
@@ -593,6 +593,12 @@ class StoryItem:
"""The mediaid is a decimal representation of the media shortcode."""
return int(self._node['id'])
@property
def shortcode(self) -> str:
"""Convert :attr:`~StoryItem.mediaid` to a shortcode-like string, allowing ``{shortcode}`` to be used with
:option:`--filename-pattern`."""
return Post.mediaid_to_shortcode(self.mediaid)
def __repr__(self):
return '<StoryItem {}>'.format(self.mediaid)
@@ -633,12 +639,12 @@ class StoryItem:
@property
def date(self) -> datetime:
"""Synonym to :meth:`.date_utc`"""
"""Synonym to :attr:`~StoryItem.date_utc`"""
return self.date_utc
@property
def profile(self) -> str:
"""Synonym to :meth:`.owner_username`"""
"""Synonym to :attr:`~StoryItem.owner_username`"""
return self.owner_username
@property