A quick powershell script to grab shows from specified folders, randomize completely the order, and insert bumpers in between episodes.
Run Get-Help
on the script!
{ | |
"MOCK" : [ | |
"F:\\Television\\Test\\*.mkv", | |
"F:\\Television\\Test2\\*\\*.mp4" | |
], | |
"DISCOVERY" : [ | |
"F:\\Television\\Test3\\*.mkv", | |
"F:\\Television\\Test4\\*\\*.mp4" | |
], | |
"ANIMATED" : [ | |
"F:\\Television\\Test5\\*.mkv", | |
"F:\\Television\\Test6\\*\\*.mp4" | |
], | |
"CARTOON" : [ | |
"F:\\Television\\Test7\\*.mkv", | |
"F:\\Television\\Test8\\*\\*.mp4" | |
] | |
} |
<# | |
.SYNOPSIS | |
Creates a playlist for VLC of TV episodes with bumpers automatically inserted between episodes. | |
.DESCRIPTION | |
Creates a playlist of television shows, writes that to a VLC playlist, and then loads it into VLC media player. By default it creates a block playlist, which uses a list of genres to randomly select shows. A marathon playlist can be specified instead, which plays one show sequentially, optionally starting in a specific season and episode. | |
#> | |
param( | |
# Specifies that we are running in Marathon mode. | |
[Parameter(ParameterSetName = 'Marathon', Mandatory=$true)] | |
[switch]$Marathon, | |
# Root folder all television shows are in. Needed for Marathon mode. | |
[Parameter(ParameterSetName = 'Marathon')] | |
[string]$ShowsFolder = "F:\Television", | |
# Show folder to marathon through | |
[Parameter(ParameterSetName = 'Marathon', Mandatory=$true)] | |
[string]$Show, | |
# Which season to begin in | |
[Parameter(ParameterSetName = 'Marathon')] | |
[int]$Season = 1, | |
# Which episode to start on | |
[Parameter(ParameterSetName = 'Marathon')] | |
[int]$Episode = 1, | |
# Index file that genre assignments for shows are written in. | |
[Parameter(ParameterSetName = 'Block')] | |
[string]$ShowIndexFile = "shows.json", | |
# Genre names to scour from the index file. | |
[Parameter(ParameterSetName = 'Block')] | |
[String[]]$Genres = ("MOCK", "DISCOVERY", "ANIMATED", "CARTOON"), | |
# How many episodes to watch | |
[Parameter(ParameterSetName = 'Block')] | |
[Parameter(ParameterSetName = 'Marathon')] | |
[int]$NumShows = 20, | |
# Skip using bumpers | |
[Parameter(ParameterSetName = 'Block')] | |
[Parameter(ParameterSetName = 'Marathon')] | |
[switch]$NoBumpers, | |
# Root folder for bumpers | |
[Parameter(ParameterSetName = 'Block')] | |
[Parameter(ParameterSetName = 'Marathon')] | |
[string]$BumperFolder = "D:\MEGA\Documents\Projects\Streaming\bumpers", | |
# Types of bumpers to use | |
[Parameter(ParameterSetName = 'Block')] | |
[Parameter(ParameterSetName = 'Marathon')] | |
[String[]]$Bumpers = ("Animation", "AU", "Fake", "Game", "Goof", "Latenight", "Retro", "When", "Wildlife") | |
) | |
$show_list = New-Object Collections.Generic.List[String] | |
if ($Marathon) { | |
$Season = $Season - 1 | |
$Episode = $Episode - 1 | |
$seasons = ls (Join-Path -Path $ShowsFolder -ChildPath $Show) | |
$seasons = $seasons[$Season..99] | |
$show_list = ls $seasons | |
$show_list = $show_list[$Episode..($Episode+$NumShows)] | |
} else { | |
$shows = Get-Content $ShowIndexFile | ConvertFrom-Json -AsHashtable | |
foreach ($genre in $Genres) { | |
foreach ($show in $shows[$genre]) { | |
ls $show | % { $show_list.add($_) } | |
} | |
} | |
$show_list = ($show_list | Sort-Object {Get-Random})[0..$NumShows] | |
} | |
if (!$NoBumpers) { | |
$bumps = New-Object Collections.Generic.List[String] | |
foreach ($type in $Bumpers) { | |
ls $BumperFolder\$type\*.* | % { $bumps.add($_) } | |
} | |
} | |
del -Force playlist.vlc | |
foreach ($show in $show_list) { | |
echo $show >> playlist.vlc | |
if (!$NoBumpers) { Get-Random -InputObject $bumps >> playlist.vlc } | |
} | |
vlc playlist.vlc |