scan

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBooksToStore

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

AddBooksToStore 添加一组书到书库

func ClearDatabaseWhenExit

func ClearDatabaseWhenExit(ConfigPath string)

func HandleDirectory

func HandleDirectory(currentPath string, depth int, option Option) (model.DirNode, []string, []model.MediaFileInfo, error)

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

func InitAllStore

func InitAllStore(option Option) error

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

func InitStore

func InitStore(storePath string, option Option) ([]*model.Book, error)

InitStore 扫描本地路径,取得路径里的书籍

func SFTP

func SFTP(scanOption Option) (newBookList []*model.Book, err error)

func SaveResultsToDatabase

func SaveResultsToDatabase(ConfigPath string, ClearDatabaseWhenExit bool) error

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

func Smb

func Smb(scanOption Option) (newBookList []*model.Book, err error)

Smb 扫描smb书籍 github.com/hirochachacha/go-smb2 换用一个持续更新,rclone用的库:github.com/cloudsoda/go-smb2 https://github.com/rclone/rclone/blob/master/go.mod

func Webdav

func Webdav(scanOption Option) (newBookList []*model.Book, err error)

TODO:扫描webdev书籍 https://pkg.go.dev/github.com/studio-b12/gowebdav ?

Types

type ConfigInterface

type ConfigInterface interface {
	GetLocalStores() []string
	GetStores() []stores.Store
	GetMaxScanDepth() int
	GetMinImageNum() int
	GetTimeoutLimitForScan() int
	GetExcludePath() []string
	GetSupportMediaType() []string
	GetSupportFileType() []string
	GetSupportTemplateFile() []string
	GetZipFileTextEncoding() string
	GetEnableDatabase() bool
	GetClearDatabaseWhenExit() bool
	GetDebug() bool
}

type Option

type Option struct {
	Cfg ConfigInterface
}

func NewOption

func NewOption(scanConfig ConfigInterface) 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) IsSupportFile

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

IsSupportFile 判断压缩包内的文件是否需要展示

func (*Option) IsSupportMedia

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

IsSupportMedia 判断文件是否需要展示

func (*Option) IsSupportTemplate

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

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

Jump to

Keyboard shortcuts

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