From ce3a9487582ab760197eacd923cc953efa4d2f12 Mon Sep 17 00:00:00 2001 From: Marcus Date: Tue, 13 Jan 2026 21:46:07 -0600 Subject: [PATCH] Add phlog prompt to post creation scripts (Phase 4) All three post creation scripts now ask whether to publish to gopher phlog and include the phlog field in generated frontmatter. --- scripts/import_letterboxd.py | 10 ++++++++-- scripts/new_movie.py | 10 ++++++++-- scripts/new_techpost.py | 10 ++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/scripts/import_letterboxd.py b/scripts/import_letterboxd.py index be79384..c188fca 100755 --- a/scripts/import_letterboxd.py +++ b/scripts/import_letterboxd.py @@ -254,7 +254,7 @@ def prompt_home_details(): } -def create_draft_post(movie, tmdb_details, poster_url, viewing_details=None): +def create_draft_post(movie, tmdb_details, poster_url, viewing_details=None, phlog=False): """Create a Hugo draft post for the movie.""" slug = slugify(movie["title"]) filename = f"{slug}.md" @@ -328,12 +328,14 @@ def create_draft_post(movie, tmdb_details, poster_url, viewing_details=None): - had pizza""" # Build the frontmatter and content + phlog_str = "true" if phlog else "false" content = f'''--- title: '{movie["title"]}' date: {now} draft: true series: "Frank's Couch" summary: "" +phlog: {phlog_str} imdb: "{imdb_id}" poster: "{poster_url or ''}" tags: @@ -396,6 +398,10 @@ def import_movie(movie, viewing_mode=None): else: viewing_details = prompt_viewing_details() + # Ask about gopher phlog + phlog_input = input("\nPublish to gopher phlog? (y/N): ").strip().lower() + phlog = phlog_input == "y" + # Get TMDB details print("\n Fetching TMDB details...") tmdb = get_tmdb_details(movie["tmdb_id"]) @@ -409,7 +415,7 @@ def import_movie(movie, viewing_mode=None): # Create draft post print(" Creating draft post...") - filepath = create_draft_post(movie, tmdb, poster_url, viewing_details) + filepath = create_draft_post(movie, tmdb, poster_url, viewing_details, phlog) if filepath: print(f"\nDone! Edit your draft at: {filepath.relative_to(PROJECT_ROOT)}") diff --git a/scripts/new_movie.py b/scripts/new_movie.py index e38f9c1..2914805 100755 --- a/scripts/new_movie.py +++ b/scripts/new_movie.py @@ -103,7 +103,7 @@ def download_poster(poster_path, filename): return f"/images/posters/{filename}" -def create_post(imdb_id, details, poster_path, custom_title=None): +def create_post(imdb_id, details, poster_path, custom_title=None, phlog=False): """Create the Hugo post with all metadata.""" title = custom_title or details.get("title", "Untitled") slug = slugify(title) @@ -143,12 +143,14 @@ def create_post(imdb_id, details, poster_path, custom_title=None): else: director_yaml = f' "{director_str}"' if director_str else ' ""' + phlog_str = "true" if phlog else "false" content = f'''--- title: '{title}' date: {now} draft: true series: "Frank's Couch" summary: "" +phlog: {phlog_str} imdb: "{imdb_id}" poster: "{poster_url}" year: {year} @@ -219,8 +221,12 @@ def main(): print("Fetching details...") details = get_movie_details(tmdb_id) + # Ask about gopher phlog + phlog_input = input("\nPublish to gopher phlog? (y/N): ").strip().lower() + phlog = phlog_input == "y" + # Create post - filepath = create_post(imdb_id, details, details.get("poster_path"), args.title) + filepath = create_post(imdb_id, details, details.get("poster_path"), args.title, phlog) if filepath: print(f"\nCreated: {filepath.relative_to(PROJECT_ROOT)}") diff --git a/scripts/new_techpost.py b/scripts/new_techpost.py index 765211d..bb13c52 100755 --- a/scripts/new_techpost.py +++ b/scripts/new_techpost.py @@ -145,7 +145,7 @@ Quick tip or discovery here. Keep it short! """ -def create_post(title, post_type, tags, summary): +def create_post(title, post_type, tags, summary, phlog=False): """Create the post file.""" CONTENT_DIR.mkdir(parents=True, exist_ok=True) @@ -162,6 +162,7 @@ def create_post(title, post_type, tags, summary): now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") tags_yaml = "\n".join(f" - {tag}" for tag in tags) skeleton = get_skeleton(post_type) + phlog_str = "true" if phlog else "false" content = f'''--- title: '{title}' @@ -169,6 +170,7 @@ date: {now} draft: true series: "Fun Center" summary: "{summary}" +phlog: {phlog_str} tags: {tags_yaml} --- @@ -201,8 +203,12 @@ def main(): # Get summary summary = input("\nOne-line summary: ").strip() + # Ask about gopher phlog + phlog_input = input("\nPublish to gopher phlog? (y/N): ").strip().lower() + phlog = phlog_input == "y" + # Create the post - filepath = create_post(title, post_type, tags, summary) + filepath = create_post(title, post_type, tags, summary, phlog) if filepath: print(f"\nCreated: {filepath.relative_to(PROJECT_ROOT)}")