:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 'MakeChaps.bat' GENERAL USAGE:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Copy chapter data into '[InputFileName].txt'. Default is 'MyFile.txt'
IF FILE EXISTS.

Refer to format examples below. 1st line, 'Menu' is NOT necessary, but
most data I've found includes it & it is ignored.

Save. Execute 'MakeChaps.bat'.


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: NO args
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


D:\MediaTemp\- test -\MakeChaps>MakeChaps.bat

Defaults to 'MyFile.txt' (IF FILE EXISTS) used as input. 

'MyFile.chapters.txt' is output.


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Input file named anything other than 'MyFile.txt' specified
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


D:\MediaTemp\- test -\MakeChaps>MakeChaps.bat "Generic.txt"

'Generic.txt' is used as input. 

'Generic.chapters.txt' is output.


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Input file via shortcut
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Create a windows shortcut to 'MakeChaps.bat'.

Move shortcut to ANY working location. 

** OPEN shortcut 'Properties' & CHANGE 'Start in' to "%CD%". **

Create an input file named anything (e.g. 'Alita- Battle Angel (2019).txt'). 

Save. 

Drag 'Alita- Battle Angel (2019).txt' to shortcut.

'Alita- Battle Angel (2019).txt' is used as input. 

'Alita- Battle Angel (2019).chapters.txt' is output.


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Bulk processing
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Verify shortcut 'Properties' have been changed to 'Start in' "%CD%".

Select & drag multiple input files/directories (containing input files) 
to shortcut for bulk processing of '*.chapter.txt' files.


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: GENERAL EXAMPLES:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Based on the following examples, the user can set default output behavior:

::  "Dflt=0" - Use 'Chapter 1-X' / =1" - Use 'Chapter 01-XX' format
SET "Dflt=0" <== Change this value to preferred 'Dflt' option in .bat

::  "Mode=2" - Use existing chapter names, INCLUDING blank, NO mods
::  "Mode=1" - Use existing chapter names, EXCEPT blank... use 'Dflt'
::  "Mode=0" - Ignore existing chapter names & use 'Dflt' format
SET "Mode=0" <== Change this value to preferred 'Mode' option in .bat

::  "LogQ=0" - NO logging / =1" - Generate basic process log
SET "LogQ=0" <== Change this value to '1' to generate log
SET "LogDate=%DATE:~10,4%-%DATE:~7,2%-%DATE:~4,2%"
SET "LogTime=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2%"
SET "LogFile=%~n0.%LogDate%_%LogTime%.log"

SET "MxFS=2200" <== Change this value IF legit files are filtered

I've found different input variations & the following is what I've chosen 
to support & how it's handled.

Menu
00:00:00.000 : en:Main Titles
00:02:06.168 : en:Cynthia
00:05:55.981 : en:Annie
...

Note:	Chapter names SHOULD be PLAINTEXT, NO QUOTES, ESCAPES, ETC..
		Strange translations AND/OR FAILURES MAY occur.
		
		I've included a simple filter to strip out SOME unwanted characters.
		but it only handles things I've encountered...
		
		SET "Line=%%L" && FOR %%R IN (^\ ^") DO ( SET "Line=!Line:%%R=!" )


Output (Mode1-2):

CHAPTER01=00:00:00.000
CHAPTER01NAME=Main Titles
CHAPTER02=00:02:06.168
CHAPTER02NAME=Cynthia
CHAPTER03=00:05:55.981
CHAPTER03NAME=Annie
...


- or -

Menu
00:00:00.000 : :Chapter 01
00:02:54.216 : :Chapter 02
00:04:54.419 : :Chapter 03
...


Output (Mode=1-2):

CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 01
CHAPTER02=00:02:54.216
CHAPTER02NAME=Chapter 02
CHAPTER03=00:04:54.419
CHAPTER03NAME=Chapter 03
...


- or -

Menu
00:00:00.000 : :Chapter 1
00:02:54.216 : :Chapter 2
00:04:54.419 : :Chapter 3
...


Output (Mode=1-2):

CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 1
CHAPTER02=00:02:54.216
CHAPTER02NAME=Chapter 2
CHAPTER03=00:04:54.419
CHAPTER03NAME=Chapter 3
...


- or -

Menu
00:00:00.000 : :00:00:00.000
00:02:06.168 : :00:02:06.168
00:05:55.981 : :00:05:55.981
...


Output (Mode=1-2):

CHAPTER01=00:00:00.000
CHAPTER01NAME=00:00:00.000
CHAPTER02=00:02:06.168
CHAPTER02NAME=00:02:06.168
CHAPTER03=00:05:55.981
CHAPTER03NAME=00:05:55.981
...


- or -

Menu
00:00:00.000
00:02:06.168
00:05:55.981
...


Output (Mode=1):

CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 1
CHAPTER02=00:02:06.168
CHAPTER02NAME=Chapter 2
CHAPTER03=00:05:55.981
CHAPTER03NAME=Chapter 3
...


Output (Mode=2, 'mkvtoolnix' applies "Chapter 01-xx" names for blank on import):

CHAPTER01=00:00:00.000
CHAPTER01NAME=
CHAPTER02=00:02:06.168
CHAPTER02NAME=
CHAPTER03=00:05:55.981
CHAPTER03NAME=
...


Output ** FOR ANY ** (Mode=0):

CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 1
CHAPTER02=00:02:06.168
CHAPTER02NAME=Chapter 2
CHAPTER03=00:05:55.981
CHAPTER03NAME=Chapter 3
...


Notes:	Most output is in the 'CHAPTERxxNAME=Chapter x' format, but the
		option to include 'descriptive' chapter names was requested.
		
		'[InputFileName].chapters.txt' is now useable by 'mkvtoolnix'.
		
		To avoid accidental deletion/modification of potential input files,
		before a file can be queued for processing, it MUST satisfy the
		following criteria:
		
		- exists (sanity check for manual commmand line entries)
		- is NOT a README, or .chapters. file
		- filesize is NOT greater than 2000B
		- .txt file MUST actually contain chapter 'mark' (timestamp) data
		
		Refer to ':: Input file via shortcut' & ':: Bulk processing' sections 
		for details.

