animenames

package module
v0.0.0-...-1869ee6 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

go-animenames

Parser for anime names that follow common naming conventions.

Example

(See parser_test.go for more examples.)

package main

import (
	"fmt"

	"github.com/c032/go-animenames"
)

func main() {
	const name = "[Kantai] Eighty Six (86) - 23 (1920x1080 AC3) [05BD70FE].mkv"
	anime, err := animenames.Parse(name)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Title: %s\n", anime.Title)
	fmt.Printf("Group: %s\n", anime.Group)
	fmt.Printf("Episode: %d\n", anime.Episode)
	fmt.Printf("CRC32: %s\n", anime.CRC32)
	fmt.Printf("IsBD: %#v\n", anime.IsBD)
}

Output:

Title: Eighty Six (86)
Group: Kantai
Episode: 23
CRC32: 05BD70FE
IsBD: false

License

Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCouldNotParseName = errors.New("could not parse name")
	ErrNotAString        = errors.New("not a string")
	ErrInvalidSeason     = errors.New("invalid season")
	ErrInvalidEpisode    = errors.New("invalid episode")
	ErrInvalidYear       = errors.New("invalid year")
)

Functions

This section is empty.

Types

type Anime

type Anime struct {
	Title   string
	Year    int
	Episode int
	Season  int // e.g. `2` in "Nisekoi S2"
	Volume  int
	Batch   *Batch
	Group   string
	CRC32   string

	IsOVA       bool
	IsBD        bool
	HasSpecials bool
}

Anime contains information about an anime file or directory.

func Parse

func Parse(name string) (Anime, error)

Parse returns anime information from a file name.

type Batch

type Batch struct {
	Start int
	End   int
}

Batch describes a batch.

Jump to

Keyboard shortcuts

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