utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "1.0.3"

VERSION 当前程序版本号

Variables

This section is empty.

Functions

func Base64

func Base64(file string) (string, error)

Base64 文件Base64编码

func FailFile

func FailFile(file, dirPath string, cfg *ConfigStruct)

FailFile 恢复文件

func GetCode

func GetCode(filename, filter string) string

GetCode 提取番号

func GetFileSize

func GetFileSize(file string) (size int64, err error)

GetFileSize 获取文件大小

func GetMonth

func GetMonth(date string) string

GetMonth 获取日期中的月份

func GetNumberPath

func GetNumberPath(m MediaNfo, cfg *ConfigStruct) string

GetNumberPath 获取正确的保存路径

func GetRunPath

func GetRunPath() (dir string, err error)

GetRunPath 获取当前程序执行路径

func GetYear

func GetYear(date string) string

GetYear 获取日期中的年份

func MoveFile

func MoveFile(oldPath, newPath string) error

MoveFile 移动文件

func PosterFanArt

func PosterFanArt(srcPhoto, newPhoto string, cfg *ConfigStruct) error

PosterFanArt 图片裁剪

func WalkDir

func WalkDir(dirPath, success, fail string) (files []string, err error)

WalkDir 遍历目录

func WriteConfig

func WriteConfig() error

WriteConfig 写入配置文件

func WriteFile

func WriteFile(file string, data []byte) error

WriteFile 写入文件

Types

type BaseStruct

type BaseStruct struct {
	Proxy string // 代理地址
}

BaseStruct 基础配置结构

type ConfigStruct

type ConfigStruct struct {
	Base  BaseStruct  // 基础配置
	Path  PathStruct  // 路径配置
	Media MediaStruct // 媒体库配置
	Site  SiteStruct  // 免翻地址配置
}

ConfigStruct 配置结构

func GetConfig

func GetConfig() (config *ConfigStruct, err error)

GetConfig 读取配置信息

type MediaActor

type MediaActor struct {
	Name  string `xml:"name"`
	Thumb string `xml:"thumb"`
}

MediaActor 演员结构

type MediaInner

type MediaInner struct {
	Inner string `xml:",innerxml"`
}

MediaInner 避免简介内某些字符被转义

type MediaNfo

type MediaNfo struct {
	XMLName   xml.Name     `xml:"movie"`
	Title     MediaInner   `xml:"title"`
	SortTitle string       `xml:"sorttitle"`
	Number    string       `xml:"num"`
	Studio    MediaInner   `xml:"studio"`
	Maker     MediaInner   `xml:"maker"`
	Director  MediaInner   `xml:"director"`
	Release   string       `xml:"release"`
	Premiered string       `xml:"premiered"`
	Year      string       `xml:"year"`
	Plot      MediaInner   `xml:"plot"`
	Outline   MediaInner   `xml:"outline"`
	RunTime   string       `xml:"runtime"`
	Mpaa      string       `xml:"mpaa"`
	Country   string       `xml:"country"`
	Poster    string       `xml:"poster"`
	Thumb     string       `xml:"thumb"`
	FanArt    string       `xml:"fanart"`
	Actor     []MediaActor `xml:"actor"`
	Tag       []MediaInner `xml:"tag"`
	Genre     []MediaInner `xml:"genre"`
	Set       string       `xml:"set"`
	Label     string       `xml:"label"`
	Cover     string       `xml:"cover"`
	WebSite   string       `xml:"website"`
	Month     string       `xml:"-"`
	DirPath   string       `xml:"-"`
}

MediaNfo Nfo结构

func Pack

func Pack(file string, cfg *ConfigStruct) (m MediaNfo, err error)

Pack 影片整理

func ParseNfo

func ParseNfo(s scraper.Scraper) (MediaNfo, error)

ParseNfo 解析

type MediaStruct

type MediaStruct struct {
	Library   string // 媒体库类型
	URL       string // Emby访问地址
	API       string // Emby API Key
	SecretID  string // 腾讯云 SecretId
	SecretKey string // 腾讯云 SecretKey
}

MediaStruct 媒体库配置结构

type PathStruct

type PathStruct struct {
	Success   string // 成功存储目录
	Fail      string // 失败存储目录
	Directory string // 影片存储路径格式
	Filter    string // 文件名过滤规则
}

PathStruct 路径配置结构

type SiteStruct

type SiteStruct struct {
	Avsox  string // avsox免翻地址
	Avmoo  string // avmoo免翻地址
	Javbus string // javbus免翻地址
	JavDB  string // javdb免翻地址
}

SiteStruct 免费地址配置结构

Jump to

Keyboard shortcuts

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