tpb

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 15 Imported by: 1

README

tpb

Build Status
a tool that uses YAML/Go templates to zip and name CBZ (comic book) archives

what it can do

  • int-indexed comics (date-indexed are WIP)

usage

cli
  • go install git.gryffyn.io/gryffyn/tpb/cmd/tpb@latest
  • copy contrib/tpb.yml.dist somewhere
  • edit the file to fit your comic
  • run tpb -h
  • most likely you'll wanna do something like tpb -Dod out/ *.jpg
  • or more likely fd -t f -e png -e jpg -e jpg -e gif -e txt | xargs tpb -Dod out/ *.jpg
lib

pretty much gotta do this:

package main

import (
    "git.gryffyn.io/gryffyn/tpb"
)

func main() {
    var files []string // list of files
    
    t := tpb.Collection {
        OutDir: "out/",
    }
    
    _ = t.ReadConfigFile("tpb.yml")
    filemap, _ := tpb.MapFiles(&files)
    _ = t.Collect(filemap)
}

why tpb

cause it's like trade paperback, which is a collection of comic strips. it's a joke. or meant to be.

get it?

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OutputTemplate = `{{- .Comic }} {{ .FmtID "%03d" -}}{{ with .Year }} ({{ . }}){{ end -}}{{ with .Title }} - {{ . }}){{ end -}}.cbz`
)

Functions

func MapFiles

func MapFiles(files *[]string) (map[int][]string, error)

MapFiles takes a slice of file names nad creates a mapping from the numerical order of the strip to the filename. If an error occurs, MapFiles returns a partially-full map and the error.

Types

type Collection added in v0.2.4

type Collection struct {
	OutDir    *string
	Overwrite bool
	Delete    bool
	Config    cfg.Config
	Sections  []Section
	Title     string
	Year      int
	Bar       *mpb.Bar
}

func (*Collection) Collect added in v0.2.4

func (t *Collection) Collect(filemap map[int][]string) error

Collect takes in a map of files and archives them according to the Config and the OutputTemplate.

func (*Collection) ReadConfigBytes added in v0.2.4

func (t *Collection) ReadConfigBytes(config []byte) error

ReadConfigBytes reads a Config from the given byte slice.

func (*Collection) ReadConfigFile added in v0.2.4

func (t *Collection) ReadConfigFile(file *os.File) error

ReadConfigFile reads a Config from the given file.

type Section added in v0.2.4

type Section struct {
	Files   []string
	OutFile string
	ID      int
	Title   string
	Comic   string
	Year    int
	End     int
	Start   *int
	Bar     *mpb.Bar
}

func (*Section) FmtID added in v0.2.4

func (s *Section) FmtID(format string) string

Directories

Path Synopsis
cmd
tpb Module

Jump to

Keyboard shortcuts

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