application

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAgeRatingValue = []struct {
	Value  comicinfo.AgeRating
	TSName string
}{
	{comicinfo.AgeRating_Unknown, "Unknown"},
	{comicinfo.AgeRating_AdultsOnly18, "AdultsOnly18"},
	{comicinfo.AgeRating_EarlyChildhood, "EarlyChildhood"},
	{comicinfo.AgeRating_Everyone, "Everyone"},
	{comicinfo.AgeRating_Everyone10Plus, "Everyone10Plus"},
	{comicinfo.AgeRating_G, "G"},
	{comicinfo.AgeRating_KidsToAdults, "KidsToAdults"},
	{comicinfo.AgeRating_M, "M"},
	{comicinfo.AgeRating_MA15Plus, "MA15Plus"},
	{comicinfo.AgeRating_Mature17Plus, "Mature17Plus"},
	{comicinfo.AgeRating_PG, "PG"},
	{comicinfo.AgeRating_R18Plus, "R18Plus"},
	{comicinfo.AgeRating_RatingPending, "RatingPending"},
	{comicinfo.AgeRating_Teen, "Teen"},
	{comicinfo.AgeRating_X18Plus, "X18Plus"},
}

The value of `AgeRating` const to use in wails binding.

View Source
var AllMangaValue = []struct {
	Value  comicinfo.Manga
	TSName string
}{
	{comicinfo.Manga_Unknown, "Unknown"},
	{comicinfo.Manga_No, "No"},
	{comicinfo.Manga_Yes, "Yes"},
	{comicinfo.Manga_YesAndRightToLeft, "YesAndRightToLeft"},
}

The value of `Manga` const to use in wails binding.

Functions

This section is empty.

Types

type App

type App struct {
	DB *lazydb.LazyDB
	// contains filtered or unexported fields
}

App struct

func NewApp

func NewApp(cfg *config.ProgramConfig, db *lazydb.LazyDB) *App

Create a new app with specified config. This function is designed to run in production.

func NewAppWithDefaultConfig added in v0.9.0

func NewAppWithDefaultConfig(db *lazydb.LazyDB) *App

Create a new app with default configuration. Suggested to use in testing only.

func (*App) ExportCbzOnly

func (a *App) ExportCbzOnly(inputDir string, exportDir string, c *comicinfo.ComicInfo) (errMsg string)

Export the .cbz (contains images & comicInfo) file ONLY to destination.

If the process success, then function will output empty string. Otherwise, function will return the reason for error.

Both input directory and output directory MUST be absolute paths.

func (*App) ExportCbzWithDefaultWrap

func (a *App) ExportCbzWithDefaultWrap(inputDir string, exportDir string, c *comicinfo.ComicInfo) (errMsg string)

Export the .cbz (contains images & comicInfo) file to destination, wrapped with folder name that same as .cbz base filename.

If the process success, then function will output empty string. Otherwise, function will return the reason for error.

Both input directory and output directory MUST be absolute paths.

func (*App) ExportCbzWithWrap

func (a *App) ExportCbzWithWrap(inputDir string, exportDir string, wrapFolder string, c *comicinfo.ComicInfo) (errMsg string)

Export the .cbz (contains images & comicInfo) file to destination, wrapped with folder name specified by user.

If the process success, then function will output empty string. Otherwise, function will return the reason for error.

Both input directory and output directory MUST be absolute paths.

func (*App) ExportXml

func (a *App) ExportXml(originalDir string, c *comicinfo.ComicInfo) (errorMsg string)

API for export comicinfo to original directory.

If the process success, then function will output empty string. Otherwise, function will return the reason for error.

func (*App) GetAllGenreInput

func (a *App) GetAllGenreInput() HistoryResp

Get all user inputted genre from database.

func (*App) GetAllPublisherInput

func (a *App) GetAllPublisherInput() HistoryResp

Get all user inputted publisher from database.

func (*App) GetAllTagInput

func (a *App) GetAllTagInput() HistoryResp

Get all user inputted tag from database.

func (*App) GetComicFolder

func (a *App) GetComicFolder() string

Attempt to load default comic folder. If config is not set, then return a empty string instead.

func (*App) GetComicInfo

func (a *App) GetComicInfo(folder string) ComicInfoResponse

Get the comic info by scan the given folder. This function will not create/modify the comicinfo xml.

This function will return a comicInfo struct, with error message in string.

func (*App) GetDefaultOutputDirectory

func (a *App) GetDefaultOutputDirectory(inputDir string) string

Attempt to load default output directory. If no default directory is set, then return input directory instead.

func (*App) GetDirectory

func (a *App) GetDirectory(dir string) DirectoryResp

Open directory dialog for wails, allow user to select one directory.

If given directory is empty, then default directory will be handled by wails. Otherwise, it will open given directory.

If any error occur, the error message will be also returned in 2nd argument. Empty string indicate no error occur.

func (*App) OpenFolder

func (a *App) OpenFolder(path string)

Open folder in window explorer.

If current os is not window, then this function will show error dialog instead of open folder.

func (*App) QuickExportKomga

func (a *App) QuickExportKomga(inputDir string) string

Perform Quick Export Action, where ComicInfo.xml file can not be modified before archived. The input directory MUST be absolute path.

If error is occur, then return a string containing the error message. Otherwise, return empty string.

This function will perform these task:

  1. Scan the directory and create a ComicInfo.xml file
  2. Archive the directory and xml file as .cbz file
  3. Wrap the .cbz file with a folder to copy to komga

This function is specific designed for komga folder structure.

func (*App) RunSoftDelete

func (a *App) RunSoftDelete() (errMsg string)

Run soft delet process, which will move the last exported comic folder to trash bin in config file.

This function only effect when one export function is run successfully. If trash bin is not defined, then error will be returned.

func (*App) Startup

func (a *App) Startup(ctx context.Context)

startup is called when the app starts. The context is saved so we can call the runtime methods

type ComicInfoResponse

type ComicInfoResponse struct {
	ComicInfo    *comicinfo.ComicInfo `json:"ComicInfo"`
	ErrorMessage string               `json:"ErrorMessage"`
}

type DirectoryResp

type DirectoryResp struct {
	SelectedDir string
	ErrMsg      string
}

Response for get directory method. Designed due to wails API only allow single return.

type HistoryResp

type HistoryResp struct {
	Inputs   []string `json:"Inputs"`
	ErrorMsg string   `json:"ErrorMsg"`
}

Struct that designed for send last input record from history module to frontend.

Jump to

Keyboard shortcuts

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