backend

package
v0.0.0-...-a06b8d0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter

type Chapter struct {
	ChapterHash string
	ChapterNum  float64
	ChapterName string
	VolumeNum   int
	MangaID     string
	Downloaded  bool
	IsRead      bool
	ChapterPath string
}

Hold a single chapter of a manga.

func DownloadChapters

func DownloadChapters(store *SQLite, chapters ...Chapter) []Chapter

Downloads the given chapters, returning the updated entries. Any chapters with Chapter.Downloaded == true are ignored.

func (Chapter) Description

func (c Chapter) Description() string

func (Chapter) FilterValue

func (c Chapter) FilterValue() string

Implement list.DefaultItem

func (Chapter) Title

func (c Chapter) Title() string

Implement list.Item

type Manga

type Manga struct {
	MangaID      string
	SerTitle     string
	FullTitle    string
	Descr        string
	TimeModified time.Time
	Tags         []Tag
	Chapters     []Chapter

	Demographic string
	PubStatus   string
	Review      Review
	// contains filtered or unexported fields
}

func NewManga

func NewManga(meta MangaMeta, title string, abbrev string, store *SQLite) Manga

Create a new Manga, store it in the DB, and return it. This does not do anything with feeds or getting the chapters, it only gets the series info.

func RefreshFeed

func RefreshFeed(manga Manga, store *SQLite) Manga

Pull the MD feed and add the chapters to the DB. Returns the updated Manga.

func (Manga) Description

func (m Manga) Description() string

func (Manga) FilterValue

func (m Manga) FilterValue() string

Implement list.DefaultItem

func (Manga) Title

func (m Manga) Title() string

Implement list.Item

type MangaMeta

type MangaMeta struct {
	Result   string `json:"result"`
	Response string `json:"response"`
	Data     struct {
		ID         string `json:"id"`
		Type       string `json:"type"`
		Attributes struct {
			Title struct {
				En string `json:"en"`
			} `json:"title"`
			AltTitles []struct {
				Ja   string `json:"ja,omitempty"`
				JaRo string `json:"ja-ro,omitempty"`
				En   string `json:"en,omitempty"`
			} `json:"altTitles"`
			Description struct {
				En string `json:"en"`
			} `json:"description"`
			LastVolume             string `json:"lastVolume"`
			LastChapter            string `json:"lastChapter"`
			PublicationDemographic string `json:"publicationDemographic"`
			Status                 string `json:"status"`
			Tags                   []struct {
				//ID string `json:"id"`
				//Type       string `json:"type"`
				Attributes struct {
					Name struct {
						En string `json:"en"`
					} `json:"name"`
				} `json:"attributes"`
			} `json:"tags"`
		} `json:"attributes"`
	} `json:"data"`
}

This stores the response from a `manga/%s` API query to be parsed into more useful forms.

func PullMangaMeta

func PullMangaMeta(MangaID string) MangaMeta

Retrieve and parse the metadata for this given series from the series' ID.

type Review

type Review struct {
	MangaID string
	Rating  int    // Rating can be whatever you want, but I intended it to be some n/100
	Rev     string // The full text of your review
}

A review of a Manga.

type SQLite

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

Store the SQL connection.

func Opendb

func Opendb(name string) *SQLite

Get a new DB connection. Guarantees that the file you specify will be created and the tables will be initialized.

func (*SQLite) GetAll

func (r *SQLite) GetAll() []Manga

Get all the Manga from the DB, complete with tags, chapters, and review

func (*SQLite) GetByID

func (r *SQLite) GetByID(mangaID string) Manga

Get a single Manga from the DB

func (*SQLite) GetChapters

func (r *SQLite) GetChapters(MangaID string) []Chapter

Get all the chapters for a given manga.

func (*SQLite) GetReview

func (r *SQLite) GetReview(MangaID string) Review

Get the review for a given manga

func (*SQLite) UpdateChapterDownloaded

func (r *SQLite) UpdateChapterDownloaded(c Chapter) Chapter

Update Downloaded for the given Chapter in the DB and return the updated Chapter.

func (*SQLite) UpdateChapterRead

func (r *SQLite) UpdateChapterRead(c Chapter)

Update IsRead for the given Chapter in the DB.

func (*SQLite) UpdateTimeModified

func (r *SQLite) UpdateTimeModified(m Manga) Manga

Update the TimeModified for the given Manga in the DB and return the updated Manga.

type SeriesFeed

type SeriesFeed struct {
	Result   string       `json:"result"`
	Response string       `json:"response"`
	Data     []feedChData `json:"data"`
	Limit    int          `json:"limit"`
	Offset   int          `json:"offset"`
	Total    int          `json:"total"`
}

Stores the response from a `manga/%s/feed` API query.

type Tag

type Tag struct {
	TagID    int
	TagTitle string
}

A Tag can represent a genre or prominent element of a Manga

func (Tag) String

func (t Tag) String() string

Jump to

Keyboard shortcuts

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