note-processor/main.py

29 lines
925 B
Python

import os, logging
DEBUG = os.environ.get('DEBUG')
logging.basicConfig(
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
level=logging.DEBUG if DEBUG else logging.INFO)
NOTES_DIR = '/home/tanner/notes-git/notes'
def collect_daily_notes():
daily_notes_path = os.path.join(NOTES_DIR, 'Daily Notes')
if not os.path.isdir(daily_notes_path):
logging.error(f"Directory not found: {daily_notes_path}")
return []
try:
all_files = os.listdir(daily_notes_path)
md_files = [f for f in all_files if os.path.isfile(os.path.join(daily_notes_path, f)) and f.endswith('.md')]
logging.debug(f"Found .md files: {md_files}")
return md_files
except OSError as e:
logging.error(f"Error accessing directory {daily_notes_path}: {e}")
return []
def main():
collect_daily_notes()
if __name__ == '__main__':
main()