merge push
This commit is contained in:
+22
-26
@@ -22,7 +22,7 @@ using Xabe.FFmpeg;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Common;
|
||||
using itext.pdfimage.Extensions;
|
||||
//using itext.pdfimage.Extensions;
|
||||
using org.omg.PortableInterceptor;
|
||||
using org.apache.pdfbox.util.@operator;
|
||||
using java.nio;
|
||||
@@ -40,12 +40,15 @@ using iMGcompress_core;
|
||||
|
||||
|
||||
|
||||
using iMGcompress_core;
|
||||
using Compressor = iMGcompress_core.Compressor;
|
||||
|
||||
namespace ComicCompressor
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
||||
// string progVersion = "Version 2.0.0 - (04/07/2024)";
|
||||
// string progVersion = "Version 2.0.0 - (04/07/2024)";
|
||||
|
||||
// Added copy of non image files with same name
|
||||
//string progVersion = "Version 2.0.1 - (12/08/2024)";
|
||||
@@ -54,8 +57,13 @@ namespace ComicCompressor
|
||||
//string progVersion = "Version 2.0.2 - (27/08/2024)";
|
||||
|
||||
// Completed support for ZEBRA PRN files, generate image and base64 for prn and image. Using URI format for base64 files
|
||||
string progVersion = "Version 2.1.0 - (28/08/2024)";
|
||||
//string progVersion = "Version 2.1.0 - (28/08/2024)";
|
||||
|
||||
// Moved functionalities to library iMGcompress-core
|
||||
//string progVersion = "Version 3.0.0 - (21/11/2024)";
|
||||
|
||||
// In core changed color of percent save to white
|
||||
string progVersion = "Version 3.0.1 - (23/01/2025)";
|
||||
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
|
||||
|
||||
#region INPUT_FLAGS
|
||||
@@ -84,7 +92,6 @@ namespace ComicCompressor
|
||||
[Option("-c|--cpu", Description = "Run in parallel, use given number of CPUs")]
|
||||
public int NumOfCpu { get; } = Environment.ProcessorCount;
|
||||
|
||||
|
||||
[Option("-d|--pdf", Description = "Process pdf only")]
|
||||
public bool DoPdf { get; } = false;
|
||||
|
||||
@@ -100,18 +107,6 @@ namespace ComicCompressor
|
||||
|
||||
#region STATISTICS
|
||||
|
||||
public class file_stat
|
||||
{
|
||||
public string Filename { get; set; }
|
||||
public file_stat(string filename) {
|
||||
Filename = filename;
|
||||
}
|
||||
public long Uncompressed_file_len { get; set; }
|
||||
public long Compressed_file_len { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
static Dictionary <string, file_stat> file_statistics = new Dictionary<string, file_stat>();
|
||||
public static Dictionary<string, file_stat> File_statistics { get => file_statistics; set => file_statistics = value; }
|
||||
|
||||
@@ -169,13 +164,14 @@ namespace ComicCompressor
|
||||
|
||||
Logger.Log(progVersion, LogLevel.Verbose, true);
|
||||
|
||||
var progress = new Progress<ProgressInfo>( p => Logger.Log(p.ToString(), LogLevel.Verbose, true) );
|
||||
FFmpeg.SetExecutablesPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
|
||||
FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official,progress);
|
||||
//var progress = new Progress<ProgressInfo>( p => Logger.Log(p.ToString(), LogLevel.Verbose, true) );
|
||||
//FFmpeg.SetExecutablesPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
|
||||
//FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official,progress);
|
||||
|
||||
|
||||
//FFmpeg.SetExecutablesPath (Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FFmpeg"));
|
||||
Logger.Log(FFmpeg.ExecutablesPath, LogLevel.Verbose, true);
|
||||
//==//FFmpeg.SetExecutablesPath (Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FFmpeg"));
|
||||
|
||||
//Logger.Log(FFmpeg.ExecutablesPath, LogLevel.Verbose, true);
|
||||
|
||||
|
||||
IList<string> files = new FileParser().ListAllFiles(Input, Recursive);
|
||||
@@ -299,7 +295,7 @@ namespace ComicCompressor
|
||||
{
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -316,7 +312,7 @@ namespace ComicCompressor
|
||||
{
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath_webp).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -336,7 +332,7 @@ namespace ComicCompressor
|
||||
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -422,7 +418,7 @@ namespace ComicCompressor
|
||||
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -464,7 +460,7 @@ namespace ComicCompressor
|
||||
|
||||
try
|
||||
{
|
||||
compressor.Compress(filename, outputPath);
|
||||
compressor.Compress(filename, outputPath, file_statistics);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user