Tuesday, October 10, 2023

Taming YouTube, Part 4: Playlist Aging and Rotating

After much setup and cleanup, I was finally ready to code my way to a better YouTube experience. The goal I'm after is to craft a workflow that has me spend an accountable amount of time queuing and watching videos, and helps avoid clutter and brain overload.

The workflow I envisioned consists of a series of playlists and rules for moving videos betwee these lists. Here's what I'm planning:

  • Incoming - where videos are queued up for watching.
  • In Progress - where longer videos live after I've started watching and they have caught my interest.
  • Stale - where videos are moved to after they've spent too long on Incoming or In Progress.
  • Nice - where videos that were educational, inspirational or hilarious end up.
  • Wow - where life changing videos end up.

The idea is that once a day I queue up videos in Incoming. This limits my zombie scrolling time on YouTube to a single session. From there, it's fair game to watch Incoming and In Progress videos throughout the day. Running youtubeassist -a playlists-rotate moves videos either between or off playlists. The rules are tersely defined in $HOME/.config/youtubeassist/config:

ROTATE_RULES="Incoming:7:Stale: \
      Stale:14::Stale \
      In_Progress:14:Stale: \
      Nice:7::Nice \

The format is: playlist, time-to-live in days, destination playlist followed by destination directory. For example, videos stay on the Incoming playlist for 7 days, and then are moved to Stale. Videos live on the Stale playlist for 14 days and then are moved to the Stale directory, found inside of the $ROTATE_DIR. This takes them off of YouTube, stashing them in a git repository for long term archival.

The Nice and Wow playlists are ultimately archived in a git repo, too. My expectation is that I'll eventually mine these directories, publishing a list of my favorite videos over a given time or subject.

Here's the output of me rotating playlists for today:

$ youtubeassist -a playlists-rotate
name=Incoming, ttl=7, output=Stale
name=Stale, ttl=14, dir=/Users/ben/dt/i2x/youtube-archive/src/main/playlists/archived/Stale
name=In Progress, ttl=14, output=Stale
name=Nice, ttl=7, dir=/Users/ben/dt/i2x/youtube-archive/src/main/playlists/archived/Nice
name=Wow, ttl=30, dir=/Users/ben/dt/i2x/youtube-archive/src/main/playlists/archived/Wow

Implementing -a playlists-rotate was easy once I'd implemented a slightly lower level operation, -a playlist-age. Aging a playlist works by taking in a number of days and moving all videos off the list that meet that threshold. Below is an example of aging items out of the Sketching playlist.

# All videos on the list for more than 15 days are moved to the 'Stale' playlist  
$ youtubeassist -a playlist-age -n "Sketching" -t 15 -o "Stale" -p preview
Aging 'Adriaen van de Velde (1636-1672) A collection of paintings 4K Ultra HD.mp4', 20 > 15
Aging 'Sketch People Loosely like a Pro: Urban Sketching Tips', 20 > 15
Aging 'How to do urban sketching', 20 > 15

# See, all the videos are gone
$ youtubeassist -a playlist-age -n "Sketching" -t 15 -o "Stale" -p process

# And, they were moved to the Stale playlist
$ youtubeassist -a playlist -n "Stale"
UExCdXhFUFpPSEhLYVhuUHpzdTRqUUxUMUhQb3lic29Cby4zMDg5MkQ5MEVDMEM1NTg2|czCqXPURvK0|0|9 Drawing Exercises to Improve Your Urban Sketching Skills
UExCdXhFUFpPSEhLYVhuUHpzdTRqUUxUMUhQb3lic29Cby45ODRDNTg0QjA4NkFBNkQy|05Ucm95fpTs|0|Travel Journal Sketching #1 Start up tips
UExCdXhFUFpPSEhLYVhuUHpzdTRqUUxUMUhQb3lic29Cby5EMEEwRUY5M0RDRTU3NDJC|emCpEE223RI|0|How to Draw and Sketch with a Fountain Pen - The Very Basics - Tutorial and Tips

# Let's see what's left
$ youtubeassist -a playlist -n Sketching
UExCdXhFUFpPSEhLYjRNZ2hwdHRnV3FNd3gzMnZjQVRsVS4zRjM0MkVCRTg0MkYyQTM0|2gY51vW2H-U|12|How to Draw Anything - 7 Easy Tips for Beginners
UExCdXhFUFpPSEhLYjRNZ2hwdHRnV3FNd3gzMnZjQVRsVS5DNzE1RjZEMUZCMjA0RDBB|BjSJCMeH_8I|11|A Brief Guide to Perspective // Urban Sketching for Beginners

# I can use a time-to-live of -1 days to move all items to a a playlist. In this case
# I'm moving all items to 'Incoming'
$ youtubeassist -a playlist-age -n "Sketching" -t -1 -o Incoming -p preview
Aging 'How to Draw Anything - 7 Easy Tips for Beginners', 12 > -1
Aging 'A Brief Guide to Perspective // Urban Sketching for Beginners', 11 > -1

# And poof, I can delete 'Sketching'
$ youtubeassist -a playlist -n Sketching

I've set up youtubeassist -a playlists-rotate to run daily from cron. Now I just need to be disciplined about keeping my mindlessly scrolling of YouTube to a once a day occurrence. That habit will take practice, but I'm confident I'll get there.

Next up: the last piece of the YouTube optimization puzzle: streamlining video discovery.

No comments:

Post a Comment