harmonica

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: BSD-2-Clause-Views Imports: 9 Imported by: 0

README

harmonica: comic ebook repackager

SUMMARY

harmonica repackages comics into batches of smaller collections.

EXAMPLE

$ cd examples

$ harmonica -n 36 atomic-war

$ tree issue-*
issue-1
├── Atomic_War_no.1_195211_pg00a.jpg
├── Atomic_War_no.1_195211_pg00b.jpg
├── Atomic_War_no.1_195211_pg01.jpg
├── Atomic_War_no.1_195211_pg02.jpg
├── Atomic_War_no.1_195211_pg03.jpg
...
issue-2
├── Atomic_War_no.2_195212_pg00a.jpg
├── Atomic_War_no.2_195212_pg00b.jpg
├── Atomic_War_no.2_195212_pg01.jpg
├── Atomic_War_no.2_195212_pg02.jpg
├── Atomic_War_no.2_195212_pg03.jpg
...

-n controls max number of files (default unlimited).

-m controls max directory size (default 250 MiB).

-prefix customizes the batch prefix.

-unzip handles ZIP format archive (.ZIP, .CBZ, .JAR, etc.) source files.

-zip <.extension> compresses each batch into independent ZIP format archives.

See harmonica -help for more detail.

ABOUT

Why, though?

Poorly written multimedia applications attempt to load a large object in memory and then crash. For example, comic ebooks often refuse to read smoothly unless dispersed among a set of smaller (.CBZ) files. harmonica divides large archives into smaller archives more likely to successfully process in more comic book side loading ereaders.

Poorly written cloud storage applications that struggle to reliably transfer large files. Some applications fail file transfers if the user doesn't continually force the screen to stay awake. harmonica chunks large archives into smaller chunks. When file transfers fail, it's more convenient to retry a specific smaller chunk file than the original, large file.

Classical split archive files (e.g. *.Z00, *.Z01, *.Z02, ..., *.ZIP) are not designed to operate in isolation. harmonica splits your files into ordinary ZIP files.

WARNING

harmonica is designed to work on a set of files structured in a rigidly flat directory tree structure, with one parent directory (optionally nested inside a ZIP format archive) and one or more direct child files. Nested directory structures may trigger problems.

When in doubt, backup source files onto a separate volume before running harmonica.

NOTES

When sourcing the current working directory (.), then the targets automatically reposition up to the parent directory, treating the source as immutibile. This reduces the risk of successive harmonica operations nesting archives inside each other.

DOCKER HUB

https://hub.docker.com/r/n4jm4/harmonica

DOWNLOAD

https://github.com/mcandre/harmonica/releases

INSTALL FROM SOURCE

$ go install github.com/mcandre/harmonica/cmd/harmonica@latest

DOCUMENTATION

https://pkg.go.dev/github.com/mcandre/harmonica

LICENSE

BSD-2-Clause

RUNTIME REQUIREMENTS

(None)

CONTRIBUTING

For more information on developing harmonica itself, see DEVELOPMENT.md.

=[][][]=

SEE ALSO

  • buttery, an animated GIF editor
  • tigris, (Kindle) comic book archival utilities

Documentation

Overview

Package harmonica provides primitives for editing comic ebooks.

Index

Constants

View Source
const Version = "0.0.10"

Version is semver.

Variables

This section is empty.

Functions

func Copy

func Copy(dest string, source string) error

Copy file paths.

func GetDirectorySizeBytes

func GetDirectorySizeBytes(root string) (int64, error)

GetDirectorySizeBytes totals directory content file size recursively, measured in bytes.

Types

type Config

type Config struct {
	// Source denotes a file path (required, nonblank).
	Source string

	// Prefix denotes a target basename.
	Prefix string

	// ExpandSource denotes whether to treat the source initially as a ZIP format archive.
	// If so, attempt to expand the archive.
	// Assume that the archive follows a convention
	// of nesting all of its entries in an envelope directory,
	// with the directory name identical to the archive path minus the archive file extension.
	ExpandSource bool

	// Assets denotes a collection of boilerplate asset files to copy into each batch.
	Assets []string

	// BatchLimitEntries denotes a cap on the number of files in each batch.
	// 0 indicates unbounded.
	BatchLimitEntries uint

	// BatchLimitMiB denotes a cap on the (uncompressed) content size in each batch.
	// 0 indicates unbounded.
	BatchLimitMiB uint

	// BatchCompressionExtension denotes an optional ZIP format file extension,
	// E.g. "zip", "cbz", "jar".
	// Blank indicates no compression.
	BatchCompressionExtension string
	// contains filtered or unexported fields
}

Config models a Harmonica operation.

func (Config) BeyondBatchCapacity

func (o Config) BeyondBatchCapacity() (bool, error)

BeyondBatchCapacity reports whether the current batch is too full to receive additional files.

func (*Config) QueuePath

func (o *Config) QueuePath(pth string, d fs.DirEntry, err error) error

QueuePath collects non-directory source paths.

func (*Config) Run

func (o *Config) Run() error

Run launches a Harmonica operation.

Directories

Path Synopsis
cmd
harmonica command
Package main implements a CLI comic ebook editor.
Package main implements a CLI comic ebook editor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL