39 lines
1.8 KiB
C#
39 lines
1.8 KiB
C#
using System.Text;
|
|
|
|
namespace LetterBoxdUnwatchedGenerator
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
DirectoryInfo di = new DirectoryInfo(@"A:\Video\Movies\All");
|
|
var localMovies = di.EnumerateDirectories().Select(di => LocalMovie.FromDirectory(di.Name, di.FullName)).ToList();
|
|
|
|
var watchedMovies = LetterBoxdWatchedMovie.FromFile(@"A:\homes\@DH-ARNEHOME\0\arne-1103\Documents\Inactive\2023-07-01 Letterboxd download\letterboxd-thearne4-2023-07-01-10-32-utc\watched.csv");
|
|
|
|
var unwatchedMovies = localMovies.Where(lm => !watchedMovies.Any(wm => lm.Title.Replace("-", "").Replace("(", "").Replace(")", "").Replace(" ", "").ToLowerInvariant().EndsWith(wm.Title.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("\"", "").Replace("?", "").Replace("<", "").Replace(">", "").Replace("|", "").Replace("-", "").Replace(" ", "").ToLowerInvariant()) && wm.Year == lm.Year));
|
|
|
|
WriteToCsv(@"A:\homes\@DH-ARNEHOME\0\arne-1103\Documents\Inactive\2023-07-01 Letterboxd download\local-unwatched.csv", unwatchedMovies);
|
|
|
|
//unwatchedMovies.ForEach(um => Console.WriteLine(um.Title));
|
|
|
|
Console.WriteLine("-------------");
|
|
Console.WriteLine($"Total: {unwatchedMovies.Count()}");
|
|
Console.ReadKey();
|
|
}
|
|
static void WriteToCsv(string path, IEnumerable<IMovie> unwatchedMovies)
|
|
{
|
|
StringBuilder sb = new();
|
|
sb.AppendLine("Title,Year");
|
|
foreach (IMovie movie in unwatchedMovies)
|
|
{
|
|
var title = movie.Title.Contains(',') ? $"\"{movie.Title}\"" : movie.Title;
|
|
var year = movie.Year == 0 ? "" : movie.Year.ToString();
|
|
|
|
sb.AppendLine($"{title},{year}");
|
|
}
|
|
|
|
File.WriteAllText(path, sb.ToString());
|
|
}
|
|
}
|
|
} |