View Single Post
Old 10-13-2010, 12:52 PM   #103
badbob001
Fanatic
badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.
 
badbob001's Avatar
 
Posts: 556
Karma: 1102020
Join Date: Sep 2009
Device: Kindle Keyboard (rip), Kindle Voyage, Fire Tablet 10 '17, iPad '19
Not one canti configuration matches all my conversion needs and so I've updated my script to support multiple configuration files:

If Canti.properties is:
  1. Found within the folder that is being sent to Canti, then that one will be used.
  2. Found in the same folder level as the source folder or archive, then that one will be used.
  3. Found where Canti is located, then that one will be used.
  4. Not found, then user will be prompted to create one.

The above list is ordered so the first found properties file takes priority over the ones below. The following may be insulting to the intelligence of the forum members, but what the hell.

Quote:
Code:
+-- Comic01.cbz
|
+- canti.properties [2]
|
+-+ Folder_of_Comics\
| |
| +-- Comic02.cbz
| |
| +-- Comic03.cbz
| |
| +-- canti.properties [1]
|
+-+ Canti_folder\
  |
  +-- canti.jar
  |
  +-- run.cmd
  |
  +-- canti.properties [3]
If Folder_of_Comics was dragged, canti.properties [1] would be used. If that didn't exist, then canti.properties [2] would be used.
If Comic01.cbz was dragged, canti.properties [2] would be used.
If Comic02.cbz was dragged, canti.properties [1] would be used.
If canti.properties [2] and [1] didn't exist, then canti.properties [3] would be used.

Other changes:
  • Supported device list is no longer hard-coded and is extracted from the output of Canti.

Code:
@echo off
echo Script start...
set jar=canti.jar
set prop=Canti.properties

if !%1!==!! goto:usage

set parent_folder="%~1"
set title="%~n1"
set current_folder="%~dp0"
set jar="%~dp0%jar%"
set output_folder="%~dp0%~n1\"

:prop_check
if exist "%~1\%prop%" set prop="%~1\%prop%"& echo * Found Canti.properties in source subfolder& goto:prop_ok
if exist "%~1\..\%prop%" set prop="%~1\..\%prop%"& echo * Found Canti.properties in source folder& goto:prop_ok
if exist "%~dp0%prop%" set prop="%~dp0%prop%"& echo * Found Canti.properties in current folder& goto:prop_ok

echo - Setup ----------------
echo * Canti.Properties file does not exist. Please type in the device you have from the following list:
java -jar %jar% | find "Acceptable [device_name]"
echo.
:prop_setup
set /p device=Your Device: 
if !%device%!==!! goto:prop_setup
java -jar %jar% -create_properties %device%
if exist "%userprofile%\canti.properties" echo Moving canti.properties file to current folder& move /y "%userprofile%\canti.properties" %current_folder%
goto:prop_check

:prop_ok
set prop=%prop:\=\\%
set parent_folder=%parent_folder:\=\\%
set output_folder=%output_folder:\=\\%
echo - Parameters ----------------
echo * jar=%jar%
echo * prop=%prop%
echo * parent_folder=%parent_folder%
echo * title=%title%
echo * output_folder=%output_folder%
echo.
echo - To Run ----------------
set to_run=java -jar %jar% -properties %prop% -parent_folder %parent_folder% -title %title% -output_folder %output_folder%
echo %to_run%
echo.
pause
%to_run%
goto:end

:usage
echo * Usage: Drag a single folder or archive onto script.
goto:end

:end
echo ...Script end.
pause
Anyone actually using this?
badbob001 is offline   Reply With Quote