Skip to content

Commit

Permalink
Merge pull request #9 from feuster/V2.7
Browse files Browse the repository at this point in the history
V2.7
  • Loading branch information
feuster authored Apr 10, 2024
2 parents 00ad7db + 1700749 commit 490c720
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
4 changes: 2 additions & 2 deletions FFchapters2/FFchapters2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ErrorReport>none</ErrorReport>
<AssemblyVersion>2.0.0.6</AssemblyVersion>
<FileVersion>2.0.0.6</FileVersion>
<AssemblyVersion>2.0.0.7</AssemblyVersion>
<FileVersion>2.0.0.7</FileVersion>
<SignAssembly>False</SignAssembly>
<Title>FFchapters2</Title>
<Company>Feuster</Company>
Expand Down
58 changes: 56 additions & 2 deletions FFchapters2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Options>(o =>
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
{
Expand All @@ -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")]
Expand All @@ -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

Expand Down
9 changes: 6 additions & 3 deletions MANUAL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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.
Expand All @@ -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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,5 +31,12 @@ FFchapters2 is licensed under [GPL-2.0-only](./LICENSE).

© Alexander Feuster 2023-2024

## Running Demo
## Demo screenshots
<p align="center">Chapter creation</p>

![Running Demo](./Running.gif)
\
<p align="center">Chapter validation</p>

![Validation Demo](./Validation.png)

Binary file added Validation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 490c720

Please sign in to comment.