ebook_homebrew package¶
Subpackages¶
Submodules¶
ebook_homebrew.archive module¶
Create archive file.
-
class
ebook_homebrew.archive.MakeArchive(extension, directory_path=None)[source]¶ Bases:
ebook_homebrew.core.CommonMake archive file.
ebook_homebrew.cli module¶
ebook_homebrew.convert module¶
Convert file format.
-
class
ebook_homebrew.convert.Image2PDF(digits, extension, directory_path=None)[source]¶ Bases:
ebook_homebrew.core.CommonMake pdf file for using e-books.
ebook_homebrew.core module¶
Core module
ebook_homebrew.exceptions module¶
Exception Classes
-
exception
ebook_homebrew.exceptions.ChangeFileNameError(error_class, message)[source]¶ Bases:
ebook_homebrew.exceptions.BaseErrorrename::ChangeFileName module error
-
exception
ebook_homebrew.exceptions.InvalidDigitsFormatError[source]¶ Bases:
ebook_homebrew.exceptions.ChangeFileNameErrorInvalid serial number digit value error
-
exception
ebook_homebrew.exceptions.InvalidExtensionTypeError[source]¶ Bases:
ebook_homebrew.exceptions.ChangeFileNameErrorInvalid Extension Type error
-
exception
ebook_homebrew.exceptions.InvalidNumberParameterTypeError[source]¶ Bases:
ebook_homebrew.exceptions.ChangeFileNameErrorTo create new file name, must be used ‘Integer’ error
-
exception
ebook_homebrew.exceptions.InvalidPathTypeError[source]¶ Bases:
ebook_homebrew.exceptions.ChangeFileNameErrorInvalid Path string Type error
-
exception
ebook_homebrew.exceptions.MakePDFError(error_class, message)[source]¶ Bases:
ebook_homebrew.exceptions.BaseErrorconvert::MakePDF module error
-
exception
ebook_homebrew.exceptions.MakeZIPError(error_class, message)[source]¶ Bases:
ebook_homebrew.exceptions.BaseErrorarchive::MakeZip module error
-
exception
ebook_homebrew.exceptions.TargetSrcFileNotFoundError[source]¶ Bases:
ebook_homebrew.exceptions.ChangeFileNameErrorSource directory you choose is no Target file error
-
exception
ebook_homebrew.exceptions.ZipFileExistError[source]¶ Bases:
ebook_homebrew.exceptions.MakeZIPErrorZip 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
ebook_homebrew.rdb module¶
Provides RDB execute
-
class
ebook_homebrew.rdb.UploadedFile(dbname='ebook-homebrew.sqlite3', echo_log=True)[source]¶ Bases:
objectProvides UploadFile Sqlite3 operation
ebook_homebrew.rename module¶
Rename file name.
-
class
ebook_homebrew.rename.ChangeFilename(directory_path, digits, extension)[source]¶ Bases:
ebook_homebrew.core.CommonChange 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.
-
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]
-
ebook_homebrew.rest module¶
Provides Rest API interfaces
-
class
ebook_homebrew.rest.ConvertReqSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.DownloadReqSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.ErrorRespSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.FileNotFoundRespSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.HealthCheckSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.ListUploadFilesSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.UploadIdRespSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
class
ebook_homebrew.rest.UploadImagesReqSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Bases:
marshmallow.schema.Schema-
opts= <marshmallow.schema.SchemaOpts object>¶
-
-
ebook_homebrew.rest.convert_content_type_to_extension(content_type)[source]¶ Convert image extension to Content-Type
- Parameters
content_type – Content-Type
- Returns
extension
- Return type
-
async
ebook_homebrew.rest.convert_image_to_pdf(req, resp)[source]¶ Convert Image files to PDF. — post:
summary: Upload Id witch get upload images and ContentType
- requestBody:
description: Upload Id and ContentType content:
- application/json:
- schema:
$ref: “#/components/schemas/ConvertReq”
- responses:
- “200”:
description: OK content:
- application/json:
- schema:
$ref: “#/components/schemas/UploadIdResp”
- “400”:
description: BadRequest content:
- application/json:
- schema:
$ref: “#/components/schemas/ErrorResp”
- “404”:
description: UploadIdNotFound content:
application/json: application/json:
- schema:
$ref: “#/components/schemas/FileNotFoundResp”
-
async
ebook_homebrew.rest.download_result_pdf(req, resp)[source]¶ Upload Image files. — post:
summary: Upload Id witch get upload images
- requestBody:
description: Upload Id content:
- application/json:
- schema:
$ref: “#/components/schemas/DownloadReq”
- responses:
- “200”:
description: OK content:
- application/pdf:
- schema:
type: string format: binary
- “400”:
description: BadRequest content:
- application/json:
- schema:
$ref: “#/components/schemas/ErrorResp”
- “404”:
description: ResultFileNotFound content:
- application/json:
- schema:
$ref: “#/components/schemas/FileNotFoundResp”
-
ebook_homebrew.rest.list_upload_files(_, resp)[source]¶ Responce File List. — get:
description: Get file list responses:
- “200”:
description: OK content:
- application/json:
- schema:
$ref: “#/components/schemas/ListUploadFiles”
-
ebook_homebrew.rest.status(_, resp)[source]¶ Health Check Response. — get:
description: Get Status responses:
- “200”:
description: OK content:
- application/json:
- schema:
$ref: “#/components/schemas/HealthCheck”
-
async
ebook_homebrew.rest.upload_image_file(req, resp)[source]¶ Upload Image files. — post:
summary: Base64 encoded Images
- requestBody:
description: base64 encoded Images in images Array content:
- application/json:
- schema:
$ref: “#/components/schemas/UploadImagesReq”
- responses:
- “200”:
description: OK content:
- application/json:
- schema:
$ref: “#/components/schemas/UploadIdResp”
- “400”:
description: BadRequest content:
- application/json:
- schema:
$ref: “#/components/schemas/ErrorResp”