Added option to copy all non compressed files

Added support for BMP files
This commit is contained in:
Marco Giuntoni
2024-05-16 17:53:27 +02:00
parent c6954071c8
commit a47e881432
2 changed files with 23 additions and 2 deletions
+22 -1
View File
@@ -68,6 +68,10 @@ namespace ComicCompressor
[Option("-j|--image", Description = "process images only")]
public bool DoImage { get; } = false;
[Option("-a|--copyall", Description = "copy all unprocessed files")]
public bool DoCopyAll { get; } = false;
#endregion
#region STATISTICS
@@ -206,6 +210,7 @@ namespace ComicCompressor
var relativePath = Path.GetRelativePath(Input, filename);
var outputPath = Path.Join(OutputFolder, Path.ChangeExtension(relativePath, "cbz"));
var outputPath_webp = Path.Join(OutputFolder, Path.ChangeExtension(relativePath, "webp"));
var outputPath_same = Path.Join(OutputFolder, relativePath);
int digits = 1+(int)Math.Floor(Math.Log((Double)total) / Math.Log(10.0));
string print_line_header = "";
@@ -288,6 +293,7 @@ namespace ComicCompressor
filename.ToLower().EndsWith("jpg") ||
filename.ToLower().EndsWith("jpeg") ||
filename.ToLower().EndsWith("tif") ||
filename.ToLower().EndsWith("bmp") ||
filename.ToLower().EndsWith("png"))
{
outputPath = Path.Join(OutputFolder, Path.ChangeExtension(relativePath, "webp"));
@@ -316,7 +322,22 @@ namespace ComicCompressor
if (!filename.ToLower().EndsWith(".cbr") && !filename.ToLower().EndsWith(".cbz"))
{
Logger.Log(relativePath, LogLevel.Verbose, true, Color.LightYellow);
// COPY FILE
if(DoCopyAll)
{
Directory.CreateDirectory(Path.GetDirectoryName(outputPath_same));
if (File.Exists(outputPath_same))
Logger.Log(outputPath_same, LogLevel.Verbose, true, Color.LightYellow);
else
{
File.Copy(filename, outputPath_same, true);
Logger.Log(outputPath_same, LogLevel.Verbose, true, Color.Orange);
}
}
else
Logger.Log(outputPath_same, LogLevel.Verbose, true, Color.LightYellow);
return;
}
+1 -1
View File
@@ -18,7 +18,7 @@
},
"ComicCompress": {
"commandName": "Project",
"commandLineArgs": "-i _IMG_ -o _IMG_WEBP_ -r -s "
"commandLineArgs": "-i _IMG_ -o _IMG_WEBP_ -r -s -d -a"
}
}
}