https:\/\/www.youtube.com\/watch?v=H6o6ZlefvOo<\/a><\/p>\nBetween those two videos, you can probably envision what I wanted to create. Based on the parameters you feed it, the script randomly plucks a few commercials, a few trailers, and whatever else you tell it to add. When it’s done, it creates a playlist that you only need to click on to sit back and enjoy the program! One other feature I added is that the movie trailers it selects are close to the same year as the movie I’m going to watch. I programmed in a tiny bit of leeway, but in general the trailers it picks will be from a year or two before or a year or two after the year the film was released. <\/p>\n
It may seem odd to actually want to watch commercials and movie trailers, but having them presented in a random order really makes the home viewing experience much more theater-like. Plus, sometimes I find myself as nostalgic for the old commercials as I am for the old movies!<\/p>\n
Part Two: How Does it Work?<\/b><\/p>\n
Here we go.<\/p>\n
Accompanying the script is a small text file (think of it like an old ini file) that contains the paths to all of my videos by category. It contains one additional variable (“YearVariance”) which tells the trailer portion how wide a bracket to pick trailers from. I currently have mine set on “2”, so if I pick a movie from 1984, it’ll randomly pick trailers for movies between 1982 and 1986.<\/p>\n
The second half of the text file is the structure of the generated playlist. You can use commands like “add-commercial,” “add-trailer,” and “add-policy” to add those types of videos to the playlist. You can put them in any order you wish, and list them multiple times to get multiple videos added. Here’s the default setting:<\/p>\n
Add-Required1
\nAdd-Commercial
\nAdd-Commercial
\nAdd-Trailer
\nAdd-Trailer
\nAdd-Trailer
\nAdd-Policy
\nAdd-Feature<\/i><\/p>\n
“Required1” is a hard coded link to a specific video (mine says “O’Hara Cinema”) that I want added to every single playlist. There’s a “Required2” slot as well, but I’m not currently using it.<\/p>\n
Because cutting and pasting the entire path to my video files was more cumbersome than I had anticipated, the script also supports wildcards. I can run the script with a partial filename and it will find the first match and use it as the movie. It’s not perfect (I typed TRON<\/b> and got “The STRON<\/b>gest Man in the World) but if you put enough of the file name in there, it’ll usually find it.<\/p>\n
To get age-appropriate trailers to work, I had to add the year to the filename of every single trailer (the ones I got from my friend already had the year; the ones I got from YouTube did not). I also have the year in my movie filenames, so it was just a matter of splitting filenames by parenthesis to pluck out the years, converting them to integers, and doing the math. <\/p>\n
Here’s an example I just ran to generate a playlist for 1984’s Ghostbusters (with the real path edited out).<\/p>\n
#EXTM3U
\nS:\\(path)\\Trailers\\OHara_Cinemas.mp4
\nS:\\(path)\\Trailers\\Commercials\\Food and Drink\\Hot Chocolate (1960s).mp4
\nS:\\(path)\\Trailers\\Commercials\\Intermission\\Drive In Short Film Intermission Promo 12.mpg
\nS:\\(path)\\Trailers\\Trailers\\1982 – The Toy Trailer.mp4
\nS:\\(path)\\Trailers\\Trailers\\1985 – Rocky IV Trailer.m4v
\nS:\\(path)\\Trailers\\Trailers\\1984 – Gremlins Reissue Trailer.m4v
\nS:\\(path)\\Trailers\\Policy_Trailers\\Marcus Theatres Policy Trailer.m4v
\nS:\\(path)\\Trailers\\Feature_Presentation\\AMC Theatres Feature Presentation (1996 – 2002).mp4
\nS:\\(path)\\Ghostbusters 1 (1984).avi<\/i><\/p>\n
As you can see, the generated playlist matches the format of the command list from before (required video, two commercials, three trailers, one policy, and one feature presentation video). The selected movie is automatically appended to the end of the playlist.<\/p>\n
I’m planning on running either Kodi or Plex in my real movie room once construction ends, and I’ll need to change the output of the files to indirect patches instead of hard coded direct paths. This should be an easy change. I know Kodi has a folder for playlists, which I’m assuming this can be slipped directly into.<\/p>\n
If anybody wants to play with it now, shoot me an email and I will send you the files, although unless your files and folders are set up like mine, it may take considerable modification to work in your environment.<\/p>\n","protected":false},"excerpt":{"rendered":"
I love watching movies, but miss the theater experience — and by that I mean trailers and concession commercials, not gum on the floor, people talking, and kids kicking the back of my seat. I decided to write a script using PowerShell to try and enhance my home movie experience. The result, which I’ve named MovieNight.ps1, is pretty neat! I’m splitting today’s blog post into two parts. The first half will be the fun half where I talk about what the script does. The first half won’t be technical at all. In the second half I’ll get into the technical… (read more)<\/a><\/p>\n","protected":false},"author":1,"featured_media":12266,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,148],"tags":[],"class_list":["post-12261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-main","category-powershell"],"_links":{"self":[{"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/posts\/12261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robohara.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12261"}],"version-history":[{"count":6,"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/posts\/12261\/revisions"}],"predecessor-version":[{"id":12268,"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/posts\/12261\/revisions\/12268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.robohara.com\/index.php?rest_route=\/wp\/v2\/media\/12266"}],"wp:attachment":[{"href":"https:\/\/www.robohara.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robohara.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robohara.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}