mex

package module
v0.0.0-...-645f96a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 17 Imported by: 0

README

Mex

Mex is a tool for repacking manga archives into a sane directory structure for consumptions by viewers like Komga, Kavita, and many others.

Requirements

You must have both 7za / 7z and unrar installed on your system and included in your system PATH.

Features

  • Process most compressed formats, including nested archives 🌮
  • Detect best quality volumes in the presence of duplicates 🌶️
  • Rename volumes and pages using templates for consistency 🫔
  • Exclude any irrelevant garbage files present in your archives 🥑
  • Output loose images, CBZ archives, or a combination of both 🌯

Usage

To process an archive just pass it on the command line to Mex:

mex my_manga_archive.rar

Additional options can be viewed by running with the -help flag:

Usage: mex <input_path> [<output_dir>]
  -label-book string
    	book name template (default "{{.Name}}")
  -label-page string
    	page name template (default "page_{{.Index}}{{.Ext}}")
  -label-volume string
    	volume name template (default "vol_{{.Index}}")
  -workers int
    	number of simultaneous workers (default 4)
  -zip-book
    	compress book as a cbz archive
  -zip-volume
    	compress volumes as cbz archives (default true)
Templates:
  {{.Index}} - index of current volume or page
  {{.Name}} - original filename and extension
  {{.Ext}} - original extension only

Documentation

Index

Constants

View Source
const (
	ExportFlag_CompressBook = 1 << iota
	ExportFlag_CompressVolumes
)

Variables

View Source
var (
	UnsupportedArchiveFormatError = errors.New("unsupported archive format")
	RequiredToolNotInstalled      = errors.New("required tool not installed")
)

Functions

func Compress

func Compress(archPath, contentDir string) error

func Decompress

func Decompress(archPath string, allocator *TempDirAllocator) (string, error)

Types

type Book

type Book struct {
	Node        *Node
	Volumes     map[int]*Volume
	VolumeCount int
	// contains filtered or unexported fields
}

func ParseBook

func ParseBook(node *Node) (*Book, error)

func (*Book) Export

func (self *Book) Export(path string, config ExportConfig, allocator *TempDirAllocator) error

type ExportConfig

type ExportConfig struct {
	Flags          ExportFlags
	PageTemplate   string
	VolumeTemplate string
	BookTemplate   string
	Workers        int
}

type ExportFlags

type ExportFlags int

type Node

type Node struct {
	Name     string
	Path     string
	Info     os.FileInfo
	Children []*Node
}

func Walk

func Walk(path string, allocator *TempDirAllocator) (*Node, error)

type Page

type Page struct {
	Node   *Node
	Volume *Volume
	Index  int
}

type TempDirAllocator

type TempDirAllocator struct {
	// contains filtered or unexported fields
}

func (*TempDirAllocator) Cleanup

func (self *TempDirAllocator) Cleanup()

func (*TempDirAllocator) TempDir

func (self *TempDirAllocator) TempDir() (string, error)

type Volume

type Volume struct {
	Node  *Node
	Book  *Book
	Pages []*Page
	Index int
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳