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.
This commit is contained in:
2026-01-13 21:46:07 -06:00
parent 0fb8d32e45
commit ce3a948758
3 changed files with 24 additions and 6 deletions

View File

@@ -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)}")

View File

@@ -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)}")

View File

@@ -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)}")