settings

package module
v0.0.0-...-8018c6d Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const MangaReaderSiteUrl = "https://mangareader.cc"

Variables

This section is empty.

Functions

func IsSettingsExisting

func IsSettingsExisting() bool

IsSettingsExisting allows to check if the settings file already exists or no

func WriteDefaultSettings

func WriteDefaultSettings()

WriteDefaultSettings write the default settings

func WriteSettings

func WriteSettings(settings Settings)

WriteSettings write a settings file. used to change the default config or add manga to history download

Types

type Config

type Config struct {
	LibraryPath          string  `json:"library_path"`
	AutoUpdate           bool    `json:"auto_update"`
	NbColumns            float32 `json:"nb_columns"`
	NbRows               float32 `json:"nb_rows"`
	PageWidth            float32 `json:"page_width"`
	PageHeight           float32 `json:"page_height"`
	ThumbMiniWidth       float32 `json:"thumb_mini_width"`
	ThumbMiniHeight      float32 `json:"thumb_mini_height"`
	LeftRightButtonWidth float32 `json:"left_right_button_width"`
	ChapterLabelWidth    float32 `json:"chapter_label_width"`
	ThumbnailWidth       float32 `json:"thumbnail_width"`
	ThumbnailHeight      float32 `json:"thumbnail_height"`
	ThumbTextHeight      float32 `json:"thumb_text_height"`
	NbWorkers            int     `json:"nb_workers"`
}

Config only store the default configuration, like output path and the global update library flag

type History

type History struct {
	Titles []Manga `json:"titles"`
}

History is the manga download history, so it's an array of all the mangas downloaded

type Manga

type Manga struct {
	Provider      string    `json:"provider"`
	Title         string    `json:"title"`
	LastChapter   float64   `json:"last_chapter"`
	Chapters      []float64 `json:"chapters"`
	CoverPath     string    `json:"cover_path"`
	Path          string    `json:"path"`
	CoverUrl      string    `json:"cover_url"`
	Name          string    `json:"name"`
	AlternateName string    `json:"alternate_name"`
	YearOfRelease string    `json:"year_of_release"`
	Status        string    `json:"status"`
	Author        string    `json:"author"`
	Artist        string    `json:"artist"`
	Description   string    `json:"description"`
}

Manga keep the download history for every manga that we are subscribing

type MangaProvider

type MangaProvider interface {
	FindDetails(libraryPath, title string, lastChapter float64) (manga Manga)
	GetPagesUrls(manga Manga) (pageLink []string)
	SearchManga(libraryPath, search string) (result []Manga)
	CheckLastChapter(manga Manga) (lastChapter float64)
	BuildChaptersList(manga *Manga) Manga
}

MangaProvider is the interface for allowing to use more than one provider

type MangaReader

type MangaReader struct{}

func (MangaReader) BuildChaptersList

func (provider MangaReader) BuildChaptersList(manga *Manga) Manga

func (MangaReader) CheckLastChapter

func (provider MangaReader) CheckLastChapter(manga Manga) (lastChapter float64)

func (MangaReader) FindDetails

func (provider MangaReader) FindDetails(libraryPath, title string, lastChapter float64) (manga Manga)

func (MangaReader) GetPagesUrls

func (provider MangaReader) GetPagesUrls(manga Manga) (pageLink []string)

func (MangaReader) SearchManga

func (provider MangaReader) SearchManga(libraryPath, search string) (result []Manga)

type Settings

type Settings struct {
	Config  Config  `json:"config"`
	History History `json:"history"`
}

Settings is the structure that allowed to store the default configuration and the download history for all the mangas

func ReadSettings

func ReadSettings() (settings Settings)

ReadSettings read the settings file

func UpdateHistory

func UpdateHistory(cfg Settings, manga Manga) (newSettings Settings)

UpdateHistory register the last chapter downloaded for a manga, and the last provider used

Jump to

Keyboard shortcuts

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