Skip to content

Instantly share code, notes, and snippets.

@pjmagee
Created May 15, 2014 20:24
Show Gist options
  • Select an option

  • Save pjmagee/748f485ecec355f6bdc8 to your computer and use it in GitHub Desktop.

Select an option

Save pjmagee/748f485ecec355f6bdc8 to your computer and use it in GitHub Desktop.
void Main()
{
var seriesFolders = Directory.GetDirectories(@"\\diskstation\video\TV Shows", "*Season*", SearchOption.AllDirectories);
var shows = seriesFolders.GroupBy(season => season.Split(new[] { " Season " }, StringSplitOptions.RemoveEmptyEntries).First()).AsEnumerable();
var series = shows.Select(grp => grp.Last());
var files = series.SelectMany(directory => new DirectoryInfo(directory).GetFiles()).Where(f => IsMediaExtension(f) && IsInRange(f) && IsWanted(f));
files.Select(f => new Hyperlinq(() => Process.Start(new ProcessStartInfo(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", "\"" + f.FullName + "\"")), f.Name)).Dump("Episodes");
var arguments = string.Join(" ", files.Select(file => "\"" + file.FullName + "\"").Concat(new [] { "--fullscreen" }));
new Hyperlinq(() => Process.Start(new ProcessStartInfo(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", arguments)), "Playlist").Dump();
}
public bool IsMediaExtension(FileInfo f)
{
return f.Extension == ".mkv" || f.Extension == ".mp4" || f.Extension == ".avi";
}
public bool IsInRange(FileInfo f)
{
return f.CreationTime.Date > DateTime.Today.AddDays(-6) && f.CreationTime.Date < DateTime.Today.AddDays(30);
}
public bool IsWanted(FileInfo f)
{
return Series.Any(series => f.FullName.Contains(series));
}
public static string[] Series =
{
"Continuum", "Californication",
"Bobs Burgers", "Family Guy", "American Dad",
"Blacklist", "The 100", "The Walking Dead",
"Believe", "The Tomorrow People",
"Legit", "Bates Motel",
"Arrow", "Elementary",
"Hannibal", "Gang Related",
"Cops"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment