Actually the shortcuts themselves are not that difficult to make:
- create a shortcut pulling the youtube URL (get URL), asking me for a title (deliberate) and putting it in a text line to output to the SSH shortcut
/bin/echo -n “%variable%” > ~/temp/youtube-test/“%variable%”.txt
-
the SSH sub shortcut
This shortcut is uniform and simple, it just takes all the input and passes it to a specific machine using ssh. -
hazel on the mac then picks up the file, runs a shell command
url=$(cat $1);yt-dlp -o $1.mp4 $url
taking the youtube url, downloading using yt-dlp and renaming the output to the title put in in step 1
-
hazel then sorts the movie into a directory with the same title as the name and moves all that into my Plex movies folder.
-
Hazel then triggers a KM macro to open up Plex in the background on my iMac so I know it’s finished and I can check the video.
In all of this I’ve tried to create distinct simple steps so I can immediately see where things break, or what needs changing. I could just put all of this into 1 script on the mac, but instead I chose to add single actions for easy error checking. (1 shortcut to get the input, 1 shortcut to transfer, 1 hazel rule to start the script, 1 hazel rule to rename and sort, 1 hazel rule to start KM)
doing short little steps also allows you to re-use those steps elsewhere, without breaking the routine.
also: credit where credit is due
I did not come up with this 100% by myself, I simply adapted from @tjluoma’s post here, and other posts related to that one: