server

package
v0.0.0-...-8667993 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID      int64      `json:"id"`
	Authors []string   `json:"authors"`
	Title   string     `json:"title"`
	Series  string     `json:"series"`
	Files   []BookFile `json:"files"`
}

Book represents a book in a library.

type BookConverter

type BookConverter interface {
	Convert(bf books.BookFile) (string, error)
	Close()
}

BookConverter converts a book to epub.

func NewCalibreBookConverter

func NewCalibreBookConverter(booksRoot, cacheDir string, numWorkers int) BookConverter

NewCalibreBookConverter creates a new BookConverter which uses calibre.

type BookFile

type BookFile struct {
	ID               int64     `json:"id"`
	Extension        string    `json:"extension"`
	Tags             []string  `json:"tags"`
	Hash             string    `json:"hash"`
	OriginalFilename string    `json:"original_filename"`
	Filename         string    `json:"filename"`
	Mtime            time.Time `json:"mtime"`
	Size             int64     `json:"size"`
}

BookFile represents a file linked to a book.

type Config

type Config struct {
	Lib            *books.Library
	TemplatesDir   string
	Converter      BookConverter
	ItemsPerPage   int
	Hsrv           *http.Server
	HtpasswdFile   string
	BooksRoot      string
	OutputTemplate *txtTemplate.Template
}

Config is the configuration of the server, used in New.

type Server

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

Server is the web server which handles searching for, downloading and converting books.

func New

func New(cfg *Config) *Server

New creates a new server.

func (*Server) Start

func (srv *Server) Start() error

Start starts the server.

Jump to

Keyboard shortcuts

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