Skip to content
/ kronCLI Public

Journal/Family Chronicle Command Line Tool

Notifications You must be signed in to change notification settings

pkutaj/kronCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kronCLI

family

PowerShell Badge Windows Badge Android Badge Visual Studio Code Badge

This repo contains a PowerShell script for the creation of a templated markdown-based journal entry for yesterday which imports and compresses images from a given folder.

I use it as a morning ritual writing a privately distributed family chronicle which is turning out to be a keystone habbit.

1. demo

1.1. Item Creation

1.2. WebUI (optional)

2. setup

2.1. prereqs

2.2. environmental variables

  • you need the following environmental variables
Name Example Value
kronScript c:\kronCLI\kron.ps1
kronMasterImageFolder c:\photos
kronFolder c:\journal

2.3. manual work

  • You have to hard code the pattern catching the actual images for a selected timespan:
# c:\photos\2021

$timeStampPattern = "yyyyMMdd"          # put the value into script when done
$yesterdayPattern = ((Get-Date) - (New-TimeSpan -Days 1)).ToString($timeStampPattern) # IGNORE
$pattern = "IMG_$yesterdayPattern.*"    # put the value into script then done
(dir) -match $pattern | Select Name     # run interactive pattern-check 

# OUTPUT OF MATCHES
# -----------------
# IMG_20210716_1404144kron.jpg
# IMG_20210716_1416013kron.jpg
# IMG_20210716_1700289.jpg
# IMG_20210716_1700311.jpg

2.4. profile

  • You can set up an alias in PowerShell profile to call a script from anywhere
    • I set an alias as k in the $profile and just hit k to run it from anywhere
$profile
Import-Module $env:kronScript
Set-Alias k new-kron

3. instructions

  • Connect the phone to the PC in the PTP transfer mode
  • Windows Photo starts automatically (if configured as such)
  • Import your photos to the kronMasterImageFolder
    • I am syncing this with Google Photos at this point
    • I am also deleting photos from my phone

  • Recommended: Navigate to the master folder and delete redundant photos
  • Run the script . kron.ps1 (or any alias) and write about your yesterday
  • The script then:
    1. Copies, renames, and compresses images from the $env:kronMasterImageFolder
    2. The script puts them in $env:kronFolder\assets
    3. It populates the newly created markdown file with the image links in markdown format
  • You can write about your day with photos already populated
  • To merge all posts into .pdf to print out as a hard-copy:
    1. Navigate to the folder of the previous month
    2. Run . kron.ps1 -merge

4. sharing

  • I am storing and sharing my journal as a family chronicle as a private GitHub repo
  • See GitHub for Storage + UI for setting that up

About

Journal/Family Chronicle Command Line Tool

Resources

Stars

Watchers

Forks