Skip to content

Commit

Permalink
Merge pull request #375 from anthonywritescode/title-format
Browse files Browse the repository at this point in the history
include video number in title
  • Loading branch information
asottile authored Sep 16, 2023
2 parents 8af4ce4 + 2d0a535 commit 7dd8d80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions bin/playlist-json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import urllib.request
from typing import Any

WS_RE = re.compile(r'\s+')
TRAILER_RE = re.compile(r' anthony explains #\d+$')

PLAYLISTS = (
('faq', 'PLWBKAf81pmOZEPeIV2_pIESK5hRMAo1hR'),
Expand All @@ -21,9 +20,7 @@ def _fixup_title(s: str) -> str:
s = s.strip()
s = WS_RE.sub(' ', s)
# explains fixup
s = TRAILER_RE.sub('', s)
if s.endswith(' --'): # special case the first video
s = s[:-1 * len(' --')]
s = s.replace(' anthony explains', '')
# faq fixup
s = s.removeprefix('(stream faq) ').removesuffix(' (stream faq)')
return s
Expand Down
5 changes: 2 additions & 3 deletions bin/update-playlist
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ def main() -> int:
f.write(f'[playlist]: {playlist_link}\n')
f.write('\n')

f.write(f'0. {_video_link(playlist["videos"][0])}\n')
for video in playlist['videos'][1:]:
f.write(f'1. {_video_link(video)}\n')
for video in playlist['videos']:
f.write(f'- {_video_link(video)}\n')

return 0

Expand Down

0 comments on commit 7dd8d80

Please sign in to comment.