One of the delights of Shortcuts is the potential of simple individual actions. By themselves, they might not do much, but combined with simple actions from other apps, they create shortcuts that are greater than the sum of their parts. Two of my favorite recent examples are a pair of actions from the apps Play and Downie that combined with a new feature of the Channels app, have allowed me to create a personalized music video channel that I can watch anywhere.
I’ve been tinkering with this idea on and off for months, but it wasn’t until Play came along, and Channels expanded beyond TV shows and movies, that the last pieces of the puzzle fell into place. Those two changes have allowed me to build my own version of 80s era MTV, when the channel was about music, not reality TV, using just a handful of Shortcuts actions.
There are already ways to stream an endless playlist of music videos, including Apple Music TV, which is available in the TV app. However, I like the concept of Apple Music TV more than its implementation. It’s too much like radio, spoon-feeding me someone else’s music picks. What I wanted was complete control of the library of music videos I watch.
One way to solve this would be to create a playlist on the Mac with my favorite music videos and play them on shuffle. That’s not a bad solution, but it doesn’t square with how I find music videos. More often than not, I discover videos on Twitter or in my RSS feeds where I follow sites like Chorus.fm and Pitchfork, which frequently link to music videos on YouTube.
What I’ve always wanted was an automated way to download the best videos I find from YouTube and play them at my leisure on my TV, an iPad, or any other device with a screen. What Shortcuts and a few third-party apps have delivered is even better than I’d hoped: a virtual TV channel ready to play my favorite music videos 24/7 on shuffle, which I call myTunes. Here’s how it works.
The keys to the shortcut portion of myTunes are actions provided by Marcos Tanaka’s app Play, an iPhone, iPad, Mac, and Apple TV app for saving YouTube links for later, and Charlie Monroe Software’s YouTube download utility, Downie. Downie is Mac-only, but my setup works across the iPhone, iPad, and Mac, thanks to Play’s availability on all platforms and the fact that myTunes runs on a schedule at regular intervals.
The entire process is incredibly simple and an example of the sort of automation that led us to add a Best Everyday Shortcut category to the Automation April Shortcut Contest, which I encourage you to enter if you haven’t already. What myTunes lacks in complexity at just six actions, it makes up for with its simple design and set-it-and-forget-it usefulness.
myTunes is also a shortcut with a slightly tortured development history, which makes it a good example of when to keep iterating on a shortcut idea. As originally conceived, myTunes used a plain text file to track the last time it was run and was split across two shortcuts. It wasn’t the most complex shortcut I’ve ever written, but when I started running into date math edge cases and other issues, I knew I needed to rethink and redesign myTunes.
I stripped the shortcut down to its the core actions provided by Play and Downie. Play can output video URLs filtered by several criteria, including tags, and Downie can initiate downloads of video URLs it finds in text. In the end, those actions, plus Play’s ability to remove tags from saved video URLs and a new feature of the Channels app, were all I needed to create my music video channel.
As I come across music videos I want to add to my collection, I save them to Play with the tag
music-video. myTunes, runs as a Shortcuts applet on a daily schedule tied to an event in Apple’s Calendar app grabbing any videos tagged with
music-video in Play, downloading them with Downie, and then stripping the tag from any downloaded videos, so they won’t be downloaded again the next time the shortcut runs.
Play’s Get Video action can filter the YouTube URLs in your collection in several ways and output a dozen pieces of metadata about each. For myTunes, all I need are the videos’ URLs, so I filter my saved URLs by the tag ‘music-video’ and pass just the URLs to Downie’s ‘Download URLs in text’ action, which I’ve also set up to send the downloaded videos directly to a folder on a drive attached to my always-on Mac mini.
I’ve used a substantial 120 second Wait action in myTunes to give Downie the time it needs to download the videos passed from Play. I could probably shorten this wait period, but since this shortcut runs on a schedule when I’m not at my Mac or doing something else, the delay doesn’t meaningfully affect me.
After the 2-minute wait, a Repeat action iterates through each of the videos from the Get Video action at the beginning of the shortcut, which is identified by Video ID, removing the
music-video tag, so the next time the shortcut is run, duplicate videos won’t be downloaded. Finally, myTunes quits Downie.
One bit of additional setup that’s important to note is that you need to go to Downie’s Preferences, select General, and be sure to select the checkbox next to Automatically Start Downloads. That way, Downie will fetch your videos regardless of whether you’re at your Mac.
myTunes results in a folder of .mp4 videos, which is nice for archival purposes but not very useful by itself. What puts the finishing touches on myTunes is Channels, the iPhone, iPad, M1 Mac, and Apple TV app for playing over-the-air TV and TV show and movie collections that are stored locally.
I’ve used Channels as a way to watch over-the-air TV and my locally-stored collection of TV shows and movies for a couple of years. Until recently, though, all locally-stored videos had to be a TV show or movie to work with Channels.
With a recent update, Channels added the ability to point its server at a folder of ‘other’ videos, which has been perfect for my music video project. That’s because, in addition to adding other video types, Channels has a feature called Virtual Channel that lets you create a channel that sits alongside your over-the-air TV channels, except it’s entirely of your own creation. In my case, that meant I could turn my folder of music videos into ‘myTunes,’ a full-blown TV channel in my Channels lineup.
Setting up a virtual channel is simple. First, you need to point the Channels server at the folder where your music videos are stored in the Local Content section of the Channels server’s settings. Channels has excellent documentation on how to set up your server if you need help with this part.
Next, under the Live TV settings, pick Virtual Channel and then Add Channel. Give your channel a name, number, a link to any artwork you want to use, and pick the sort, order, and limit options to use.
Because I want myTunes to feel like a personal version of 80s-era MTV, I’ve set it up to play my downloaded videos randomly and added some fun iPod-themed art that hovers in the corner as videos play like the logos on ‘real’ channels. The final step was to point the channel to the folder of videos connected to my Mac mini. Now, whenever I open Channels on my iPhone, iPad, or Apple TV, I can go to its Guide, select myTunes, and watch a random stream of my favorite music videos, which I like to put on in the background when I’m doing something else like cooking.
I’ve been very happy with how myTunes turned out. What initially seemed like it would be a complex task ended up requiring little more than collecting URLs with Play, piping them into Downie, and pointing Channels at a folder. In isolation, I probably couldn’t have come up with a use for Play’s ability to create a list of YouTube URLs or Downie’s ability to extract video URLs from text, but together, they’re a powerful combination that shows off why the best Shortcuts support is from developers who don’t try to anticipate every possible use of their Shortcuts actions. Instead, they provide lots of actions combined with parameters to maximize their flexibility in the hands of creative users with an idea.
However, the icing on the cake is Channels’ virtual channels. There’s something extra fun about having your own TV channel. It’s a throwback with a retro vibe in a world of streaming TV that fits perfectly with the notion of recreating what MTV once was.
myTunes uses two third-party apps, Play and Downie, to download YouTube videos tagged in Play with ‘music-video,’ and then remove the tag. myTunes can be used in combination with the third-party app Channels to automate the process of creating a virtual music video channel. Details on how to set up a Virtual Channel can be found in the story that accompanies this shortcut on MacStories.net.