diff --git a/FFchapters2/FFchapters2.csproj b/FFchapters2/FFchapters2.csproj index c1fec5d..8a91e7d 100644 --- a/FFchapters2/FFchapters2.csproj +++ b/FFchapters2/FFchapters2.csproj @@ -6,8 +6,8 @@ enable enable none - 2.0.0.6 - 2.0.0.6 + 2.0.0.7 + 2.0.0.7 False FFchapters2 Feuster diff --git a/FFchapters2/Program.cs b/FFchapters2/Program.cs index c85430a..1b4fbfc 100644 --- a/FFchapters2/Program.cs +++ b/FFchapters2/Program.cs @@ -38,9 +38,10 @@ bool ChapterStyle2 = false; bool RawChapters = false; bool ChapterDistributionAssumption = false; +bool Validate = false; bool OSLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); //GitVersion will be only be actualized/overwritten when using Cake build! -const string GitVersion = "git-61e5b51"; +const string GitVersion = "git-2a29976"; const string Homepage = "https://github.com/feuster/FFchapters2"; #if WINDOWS @@ -363,6 +364,12 @@ void unhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs a ChapterTitle = "Chapter"; AnsiConsole.MarkupLine($"[green]Chaptertitle: \"{ChapterTitle}\" (System Standard \"{buffer}\")[/]"); } + + if (o.Validate) + { + Validate = o.Validate; + AnsiConsole.MarkupLine($"[green]Validate: compare assumpted and created chapters when finished[/]"); + } }) .WithNotParsed(o => { @@ -911,6 +918,8 @@ void DataReadHandler(object sender, DataReceivedEventArgs e) #endregion #region End +if (Validate) + Validation(); AnsiConsole.Write(new Rule("[blue]Finished![/]")); Console.WriteLine(""); AnyKey(); @@ -1021,6 +1030,48 @@ bool WriteChapterDistributionAssumption(int MaxDuration) } #endregion +#region Validation +void Validation() +{ + //Show a table which compares the assumpted chapters with the real created chapters + AnsiConsole.Write(new Rule("[blue]Validation[/]")); + Console.WriteLine(""); + + //Check created chapters contain more then only the default start chapter at 0:00:00.000 + if (ChaptersRaw.Count < 2) + { + AnsiConsole.MarkupLine($"[White on Red]No chapters created![/]"); + Console.WriteLine(""); + return; + } + + //Create validation table + var table = new Table(); + table.Centered(); + table.Border(TableBorder.Rounded); + table.AddColumn(new TableColumn("Chapter").Centered()); + table.AddColumn(new TableColumn("Chapter assumpted").Centered()); + table.AddColumn(new TableColumn("Chapter created").Centered()); + for (int i = 1; i < ChaptersRaw.Count + 1; i++) + { + if (i < ChaptersRaw.Count) + { + TimeSpan ChapterAssumpted = TimeSpan.FromMinutes(i * Length / 60); + TimeSpan ChapterCreated = TimeSpan.Parse(ChaptersRaw[i]); + //add row and mark created chapter in yellow if the difference to the assumpted chapter is greater than 1 minute + if (ChapterAssumpted.Minutes == ChapterCreated.Minutes) + table.AddRow($"[White]Chapter {i}[/]", $"[Blue]{ChapterAssumpted.ToString(@"hh\:mm\:ss\:fff")}[/]", $"[green]{ChaptersRaw[i]}[/]"); + else + table.AddRow($"[White]Chapter {i}[/]", $"[Blue]{ChapterAssumpted.ToString(@"hh\:mm\:ss\:fff")}[/]", $"[yellow]{ChaptersRaw[i]}[/]"); + } + else + break; + } + AnsiConsole.Write(table); + Console.WriteLine(""); +} +#endregion + #region Options public class Options { @@ -1043,7 +1094,7 @@ public Options() { } [Option('o', "output", Default = "", Required = false, HelpText = "Set path to output chapter file")] public string ChapterFile { get; set; } = ""; - [Option('l', "length", Default = 5, Required = false, HelpText = "Set chapter length (time from chapter to next chapter) in minutes (1-60)")] + [Option('l', "length", Default = 5, Required = false, HelpText = "Set chapter length (time from chapter to next chapter) in minutes (1-60)\nA value of 0 will open the manual Chapter length menu")] public int ChapterLength { get; set; } [Option('c', "close", Default = false, Required = false, HelpText = "Close application automatically after chapter creation and on errors")] @@ -1060,6 +1111,9 @@ public Options() { } [Option('r', "raw", Default = false, Required = false, HelpText = "Use all raw scene changes (ignores option 'length')\nThis will additionally to the chapter files create a raw file with scene timestamps\nWARNING: this might lead to a huge count of chapters and is therefore not recommended for regular use!")] public bool RawChapters { get; set; } + + [Option('v', "validate", Default = false, Required = false, HelpText = "Validate assumpted chapters with created chapters")] + public bool Validate { get; set; } } #endregion diff --git a/MANUAL.txt b/MANUAL.txt index cbb8dae..4d7e7d2 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -6,13 +6,14 @@ -o, --output (Default: ) Set path to output chapter file - -l, --length (Default: 5) Set chapter length (time from chapter to next chapter) in minutes (1-30) + -l, --length (Default: 5) Set chapter length (time from chapter to next chapter) in minutes (1-60) + A value of 0 will open the manual Chapter length menu -c, --close (Default: false) Close application automatically after chapter creation and on errors -n, --nochapters (Default: false) Ignore existing chapters in video file - -t, --title (Default: ) Set chapter title (is used for all chapters) + -t, --title (Default: auto) Set chapter title (is used for all chapters) -s, --style (Default: all) Set chapter style (chapters, meta, all) [chapters = simple chapter format Matroska compatible, meta = METAINFO ffmpeg compatible] @@ -22,6 +23,8 @@ WARNING: this might lead to a huge count of chapters and is therefore not recommended for regular use! + -v, --validate (Default: false) Validate assumpted chapters with created chapters + --help Display this help screen. --version Display version information. @@ -44,6 +47,6 @@ https://www.nerdfonts.com/ ────────────────────────────────────────────────────── Copyright ─────────────────────────────────────────────────────── -Based on FFchapters2 V2.6 +Based on FFchapters2 V2.7 https://github.com/feuster/FFchapters2 © Alexander Feuster 2023-2024 diff --git a/README.md b/README.md index 1c4a3c3..b431811 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ As alternative you can use the [AddChaptersToMovieFile.cmd](./AddChaptersToMovie There is also the optional raw mode creates an additional timestamp raw file for independent use. +An optional validation can inform you if the created chapters differ from the chapter assumption. + ## FFmpeg Installation The required FFmpeg is not be bundled with the FFchapters2 Linux release. In that case or if you intend to use another ffmpeg binary for the Windows version you can download a FFmpeg binary @@ -29,5 +31,12 @@ FFchapters2 is licensed under [GPL-2.0-only](./LICENSE). © Alexander Feuster 2023-2024 -## Running Demo +## Demo screenshots +

Chapter creation

+ ![Running Demo](./Running.gif) +\ +

Chapter validation

+ +![Validation Demo](./Validation.png) + diff --git a/Validation.png b/Validation.png new file mode 100644 index 0000000..ae24497 Binary files /dev/null and b/Validation.png differ