scan

package
v1.2.20 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBooksToStore

func AddBooksToStore(books []*model.Book)

AddBooksToStore 添加一组书到书库

func GetCurrentFS added in v1.2.17

func GetCurrentFS() vfs.FileSystem

GetCurrentFS 获取当前扫描使用的文件系统

func GetRemoteImageData added in v1.2.17

func GetRemoteImageData(book *model.Book, imageName string) ([]byte, error)

GetRemoteImageData 获取远程图片数据(用于目录类型书籍)

func InitAllStore

func InitAllStore(cfg ConfigInterface) error

InitAllStore 扫描书库路径,取得书籍

func InitConfig

func InitConfig(c ConfigInterface)

func InitStore

func InitStore(storePath string, cfg ConfigInterface) error

InitStore 扫描书库路径,取得路径里的书籍 支持本地路径和远程 URL(WebDAV 等)

func IsRemoteFS added in v1.2.17

func IsRemoteFS() bool

IsRemoteFS 判断当前文件系统是否为远程文件系统

func IsSkipDir

func IsSkipDir(path string) bool

IsSkipDir 检查路径是否应该跳过(排除文件,文件夹列表)。

func IsSupportFile

func IsSupportFile(checkPath string) bool

IsSupportFile 判断压缩包文件是否是支持的文件类型

func IsSupportMedia

func IsSupportMedia(checkPath string) bool

IsSupportMedia 判断文件是否需要展示

func IsSupportTemplate

func IsSupportTemplate(checkPath string) bool

IsSupportTemplate 判断压缩包内的文件是否是支持的模板文件

func SaveBooksToDatabase

func SaveBooksToDatabase(cfg ConfigInterface) error

SaveBooksToDatabase 4,保存扫描结果到数据库

func SetCurrentFS added in v1.2.17

func SetCurrentFS(fs vfs.FileSystem)

SetCurrentFS 设置当前扫描使用的文件系统

Types

type ConfigInterface

type ConfigInterface interface {
	GetStoreUrls() []string
	GetMaxScanDepth() int
	GetMinImageNum() int
	GetTimeoutLimitForScan() int
	GetExcludePath() []string
	GetSupportMediaType() []string
	GetSupportFileType() []string
	GetSupportTemplateFile() []string
	GetZipFileTextEncoding() string
	GetEnableDatabase() bool
	GetClearDatabaseWhenExit() bool
	GetDebug() bool
}

type DirNode

type DirNode struct {
	Name    string           `json:"name"`
	Path    string           `json:"path"`
	SubDirs []DirNode        `json:"sub_dirs"` // 子目录列表
	Files   []model.PageInfo `json:"files"`    // 本目录下的图片文件列表
}

DirNode 表示目录树节点,用于表示文件系统中的目录结构。

func HandleDirectory

func HandleDirectory(currentPath string, depth int) (DirNode, []string, []model.PageInfo, error)

HandleDirectory 扫描本地目录的核心函数:递归遍历目录,忽略指定名称的文件夹,收集图片文件信息

func HandleDirectoryVFS added in v1.2.17

func HandleDirectoryVFS(fs vfs.FileSystem, currentPath string, depth int) (DirNode, []string, []model.PageInfo, error)

HandleDirectoryVFS 使用 VFS 扫描目录(支持远程文件系统)

Jump to

Keyboard shortcuts

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