ebook_homebrew package

Submodules

ebook_homebrew.archive module

Create archive file.

class ebook_homebrew.archive.MakeArchive(extension, directory_path=None)[source]

Bases: ebook_homebrew.core.Common

Make archive file.

make_zip(filename, remove_flag=False, overwrite=False)[source]

Make zip file for adding specify extension files.

Make zip file for files which you choose extension.

Parameters:
  • filename (str) – Zip file name
  • remove_flag (bool) – If true, remove original files
  • overwrite (bool) – If true, overwrite zip file even if exist same name file
Returns:

If success, return true.

Return type:

bool

ebook_homebrew.cli module

ebook_homebrew.cli.execute_auto(args_auto)[source]
ebook_homebrew.cli.main()[source]

ebook_homebrew.convert module

Convert file format.

class ebook_homebrew.convert.Image2PDF(digits, extension, directory_path=None)[source]

Bases: ebook_homebrew.core.Common

Make pdf file for using e-books.

make_pdf(filename, remove_flag=False)[source]

Make pdf file take in some image files.

Make pdf file which you use e-books by take in some image files such as jpeg, png and gif.

Parameters:
  • filename (str) – pdf file name
  • remove_flag (bool) – If true, original image file is deleted
Returns:

If success, return true.

Return type:

bool

ebook_homebrew.core module

Core module

class ebook_homebrew.core.Common[source]

Bases: object

Common Class

move_file(file, dst, assume_yes)[source]

Move file

Parameters:
  • file (str) – Target file name
  • dst (str) – Target destination path
  • assume_yes (bool) – If true, no verify users
Returns:

If success, return true. Nothing target, return false.

Return type:

bool

ebook_homebrew.exceptions module

Exception Classes

exception ebook_homebrew.exceptions.BaseError[source]

Bases: Exception

Base error

exception ebook_homebrew.exceptions.ChangeFileNameError(error_class, message)[source]

Bases: ebook_homebrew.exceptions.BaseError

rename::ChangeFileName module error

exception ebook_homebrew.exceptions.ChangeFileNameOSError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

exception ebook_homebrew.exceptions.InvalidDigitsFormatError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

Invalid serial number digit value error

exception ebook_homebrew.exceptions.InvalidExtensionTypeError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

Invalid Extension Type error

exception ebook_homebrew.exceptions.InvalidImageFileFormatError[source]

Bases: ebook_homebrew.exceptions.MakePDFError

exception ebook_homebrew.exceptions.InvalidImageParameterTypeError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

exception ebook_homebrew.exceptions.InvalidNumberParameterTypeError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

To create new file name, must be used ‘Integer’ error

exception ebook_homebrew.exceptions.InvalidPathTypeError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

Invalid Path string Type error

exception ebook_homebrew.exceptions.MakePDFError(error_class, message)[source]

Bases: ebook_homebrew.exceptions.BaseError

convert::MakePDF module error

exception ebook_homebrew.exceptions.MakeZIPError(error_class, message)[source]

Bases: ebook_homebrew.exceptions.BaseError

archive::MakeZip module error

exception ebook_homebrew.exceptions.TargetSrcFileNotFoundError[source]

Bases: ebook_homebrew.exceptions.ChangeFileNameError

Source directory you choose is no Target file error

exception ebook_homebrew.exceptions.ZipFileExistError[source]

Bases: ebook_homebrew.exceptions.MakeZIPError

Zip file already exist error

ebook_homebrew.helper module

Provides helper for command line interface

ebook_homebrew.helper.auto(args)[source]

Rename file, convert pdf.

Parameters:args – argparse namespace object
Returns:If success, return true.
Return type:bool
ebook_homebrew.helper.make_zip(args)[source]

Make zip file

Parameters:args – argparse namespace object
Returns:If success, return true.
Return type:bool
ebook_homebrew.helper.show_version()[source]

Show version

ebook_homebrew.rename module

Rename file name.

class ebook_homebrew.rename.ChangeFilename(directory_path, digits, extension)[source]

Bases: ebook_homebrew.core.Common

Change file name to only digit name.

add_before_after_str(before, after)[source]

Add file name specify string.

After changing file name for filename_to_digit_number() method, add specify string before or after file name.

Parameters:
  • before (str) – String before file name
  • after (str) – String after file name
Returns:

If success, return True.

Return type:

bool

async_filename_to_digit_number()[source]

Change file name to only digit name on async.

If use this function, a little bit speedy compare with filename_to_digit_number function.

Returns:Skipping files list by exists same name.
Return type:List[str]
change_name_manually(overwrite=False)[source]

Change filename manually looking exist_file list.

After changing file name for filename_to_digit_number() method, duplicate file name change manually.

Parameters:overwrite (bool) – If true, overwrite file name even if exist same name file.
Returns:If success, return True.
Return type:bool
filename_to_digit_number()[source]

Change file name to only digit name.

Change file name contains digit like “foo001bar.txt” to only digit file name like “001.txt”.

Returns:Skipping files list by exists same name.
Return type:List[str]

Module contents