scrape

package
v1.0.0-rc.21 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package scrape 为整理进媒体库的电影与剧集写 Kodi 格式的 NFO(Emby、Jellyfin、Plex 的 NFO 插件都认), 并下载海报、背景、季海报与集截图。数据来自 TMDB。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpisodeNFO

func EpisodeNFO(show tmdb.Result, season, episode, end int, s *tmdb.Season) ([]byte, error)

EpisodeNFO 是一个剧集文件的 NFO(<episodedetails>)。一个文件里有多集(episode 到 end)时每集写一段, Kodi 按多集文件处理。季详情里没有的集只写季号与集号,标题用「第 N 集」。

func MovieNFO

func MovieNFO(r tmdb.Result) ([]byte, error)

MovieNFO 是电影的 NFO(<movie>)。

func SeasonNFO

func SeasonNFO(number int, s *tmdb.Season) ([]byte, error)

SeasonNFO 是一季的 NFO(<season>,放在季目录里,文件名 season.nfo)。s 为空时只写季号。

func SeasonPosterName

func SeasonPosterName(n int) string

SeasonPosterName 是季海报放在剧集目录里的文件名:season01-poster.jpg,第 0 季是 season-specials-poster.jpg。

func TVShowNFO

func TVShowNFO(r tmdb.Result) ([]byte, error)

TVShowNFO 是剧集的 NFO(<tvshow>,放在剧集目录里,文件名 tvshow.nfo)。

Types

type Images

type Images interface {
	Image(ctx context.Context, path, size string) ([]byte, error)
}

Images 下载 TMDB 图片(生产环境是 *tmdb.Client)。

type Report

type Report struct {
	Written []string
	Errors  []string
}

Report 是一次刮削写了哪些文件、哪些失败了。

func (*Report) Merge

func (r *Report) Merge(o Report)

Merge 把另一次的结果并进来。

type Writer

type Writer struct {
	Images    Images
	Overwrite bool
}

Writer 写 NFO 与图片。Overwrite 为假时已经存在的文件不动。

func (Writer) Episode

func (w Writer) Episode(ctx context.Context, videoPath string, show tmdb.Result, season, episode, end int, s *tmdb.Season) Report

Episode 为一个剧集文件写 <文件名>.nfo 与 <文件名>-thumb.jpg(第一集的截图)。

func (Writer) Movie

func (w Writer) Movie(ctx context.Context, videoPath string, ownDir bool, r tmdb.Result) Report

Movie 为一个电影文件写 <文件名>.nfo;电影有自己的目录(ownDir)时再写 poster.jpg 与 fanart.jpg, 放在库目录根下时写成 <文件名>-poster.jpg 与 <文件名>-fanart.jpg。

func (Writer) Season

func (w Writer) Season(ctx context.Context, showDir, seasonDir string, number int, s *tmdb.Season) Report

Season 在剧集目录里写季海报;季目录(seasonDir)不是剧集目录时在季目录里写 season.nfo。

func (Writer) Show

func (w Writer) Show(ctx context.Context, showDir string, r tmdb.Result) Report

Show 在剧集目录里写 tvshow.nfo、poster.jpg 与 fanart.jpg。

Jump to

Keyboard shortcuts

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