scan

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 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 []*entity.Book, basePath string, MinImageNum int)

AddBooksToStore 添加一组书到书库

func ClearDatabaseWhenExit

func ClearDatabaseWhenExit(ConfigPath string)

func InitStore

func InitStore(scanConfig Option) error

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

func Local

func Local(storePath string, scanOption Option) ([]*entity.Book, error)

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

func SFTP

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

TODO:SFTP扫描书籍

func SaveResultsToDatabase

func SaveResultsToDatabase(ConfigPath string, ClearDatabaseWhenExit bool) error

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

func Smb

func Smb(scanOption Option) (newBookList []*entity.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 []*entity.Book, err error)

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

Types

type Option

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

func NewScanOption

func NewScanOption(
	reScanFile bool,
	localPath []string,
	remoteStores []stores.Store,
	maxScanDepth int,
	minImageNum int,
	timeoutLimitForScan int,
	excludePath []string,
	supportMediaType []string,
	supportFileType []string,
	supportTemplateFile []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在内的媒体文件)

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