metabookr

package module
v0.0.0-...-0b48cfb Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

README

metabookr

Read file names in a directory in bulk, identify book and comic titles by file names and get some metadata.

Documentation

Index

Constants

View Source
const OpenLibURI = "https://openlibrary.org/search.json"

Variables

View Source
var CommonSuffixes = []string{".cbr",
	".cbz",
	".cb7",
	".epub",
	".mobi",
	".pdf",
	".txt",
	".zip"}

CommonSuffixes contains some ebook suffixes

Functions

func NewTSVWriter

func NewTSVWriter(w io.Writer) (writer *csv.Writer)

NewTSVWriter creates a new TSV writer

func ReplaceCamelCase

func ReplaceCamelCase(fileName string) string

ReplaceCamelCase reads a string and adds a "+" after each capital letter and returns the string

func ReplaceUnderscore

func ReplaceUnderscore(fileName string) (string, bool)

ReplaceUnderscore reads a string and replaces all underscores with "+" and returns the string

func ReplaceWS

func ReplaceWS(fileName string) (string, bool)

ReplaceWS reads a string and if it has white spaces it replaces them with "+" and return the string

func TrimSuffix

func TrimSuffix(fileName string) string

TrimSuffix removes some common file suffixes

func WriteOLTSV

func WriteOLTSV(outputFile string, responses []OLResponse) error

WriteOLTSV writes OLResponses to a tsv file

Types

type Docs

type Docs struct {
	Key                    string   `json:"key"`
	Type                   string   `json:"type"`
	Seed                   []string `json:"seed"`
	Title                  string   `json:"title"`
	Title_suggest          string   `json:"title_suggest"`
	Has_fulltext           bool     `json:"has_fulltext"`
	Edition_count          int      `json:"edition_count"`
	Edition_key            []string `json:"edition_key"`
	Publish_date           []string `json:"publish_date"`
	Publish_year           []int    `json:"publish_year"`
	First_publish_year     int      `json:"first_publish_year"`
	Number_of_pages_median int      `json:"number_of_pages_median"`
	ISBN                   []string `json:"isbn"`
	Last_modified_i        int      `json:"last_modified_i"`
	Ebook_count_i          int      `json:"ebook_count_i"`
	Cover_edition_key      string   `json:"cover_edition_i"`
	Cover_i                int      `json:"cover_i"`
	Publisher              []string `json:"publisher"`
	Language               []string `json:"language"`
	Author_key             []string `json:"author_key"`
	Author_name            []string `json:"author_name"`
	Id_goodreads           []string `json:"id_goodreads"`
	Id_librarything        []string `json:"id_librarything"`
	Publisher_facet        []string `json:"publisher_facet"`
	Version                int      `json:"_version_"`
	Author_facet           []string `json:"author_facet"`
}

Docs is a struct for the docs key returned by the OpenLibrary API

type OLResponse

type OLResponse struct {
	NumFound      int    `json:"numFound"`
	Start         int    `json:"start"`
	NumFoundExact bool   `json:"numFoundExact"`
	Docs          []Docs `json:"docs"`
}

OLResponse is a struct for the response returned by the OpenLibrary API

func AskOpenLibrary

func AskOpenLibrary(title string) (OLResponse, error)

AskOpenLibrary sends the title to Open Librarie's API and reads the json response and unmarshals it into olresponse.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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