New Format Specifier: {pcaption}
I saw the abbreviated caption output from save_caption and realized it was perfect for --filename-pattern. Even if this pull request is not accepted, please do not abandon the idea within. The ability to put captions in file names is *very* useful.
This commit is contained in:
parent
87d877e650
commit
ccf55dbeef
@ -252,6 +252,14 @@ class Post:
|
|||||||
mention_regex = re.compile(r"(?:@)(\w(?:(?:\w|(?:\.(?!\.))){0,28}(?:\w))?)")
|
mention_regex = re.compile(r"(?:@)(\w(?:(?:\w|(?:\.(?!\.))){0,28}(?:\w))?)")
|
||||||
return re.findall(mention_regex, self.caption.lower())
|
return re.findall(mention_regex, self.caption.lower())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pcaption(self) -> str:
|
||||||
|
"""Printable caption, useful as a format specifier for --filename-pattern."""
|
||||||
|
def _elliptify(caption):
|
||||||
|
pcaption = ' '.join([s.replace('/', '∕') for s in caption.splitlines() if s]).strip()
|
||||||
|
return (pcaption[:30] + u"\u2026") if len(pcaption) > 31 else pcaption
|
||||||
|
return _elliptify(self.caption) if self.caption else ''
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tagged_users(self) -> List[str]:
|
def tagged_users(self) -> List[str]:
|
||||||
"""List of all lowercased users that are tagged in the Post."""
|
"""List of all lowercased users that are tagged in the Post."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user