INNER CODE UNIT · Python
add_dateadded_to_file
DataTalksClub/datatalksclub.github.io · scripts/add_dateadded_from_git.py:99
def add_dateadded_to_file(file_path: Path, force: bool = False, dry_run: bool = False) -> bool:
"""
Add dateadded field to a podcast file's frontmatter.
Args:
file_path: Path to the podcast markdown file
force: If True, overwrite existing dateadded field
dry_run: If True, don't actually modify the file
Returns:
True if successful, False otherwise
"""
try:
# Read the file
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
except Exception as e:
print(f" ✗ Error reading file: {e}", file=sys.stderr)