go-comic-converter icon indicating copy to clipboard operation
go-comic-converter copied to clipboard

Being able to pass a entire dir to process the files for the entire dir

Open fjglira opened this issue 11 months ago • 7 comments

I think it can be a good feature to add, we can set a new flag for example -isdirectory with default false and once we had this flag enable check all the files in the folder and convert all of them based in the current settings

fjglira avatar Dec 12 '24 20:12 fjglira

Forget it I think is already covered here: $ go-comic-converter -profile SR -input ~/Download/MyComic.[CBZ,ZIP,CBR,RAR,PDF]

fjglira avatar Dec 12 '24 20:12 fjglira

Checking the code:

// only accept jpg, png and webp as source file
func (e EPUBImageProcessor) isSupportedImage(path string) bool {
	switch strings.ToLower(filepath.Ext(path)) {
	case ".jpg", ".jpeg", ".png", ".webp", ".tiff":
		{
			return true
		}
	}
	return false
}

Directory only accepts this formats, when the user pass a directory I think should process any accepted format and convert each one to his equivalent epub file, not merge images into a epub. I'll take a look to the code and see if I can add this feature

fjglira avatar Dec 12 '24 21:12 fjglira

In order to decode an image, we need to load the extensions that can do that. That's why I have a list of supported extensions. It's the same between directory or zip/rar format. The for the epub, I convert it to jpeg or png depending on the format you choose. Kindle will keep jpeg as it is, and convert png to gif. I don't clearly understand what you try to achieve. You want to convert files of a directory into jpeg ?

celogeek avatar Dec 13 '24 07:12 celogeek

Or do you want to batch process several zip/rar ? In that case it's not supported for several reasons:

  • we support directory as input, similar to the content of a zip.
  • batch process can be achieved easily using find command.

find directory -name \*.cbz -exec go-comic-converter -input {} \;

celogeek avatar Dec 13 '24 07:12 celogeek

Or do you want to batch process several zip/rar ? In that case it's not supported for several reasons:

  • we support directory as input, similar to the content of a zip.
  • batch process can be achieved easily using find command.

find directory -name \*.cbz -exec go-comic-converter -input {} \;

Yes, I want to be able to process for example all the .cbz in the same directory without the need of running extra commands in the terminal. I found this tool from a friend Who knows zero about programming or terminal scripting, so, for people like him I think will be great to be able to process batch whitout the need of running extra things in the terminal. Or at least, I can add to the read me file How to do it from terminal on: Lunix, Windows and MacOs

fjglira avatar Dec 13 '24 11:12 fjglira

A contributor have made an UI here: https://github.com/manueldidonna/comic2books If you have a mac, that can help.

About scripting, this is a command line tools. so basic knowledge is required. At least to know how to run a command. For batch processing we are already in a more advanced command line knowledge.

Another way to do it is to prepare a list of commands to do in a text editor, and the run it one by one.

I can add a section for batch processing in the readme indeed. please fill free to do that, I will review

celogeek avatar Dec 13 '24 11:12 celogeek

Or do you want to batch process several zip/rar ? In that case it's not supported for several reasons:

* we support directory as input, similar to the content of a zip.

* batch process can be achieved easily using find command.

find directory -name \*.cbz -exec go-comic-converter -input {} \;

I found such command working for me:

forfiles /M *.cbr /C "cmd /c go-comic-converter -input @file"

szymoire avatar Apr 11 '25 07:04 szymoire