scan

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBooksToStore

func AddBooksToStore(bookList []*types.Book, basePath string, MinImageNum int)

AddBooksToStore 添加一组书到书库

func ClearDatabaseWhenExit

func ClearDatabaseWhenExit(ConfigPath string)

func InitStore

func InitStore(scanConfig Option) error

InitStore 3、扫描路径,取得路径里的书籍

func SaveResultsToDatabase

func SaveResultsToDatabase(ConfigPath string, ClearDatabaseWhenExit bool) error

SaveResultsToDatabase 4,保存扫描结果到数据库,并清理不存在的书籍

func ScanAndGetBookList

func ScanAndGetBookList(storePath string, scanOption Option) (newBookList []*types.Book, err error)

ScanAndGetBookList 扫描路径,取得路径里的书籍

Types

type Option

type Option struct {
	ReScanFile            bool     // 是否重新扫描文件
	StoresPath            []string // 书库路径
	MaxScanDepth          int      // 扫描深度
	MinImageNum           int      // 最小图片数量
	TimeoutLimitForScan   int      // 扫描超时时间
	ExcludePath           []string // 排除路径
	SupportMediaType      []string // 支持的媒体类型
	SupportFileType       []string // 支持的文件类型
	ZipFileTextEncoding   string   // 非UTF-8编码的ZIP文件,尝试用什么编码解析,默认GBK
	EnableDatabase        bool     // 启用数据库
	ClearDatabaseWhenExit bool     // 启用数据库时,扫描完成后,清除不存在的书籍
	Debug                 bool
}

func NewScanOption

func NewScanOption(
	reScanFile bool,
	storesPath []string,
	maxScanDepth int,
	minImageNum int,
	timeoutLimitForScan int,
	excludePath []string,
	supportMediaType []string,
	supportFileType []string,
	zipFileTextEncoding string,
	enableDatabase bool,
	clearDatabaseWhenExit bool,
	debug bool,
) Option

func (*Option) IsSkipDir

func (o *Option) IsSkipDir(path string) bool

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

func (*Option) IsSupportArchiver

func (o *Option) IsSupportArchiver(checkPath string) bool

IsSupportArchiver 是否是支持的压缩文件

func (*Option) IsSupportMedia

func (o *Option) IsSupportMedia(checkPath string) bool

IsSupportMedia 判断压缩包内的文件是否需要展示(包括图片、音频、视频、PDF在内的媒体文件)

Jump to

Keyboard shortcuts

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