Documentation
¶
Index ¶
- Constants
- Variables
- func AdjustDatetimeByVideoDuration(datetime time.Time, videoPath string) time.Time
- func CountFailures(results []CheckResult) int
- func CountProblems(results []CheckResult) int
- func GetExifTags(path string) (map[string]string, error)
- func GetExifTagsWithTool(et *exiftool.Exiftool, path string) (map[string]string, error)
- func GetFormattedVideoDuration(duration float64) string
- func GetVideoDuration(videoPath string) float64
- func GetVideoMetadataCachePath(videoPath string) string
- func HasFailure(results []CheckResult) bool
- func LocalMediaComparison(m MediaFile, destinationPath string) bool
- func PrintChecks(w io.Writer, results []CheckResult)
- func Ptr[T any](v T) *T
- func RunCLI() error
- type CheckResult
- type CheckStatus
- type Config
- type DiabloIVProvider
- type FileManager
- func (f *FileManager) AddCleanup(cleanup func())
- func (f *FileManager) Cleanup() error
- func (f *FileManager) DownloadURL(url string) (tempFile *os.File, err error)
- func (f *FileManager) FileExists(path string) bool
- func (f *FileManager) GetPathForGame(game *Game) string
- func (f *FileManager) ProcessGame(game *Game) error
- func (f *FileManager) ProcessMedia(game *Game, media MediaFile) error
- func (f *FileManager) WriteFile(path string, data io.Reader) error
- func (f *FileManager) WriteFileIfModified(path string, data []byte) error
- type GalleryBuilder
- type GalleryConfig
- type GalleryNode
- func (n *GalleryNode) AddFile(child *GalleryNode)
- func (n *GalleryNode) AddFolder(child *GalleryNode)
- func (n *GalleryNode) Empty() bool
- func (n *GalleryNode) GetBreadcrumbs() []*GalleryNode
- func (n *GalleryNode) GetFolderCount() int
- func (n *GalleryNode) GetFormattedVideoDuration(config *Config) string
- func (n *GalleryNode) GetImageCount() int
- func (n *GalleryNode) GetLastUpdated() string
- func (n *GalleryNode) GetThumbPath() string
- func (n *GalleryNode) GetVideoCount() int
- func (n *GalleryNode) GetVideoDuration() float64
- func (n *GalleryNode) GetWebCoverPath() string
- func (n *GalleryNode) GetWebPath() string
- func (n *GalleryNode) HasThumb() bool
- func (n *GalleryNode) Kind() GalleryNodeKind
- type GalleryNodeKind
- type Game
- type GameManager
- type GlobalConfig
- type GuildWars2Provider
- func (p *GuildWars2Provider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *GuildWars2Provider) GetClips() ([]Game, error)
- func (p *GuildWars2Provider) GetRecordings() ([]Game, error)
- func (p *GuildWars2Provider) GetScreenshots() error
- func (p *GuildWars2Provider) Requirements() []Requirement
- func (p *GuildWars2Provider) Run() error
- type HytaleProvider
- func (p *HytaleProvider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *HytaleProvider) GetClips() ([]Game, error)
- func (p *HytaleProvider) GetCovers() error
- func (p *HytaleProvider) GetRecordings() ([]Game, error)
- func (p *HytaleProvider) GetScreenshots() error
- func (p *HytaleProvider) Run() error
- type Media
- func (m *Media) Compare(destinationPath string) bool
- func (m *Media) GetDestinationName() string
- func (m *Media) GetKind() MediaKind
- func (m *Media) GetSourceHash() string
- func (m *Media) GetSourcePath() string
- func (m *Media) GetSourceURL() string
- func (m *Media) GetSubfolder() string
- func (m *Media) IsLocal() bool
- func (m *Media) SetDestinationName(destinationName string)
- func (m *Media) SetSourcePath(sourcePath string)
- func (m *Media) SetSourceURL(sourceURL string)
- type MediaFile
- type MediaKind
- type MinecraftProvider
- type NintendoSwitch2Config
- type NintendoSwitch2Provider
- type Playstation4Provider
- func (p *Playstation4Provider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *Playstation4Provider) GetClips() ([]Game, error)
- func (p *Playstation4Provider) GetRecordings() ([]Game, error)
- func (p *Playstation4Provider) GetScreenshots() error
- func (p *Playstation4Provider) Requirements() []Requirement
- func (p *Playstation4Provider) Run() error
- type Playstation5Provider
- func (p *Playstation5Provider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *Playstation5Provider) GetClips() ([]Game, error)
- func (p *Playstation5Provider) GetRecordings() ([]Game, error)
- func (p *Playstation5Provider) GetScreenshots() error
- func (p *Playstation5Provider) Requirements() []Requirement
- func (p *Playstation5Provider) Run() error
- type Provider
- type ProviderConfig
- type ProviderRegistry
- type Providers
- type PublishedFileDetail
- type Requirement
- type RequirementUse
- type Requirer
- type SteamApp
- type SteamAppList
- type SteamAppListResponse
- type SteamClient
- func (c *SteamClient) DownloadGameCover(gameID string) (*os.File, error)
- func (c *SteamClient) DownloadSteamAppList() error
- func (c *SteamClient) GetGameCoverURL(gameID string) string
- func (c *SteamClient) GetGameID(gameName string) string
- func (c *SteamClient) GetGameName(gameID string) string
- func (c *SteamClient) GetPublishedScreenshots(steamID string) ([]PublishedFileDetail, error)
- func (c *SteamClient) GetSteamApps() SteamAppList
- func (c *SteamClient) SetAPIKey(apiKey string)
- type SteamConfig
- type SteamFileDetailsRequest
- type SteamFileDetailsResponse
- type SteamProvider
- func (p *SteamProvider) FindGames(options SteamConfig) ([]Game, error)
- func (p *SteamProvider) GetClips() error
- func (p *SteamProvider) GetCovers() error
- func (p *SteamProvider) GetPublishedScreenshots() error
- func (p *SteamProvider) GetRecordings() error
- func (p *SteamProvider) GetScreenshots() error
- func (p *SteamProvider) Run() error
- type SteamPublishedFilesResponse
- type VideoMetadata
- type WorldOfWarcraftProvider
- func (p *WorldOfWarcraftProvider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *WorldOfWarcraftProvider) GetClips() ([]Game, error)
- func (p *WorldOfWarcraftProvider) GetRecordings() ([]Game, error)
- func (p *WorldOfWarcraftProvider) GetScreenshots() error
- func (p *WorldOfWarcraftProvider) Run() error
- type XboxGameBarProvider
- func (p *XboxGameBarProvider) FindGames(options ProviderConfig) ([]Game, error)
- func (p *XboxGameBarProvider) GetClips() ([]Game, error)
- func (p *XboxGameBarProvider) GetRecordings() ([]Game, error)
- func (p *XboxGameBarProvider) GetScreenshots() error
- func (p *XboxGameBarProvider) Requirements() []Requirement
- func (p *XboxGameBarProvider) Run() error
Constants ¶
const DatetimeFormat = "2006-01-02_15-04-05"
Variables ¶
var ( // ErrMTPBusy reports a device another program holds. Only one program at a // time can hold an MTP device, and a desktop file manager takes it as soon // as it appears. ErrMTPBusy = errors.New("another program holds the device, so it cannot be read") // ErrMTPStaleSession reports a device that kept the session of a program // that died. The device answers the next OpenSession with // SessionAlreadyOpen, and then answers GetDeviceInfo with // InvalidTransactionID. Only a replug clears it. ErrMTPStaleSession = errors.New("the device kept a session from a program that died") // ErrMTPNoDevice reports that no MTP device answered. ErrMTPNoDevice = errors.New("no MTP device answered") )
var ErrCopyFileDestinationExists = errors.New("copy destination exists")
Functions ¶
func AdjustDatetimeByVideoDuration ¶ added in v1.3.3
AdjustDatetimeByVideoDuration subtracts the duration of a video from a given datetime This is useful for providers like PlayStation 5 where the video timestamp is the end time
func CountFailures ¶ added in v1.6.0
func CountFailures(results []CheckResult) int
CountFailures counts the checks that failed.
func CountProblems ¶ added in v1.6.0
func CountProblems(results []CheckResult) int
CountProblems counts the checks that did not pass.
func GetExifTagsWithTool ¶
func GetFormattedVideoDuration ¶ added in v1.3.3
GetFormattedVideoDuration returns the duration of a video file formatted as: - "MM:SS" if the duration is 1 minute or longer - "XXs" if the duration is less than 1 minute Returns an empty string if there's an error
func GetVideoDuration ¶ added in v1.3.3
GetVideoDuration extracts the duration of a video file in seconds Returns 0 if there's an error getting the duration
func GetVideoMetadataCachePath ¶ added in v1.3.3
GetVideoMetadataCachePath returns the path to the metadata cache file for a video file
func HasFailure ¶ added in v1.6.0
func HasFailure(results []CheckResult) bool
HasFailure reports a run that cannot work as configured.
func LocalMediaComparison ¶ added in v1.1.0
LocalMediaComparison compares the sha1 shases of the source and destination files
func PrintChecks ¶ added in v1.6.0
func PrintChecks(w io.Writer, results []CheckResult)
PrintChecks writes the report. It goes to stdout rather than through the logger, because the report is the product of the command.
Types ¶
type CheckResult ¶ added in v1.6.0
type CheckResult struct {
Scope string
Name string
Status CheckStatus
Detail string
Remedy string
}
CheckResult is one line of the report.
func RunDoctor ¶ added in v1.6.0
func RunDoctor(config *Config, configPath string) []CheckResult
RunDoctor checks the configuration and the system. It writes no file, it creates no directory, and it runs no provider.
type CheckStatus ¶ added in v1.6.0
type CheckStatus string
CheckStatus is the outcome of one check.
const ( // CheckOK reports a check that passed. CheckOK CheckStatus = "ok" // CheckWarn reports a run that works with a feature off or degraded. CheckWarn CheckStatus = "warn" // CheckFail reports an enabled provider that cannot work. CheckFail CheckStatus = "fail" )
type Config ¶
type Config struct {
OutputPath string `toml:"output_path"`
Global GlobalConfig `toml:"global"`
Gallery GalleryConfig `toml:"gallery"`
Providers Providers `toml:"providers"`
// Dry run is provided via -dry-run CLI flag
DryRun bool
}
Config represents the root configuration structure
type DiabloIVProvider ¶ added in v1.7.0
type DiabloIVProvider struct {
// contains filtered or unexported fields
}
func NewDiabloIVProvider ¶ added in v1.7.0
func NewDiabloIVProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*DiabloIVProvider, error)
func (*DiabloIVProvider) FindGames ¶ added in v1.7.0
func (p *DiabloIVProvider) FindGames(options ProviderConfig) ([]Game, error)
func (*DiabloIVProvider) GetClips ¶ added in v1.7.0
func (p *DiabloIVProvider) GetClips() ([]Game, error)
func (*DiabloIVProvider) GetRecordings ¶ added in v1.7.0
func (p *DiabloIVProvider) GetRecordings() ([]Game, error)
func (*DiabloIVProvider) GetScreenshots ¶ added in v1.7.0
func (p *DiabloIVProvider) GetScreenshots() error
func (*DiabloIVProvider) Run ¶ added in v1.7.0
func (p *DiabloIVProvider) Run() error
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
func NewFileManager ¶
func NewFileManager(config Config) *FileManager
func (*FileManager) AddCleanup ¶ added in v1.6.0
func (f *FileManager) AddCleanup(cleanup func())
AddCleanup registers work to do once the run is over. A provider that stages a file outside the output tree removes it here, so the file lives as long as the file manager needs to read it.
func (*FileManager) Cleanup ¶
func (f *FileManager) Cleanup() error
func (*FileManager) DownloadURL ¶
func (f *FileManager) DownloadURL(url string) (tempFile *os.File, err error)
DownloadURL downloads a URL to a temporary file and takes care of the cleanup
func (*FileManager) FileExists ¶
func (f *FileManager) FileExists(path string) bool
func (*FileManager) GetPathForGame ¶
func (f *FileManager) GetPathForGame(game *Game) string
func (*FileManager) ProcessGame ¶
func (f *FileManager) ProcessGame(game *Game) error
func (*FileManager) ProcessMedia ¶
func (f *FileManager) ProcessMedia(game *Game, media MediaFile) error
func (*FileManager) WriteFile ¶
func (f *FileManager) WriteFile(path string, data io.Reader) error
WriteFile puts the data at path in one step. It writes a temporary file in the same directory and renames it, so a failure part way cannot leave a truncated file where a complete one was.
func (*FileManager) WriteFileIfModified ¶
func (f *FileManager) WriteFileIfModified(path string, data []byte) error
type GalleryBuilder ¶
type GalleryBuilder struct {
Config Config
Root *GalleryNode
IgnoreNames []string
// contains filtered or unexported fields
}
func NewGalleryBuilder ¶
func NewGalleryBuilder(config Config) (*GalleryBuilder, error)
func (*GalleryBuilder) Build ¶
func (b *GalleryBuilder) Build() (*GalleryNode, error)
func (*GalleryBuilder) Requirements ¶ added in v1.6.0
func (b *GalleryBuilder) Requirements() []Requirement
Requirements reports the external programs the gallery needs. Both are for video, so a gallery of screenshots alone needs neither.
type GalleryConfig ¶
type GalleryConfig struct {
Create bool `toml:"create"`
SiteTitle string `toml:"site_title"`
Context map[string]string `toml:"context"`
ShowVideoDuration bool `toml:"show_video_duration"`
}
GalleryConfig represents the web gallery configuration
func (*GalleryConfig) Defaults ¶
func (c *GalleryConfig) Defaults()
type GalleryNode ¶
type GalleryNode struct {
Title string
Path string
Parent *GalleryNode
Folders []*GalleryNode `json:",omitempty"`
Files []*GalleryNode `json:",omitempty"`
Cover string `json:",omitempty"`
}
func (*GalleryNode) AddFile ¶
func (n *GalleryNode) AddFile(child *GalleryNode)
func (*GalleryNode) AddFolder ¶
func (n *GalleryNode) AddFolder(child *GalleryNode)
func (*GalleryNode) Empty ¶
func (n *GalleryNode) Empty() bool
func (*GalleryNode) GetBreadcrumbs ¶
func (n *GalleryNode) GetBreadcrumbs() []*GalleryNode
func (*GalleryNode) GetFolderCount ¶
func (n *GalleryNode) GetFolderCount() int
func (*GalleryNode) GetFormattedVideoDuration ¶ added in v1.3.0
func (n *GalleryNode) GetFormattedVideoDuration(config *Config) string
GetFormattedVideoDuration returns the duration of a video file formatted as: - "MM:SS" if the duration is 1 minute or longer - "XXs" if the duration is less than 1 minute Returns an empty string if the file is not a video, if there's an error, or if show_video_duration is disabled in the configuration
func (*GalleryNode) GetImageCount ¶
func (n *GalleryNode) GetImageCount() int
func (*GalleryNode) GetLastUpdated ¶ added in v1.2.2
func (n *GalleryNode) GetLastUpdated() string
GetLastUpdated returns the most recent modification time of original image and video files in this folder or its subfolders recursively. It returns this time formatted as RFC3339.
func (*GalleryNode) GetThumbPath ¶
func (n *GalleryNode) GetThumbPath() string
func (*GalleryNode) GetVideoCount ¶
func (n *GalleryNode) GetVideoCount() int
func (*GalleryNode) GetVideoDuration ¶ added in v1.3.0
func (n *GalleryNode) GetVideoDuration() float64
GetVideoDuration returns the duration of a video file in seconds Returns 0 if the file is not a video or if there's an error getting the duration
func (*GalleryNode) GetWebCoverPath ¶
func (n *GalleryNode) GetWebCoverPath() string
func (*GalleryNode) GetWebPath ¶
func (n *GalleryNode) GetWebPath() string
func (*GalleryNode) HasThumb ¶
func (n *GalleryNode) HasThumb() bool
func (*GalleryNode) Kind ¶
func (n *GalleryNode) Kind() GalleryNodeKind
type GalleryNodeKind ¶
type GalleryNodeKind string
const ( GalleryNodeKindFolder GalleryNodeKind = "folder" GalleryNodeKindImage GalleryNodeKind = "image" GalleryNodeKindVideo GalleryNodeKind = "video" )
type Game ¶
type Game struct {
ID string
CoverURL string
Name string
Platform string
Provider string
Screenshots []*Media
Clips []*Media
Recordings []*Media
Cover *Media
}
func (*Game) AddRecording ¶
func (*Game) AddScreenshot ¶
type GameManager ¶
type GameManager struct {
// contains filtered or unexported fields
}
func NewGameManager ¶
func NewGameManager() *GameManager
func (*GameManager) AddGame ¶
func (gm *GameManager) AddGame(game *Game) *Game
func (*GameManager) GetGame ¶
func (gm *GameManager) GetGame(id string) *Game
func (*GameManager) GetGames ¶
func (gm *GameManager) GetGames() []*Game
type GlobalConfig ¶
type GlobalConfig struct {
Enabled bool `toml:"enabled"`
DownloadCovers bool `toml:"download_covers"`
}
GlobalConfig represents the global configuration settings
func (*GlobalConfig) Defaults ¶
func (c *GlobalConfig) Defaults()
type GuildWars2Provider ¶
type GuildWars2Provider struct {
// contains filtered or unexported fields
}
func NewGuildWars2Provider ¶
func NewGuildWars2Provider(config Config, gameManager *GameManager, fileManager *FileManager) (*GuildWars2Provider, error)
func (*GuildWars2Provider) FindGames ¶
func (p *GuildWars2Provider) FindGames(options ProviderConfig) ([]Game, error)
func (*GuildWars2Provider) GetClips ¶
func (p *GuildWars2Provider) GetClips() ([]Game, error)
func (*GuildWars2Provider) GetRecordings ¶
func (p *GuildWars2Provider) GetRecordings() ([]Game, error)
func (*GuildWars2Provider) GetScreenshots ¶
func (p *GuildWars2Provider) GetScreenshots() error
func (*GuildWars2Provider) Requirements ¶ added in v1.6.0
func (p *GuildWars2Provider) Requirements() []Requirement
Requirements reports the external programs this provider needs.
func (*GuildWars2Provider) Run ¶
func (p *GuildWars2Provider) Run() error
type HytaleProvider ¶ added in v1.5.0
type HytaleProvider struct {
// contains filtered or unexported fields
}
func NewHytaleProvider ¶ added in v1.5.0
func NewHytaleProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*HytaleProvider, error)
func (*HytaleProvider) FindGames ¶ added in v1.5.0
func (p *HytaleProvider) FindGames(options ProviderConfig) ([]Game, error)
func (*HytaleProvider) GetClips ¶ added in v1.5.0
func (p *HytaleProvider) GetClips() ([]Game, error)
func (*HytaleProvider) GetCovers ¶ added in v1.5.0
func (p *HytaleProvider) GetCovers() error
func (*HytaleProvider) GetRecordings ¶ added in v1.5.0
func (p *HytaleProvider) GetRecordings() ([]Game, error)
func (*HytaleProvider) GetScreenshots ¶ added in v1.5.0
func (p *HytaleProvider) GetScreenshots() error
func (*HytaleProvider) Run ¶ added in v1.5.0
func (p *HytaleProvider) Run() error
type Media ¶
type Media struct {
Kind MediaKind
SourceURL string
SourcePath string
DestinationName string
Subfolder string
ComparisionFunc func(m MediaFile, destinationPath string) bool
}
func (*Media) GetDestinationName ¶
func (*Media) GetSourceHash ¶ added in v1.1.0
func (*Media) GetSourcePath ¶ added in v1.1.0
func (*Media) GetSourceURL ¶ added in v1.1.0
func (*Media) GetSubfolder ¶ added in v1.6.0
GetSubfolder returns the folder below the game folder that holds the file. It returns an empty string for a file that belongs in the game folder itself.
func (*Media) SetDestinationName ¶ added in v1.1.0
func (*Media) SetSourcePath ¶ added in v1.1.2
func (*Media) SetSourceURL ¶ added in v1.1.2
type MediaFile ¶
type MediaFile interface {
GetSourcePath() string
SetSourcePath(sourcePath string)
GetSourceURL() string
SetSourceURL(sourceURL string)
GetSourceHash() string
GetDestinationName() string
SetDestinationName(destinationName string)
GetKind() MediaKind
GetSubfolder() string
IsLocal() bool
Compare(destinationPath string) bool
}
type MinecraftProvider ¶
type MinecraftProvider struct {
// contains filtered or unexported fields
}
func NewMinecraftProvider ¶
func NewMinecraftProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*MinecraftProvider, error)
func (*MinecraftProvider) FindGames ¶
func (p *MinecraftProvider) FindGames(options ProviderConfig) ([]Game, error)
func (*MinecraftProvider) GetClips ¶
func (p *MinecraftProvider) GetClips() ([]Game, error)
func (*MinecraftProvider) GetRecordings ¶
func (p *MinecraftProvider) GetRecordings() ([]Game, error)
func (*MinecraftProvider) GetScreenshots ¶
func (p *MinecraftProvider) GetScreenshots() error
func (*MinecraftProvider) Run ¶
func (p *MinecraftProvider) Run() error
type NintendoSwitch2Config ¶ added in v1.6.0
type NintendoSwitch2Config struct {
ProviderConfig
IgnoredFolders []string `toml:"ignored_folders"`
}
NintendoSwitch2Config represents the Nintendo Switch 2 specific configuration
func (*NintendoSwitch2Config) GetIgnoredFolders ¶ added in v1.6.0
func (c *NintendoSwitch2Config) GetIgnoredFolders() []string
GetIgnoredFolders returns the album folders the provider skips.
A key the config file does not hold takes the default. An empty list is a choice, not an absence, so it copies every folder.
type NintendoSwitch2Provider ¶ added in v1.6.0
type NintendoSwitch2Provider struct {
// contains filtered or unexported fields
}
NintendoSwitch2Provider collects the album of a Nintendo Switch 2.
The console shares its album over MTP, and the provider reads it through the libmtp command line tools. A path in the config reads a folder instead, which is how an album that was already copied off the console is collected.
func NewNintendoSwitch2Provider ¶ added in v1.6.0
func NewNintendoSwitch2Provider(config Config, gameManager *GameManager, fileManager *FileManager) (*NintendoSwitch2Provider, error)
func (*NintendoSwitch2Provider) Requirements ¶ added in v1.6.0
func (p *NintendoSwitch2Provider) Requirements() []Requirement
Requirements reports the external programs this provider needs.
They all ship in libmtp. A path in the config reads a folder rather than the console, so none of them is needed then.
func (*NintendoSwitch2Provider) Run ¶ added in v1.6.0
func (p *NintendoSwitch2Provider) Run() error
type Playstation4Provider ¶
type Playstation4Provider struct {
// contains filtered or unexported fields
}
func NewPlaystation4Provider ¶
func NewPlaystation4Provider(config Config, gameManager *GameManager, fileManager *FileManager) (*Playstation4Provider, error)
func (*Playstation4Provider) FindGames ¶
func (p *Playstation4Provider) FindGames(options ProviderConfig) ([]Game, error)
func (*Playstation4Provider) GetClips ¶
func (p *Playstation4Provider) GetClips() ([]Game, error)
func (*Playstation4Provider) GetRecordings ¶
func (p *Playstation4Provider) GetRecordings() ([]Game, error)
func (*Playstation4Provider) GetScreenshots ¶
func (p *Playstation4Provider) GetScreenshots() error
func (*Playstation4Provider) Requirements ¶ added in v1.6.0
func (p *Playstation4Provider) Requirements() []Requirement
Requirements reports the external programs this provider needs.
func (*Playstation4Provider) Run ¶
func (p *Playstation4Provider) Run() error
type Playstation5Provider ¶
type Playstation5Provider struct {
// contains filtered or unexported fields
}
func NewPlaystation5Provider ¶
func NewPlaystation5Provider(config Config, gameManager *GameManager, fileManager *FileManager) (*Playstation5Provider, error)
func (*Playstation5Provider) FindGames ¶
func (p *Playstation5Provider) FindGames(options ProviderConfig) ([]Game, error)
func (*Playstation5Provider) GetClips ¶
func (p *Playstation5Provider) GetClips() ([]Game, error)
func (*Playstation5Provider) GetRecordings ¶
func (p *Playstation5Provider) GetRecordings() ([]Game, error)
func (*Playstation5Provider) GetScreenshots ¶
func (p *Playstation5Provider) GetScreenshots() error
func (*Playstation5Provider) Requirements ¶ added in v1.6.0
func (p *Playstation5Provider) Requirements() []Requirement
Requirements reports the external programs this provider needs. A clip is named after the moment it ends, so its length dates it from its start.
ffprobe is optional. Without it GetVideoDuration returns 0, and the clip keeps the end time the console wrote. The clip is still collected.
func (*Playstation5Provider) Run ¶
func (p *Playstation5Provider) Run() error
type ProviderConfig ¶
type ProviderConfig struct {
Enabled *bool `toml:"enabled"`
DownloadCovers *bool `toml:"download_covers"`
Path *string `toml:"path"`
}
ProviderConfig represents the configuration for a specific provider
func (*ProviderConfig) GetPath ¶
func (c *ProviderConfig) GetPath() string
func (*ProviderConfig) IsEnabled ¶
func (c *ProviderConfig) IsEnabled() bool
func (*ProviderConfig) Merge ¶
func (pc *ProviderConfig) Merge(global *GlobalConfig)
Merge merges the provider config with the global config and defaults
func (*ProviderConfig) ShouldDownloadCovers ¶
func (c *ProviderConfig) ShouldDownloadCovers() bool
type ProviderRegistry ¶
type ProviderRegistry struct {
Providers map[string]Provider
// contains filtered or unexported fields
}
func NewProviderRegistry ¶
func NewProviderRegistry(config *Config, gameManager *GameManager, fileManager *FileManager) (*ProviderRegistry, error)
func (*ProviderRegistry) Requirements ¶ added in v1.6.0
func (r *ProviderRegistry) Requirements() map[string][]RequirementUse
Requirements returns every requirement the registered providers declare, grouped by the program to look for. Two providers that want one program therefore produce one key that holds two uses.
type Providers ¶
type Providers struct {
DiabloIV ProviderConfig `toml:"diablo_4"`
GuildWars2 ProviderConfig `toml:"guild_wars_2"`
Hytale ProviderConfig `toml:"hytale"`
Minecraft ProviderConfig `toml:"minecraft"`
NintendoSwitch2 NintendoSwitch2Config `toml:"nintendo_switch_2"`
PlayStation4 ProviderConfig `toml:"playstation4"`
PlayStation5 ProviderConfig `toml:"playstation5"`
Steam SteamConfig `toml:"steam"`
WorldOfWarcraft ProviderConfig `toml:"world_of_warcraft"`
XboxGameBar ProviderConfig `toml:"xbox_game_bar"`
}
Providers represents all game provider configurations
type PublishedFileDetail ¶
type PublishedFileDetail struct {
AppID int `json:"consumer_appid"`
FileURL string `json:"file_url"`
PreviewURL string `json:"preview_url"`
PublishedFileID string `json:"publishedfileid"`
TimeCreated int `json:"time_created"`
TimeUpdated int `json:"time_updated"`
ShortcutName string `json:"shortcutname"`
}
PublishedScreenshot represents a screenshot published to Steam
func (*PublishedFileDetail) GetFileSHA1 ¶ added in v1.1.0
func (f *PublishedFileDetail) GetFileSHA1() string
func (*PublishedFileDetail) GetPreviewSHA1 ¶ added in v1.1.0
func (f *PublishedFileDetail) GetPreviewSHA1() string
type Requirement ¶ added in v1.6.0
type Requirement struct {
// Binary is the program to look for, as in "ffprobe".
Binary string
// Package is what the user installs to get it. The ffmpeg package ships
// ffprobe, so the two names differ.
Package string
// Reason is why the provider needs the program, in one short phrase.
Reason string
// Optional marks a program the provider works without. The doctor reports
// a missing one as a warning rather than a failure, and it does not set
// the exit code. Degraded is not broken: the run still collects the media,
// with whatever the program would have improved left as it is.
Optional bool
// Degradation says what the run loses without the program, in one short
// phrase. It is read for an optional requirement only.
Degradation string
}
Requirement is one external program a provider needs.
type RequirementUse ¶ added in v1.6.0
type RequirementUse struct {
// Provider is the name the registry holds, or "gallery".
Provider string
Requirement Requirement
}
RequirementUse is one provider's need for one external program.
type Requirer ¶ added in v1.6.0
type Requirer interface {
Requirements() []Requirement
}
Requirer is an optional interface. A provider that needs an external program implements it, and a provider that needs none does not. The method sits on the provider, so a requirement can depend on that provider's own config.
type SteamAppList ¶
type SteamAppList struct {
Apps []SteamApp `json:"apps"`
}
SteamAppList is a collection of SteamApp
func (*SteamAppList) GetGameID ¶ added in v1.1.0
func (s *SteamAppList) GetGameID(gameName string) string
func (*SteamAppList) GetGameName ¶
func (s *SteamAppList) GetGameName(gameID string) string
type SteamAppListResponse ¶
type SteamClient ¶
type SteamClient struct {
// contains filtered or unexported fields
}
SteamClient handles API interactions with Steam
func NewSteamClient ¶
func NewSteamClient(fileManager *FileManager, apiKey string) (*SteamClient, error)
NewSteamClient creates a new Steam client apiKey is optional but required for downloading the app list (the endpoint requires authentication)
func (*SteamClient) DownloadGameCover ¶
func (c *SteamClient) DownloadGameCover(gameID string) (*os.File, error)
DownloadGameCover downloads a game's cover image.
Three URLs can answer, and they are tried in the order that costs least:
- A cover URL the cache already holds. It costs no request, and it is what keeps an app whose legacy path is dead from probing that path every run.
- The legacy path. It needs no lookup, and Steam still serves it for older apps, so a library of them costs no store request at all.
- A fresh store lookup. This is the only source for an app published under the per-revision asset scheme, and it also repairs a cached URL whose art the publisher has replaced.
Step 3 is skipped when the cache already reports that the store holds no app for the ID, because that answer is not going to change within its TTL.
func (*SteamClient) DownloadSteamAppList ¶
func (c *SteamClient) DownloadSteamAppList() error
DownloadSteamAppList downloads the Steam APP List and caches it It's used to get the JSON response with all the games so we can match the game ID (folder name) with the game name (from the JSON response)
func (*SteamClient) GetGameCoverURL ¶ added in v1.6.0
func (c *SteamClient) GetGameCoverURL(gameID string) string
GetGameCoverURL returns the store URL of a game's cover image, or an empty string when the store holds no app for the ID. The app list carries no cover URL, so this always asks the store, and the answer is cached.
func (*SteamClient) GetGameID ¶ added in v1.1.0
func (c *SteamClient) GetGameID(gameName string) string
GetGameID returns the ID of a game by its name
func (*SteamClient) GetGameName ¶
func (c *SteamClient) GetGameName(gameID string) string
GetGameName returns the name of a game by its ID. The app list is the first source. It holds no demo, so a miss asks the store for that one app ID.
func (*SteamClient) GetPublishedScreenshots ¶
func (c *SteamClient) GetPublishedScreenshots(steamID string) ([]PublishedFileDetail, error)
GetPublishedScreenshots retrieves all screenshots published by a Steam user
func (*SteamClient) GetSteamApps ¶
func (c *SteamClient) GetSteamApps() SteamAppList
GetSteamApps returns the current list of Steam apps
func (*SteamClient) SetAPIKey ¶
func (c *SteamClient) SetAPIKey(apiKey string)
SetAPIKey sets the Steam Web API key for authenticated requests
type SteamConfig ¶
type SteamConfig struct {
ProviderConfig
UserDataPath string `toml:"userdata_path"`
RecordingsPath string `toml:"recordings_path"`
ProcessRecordings bool `toml:"process_recordings"`
ProcessClips bool `toml:"process_clips"`
OnlineGallery bool `toml:"online_gallery"`
UserID string `toml:"user_id"`
APIKey string `toml:"api_key"`
CustomGames map[string]string `toml:"custom_games"`
IgnoredGames []string `toml:"ignored_games"`
}
SteamConfig represents the Steam-specific configuration
func (*SteamConfig) GetPath ¶
func (c *SteamConfig) GetPath() string
func (*SteamConfig) GetUserDataPath ¶
func (c *SteamConfig) GetUserDataPath() string
func (*SteamConfig) ShouldProcessClips ¶
func (c *SteamConfig) ShouldProcessClips() bool
func (*SteamConfig) ShouldProcessRecordings ¶
func (c *SteamConfig) ShouldProcessRecordings() bool
type SteamFileDetailsRequest ¶
type SteamFileDetailsRequest struct {
ItemCount int `json:"itemcount"`
PublishedFileIDs []string `json:"publishedfileids"`
}
SteamFileDetailsRequest represents the request to GetPublishedFileDetails
type SteamFileDetailsResponse ¶
type SteamFileDetailsResponse struct {
Response struct {
PublishedFileDetails []struct {
PublishedFileID string `json:"publishedfileid"`
AppID int `json:"consumer_app_id"`
Title string `json:"title"`
Description string `json:"description"`
FileURL string `json:"file_url"`
PreviewURL string `json:"preview_url"`
FileType int `json:"file_type"`
} `json:"publishedfiledetails"`
Result int `json:"result"`
} `json:"response"`
}
SteamFileDetailsResponse represents the response from GetPublishedFileDetails
type SteamProvider ¶
type SteamProvider struct {
// contains filtered or unexported fields
}
func NewSteamProvider ¶
func NewSteamProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*SteamProvider, error)
func (*SteamProvider) FindGames ¶
func (p *SteamProvider) FindGames(options SteamConfig) ([]Game, error)
func (*SteamProvider) GetClips ¶
func (p *SteamProvider) GetClips() error
func (*SteamProvider) GetCovers ¶
func (p *SteamProvider) GetCovers() error
func (*SteamProvider) GetPublishedScreenshots ¶
func (p *SteamProvider) GetPublishedScreenshots() error
GetPublishedScreenshots retrieves screenshots published to Steam by the configured user
func (*SteamProvider) GetRecordings ¶
func (p *SteamProvider) GetRecordings() error
func (*SteamProvider) GetScreenshots ¶
func (p *SteamProvider) GetScreenshots() error
func (*SteamProvider) Run ¶
func (p *SteamProvider) Run() error
type SteamPublishedFilesResponse ¶
type SteamPublishedFilesResponse struct {
Response struct {
PublishedFileDetails []PublishedFileDetail `json:"publishedfiledetails"`
Total int `json:"total"`
StartIndex int `json:"startindex"`
} `json:"response"`
}
SteamPublishedFilesResponse represents the response from GetPublishedFilesByUser
type VideoMetadata ¶ added in v1.3.3
type VideoMetadata struct {
FFmpegMetadata string `json:"ffmpeg_metadata"`
Duration float64 `json:"duration"`
Timestamp string `json:"timestamp"` // ISO8601/RFC3339
}
VideoMetadata represents cached metadata for video files
type WorldOfWarcraftProvider ¶
type WorldOfWarcraftProvider struct {
// contains filtered or unexported fields
}
func NewWorldOfWarcraftProvider ¶
func NewWorldOfWarcraftProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*WorldOfWarcraftProvider, error)
func (*WorldOfWarcraftProvider) FindGames ¶
func (p *WorldOfWarcraftProvider) FindGames(options ProviderConfig) ([]Game, error)
func (*WorldOfWarcraftProvider) GetClips ¶
func (p *WorldOfWarcraftProvider) GetClips() ([]Game, error)
func (*WorldOfWarcraftProvider) GetRecordings ¶
func (p *WorldOfWarcraftProvider) GetRecordings() ([]Game, error)
func (*WorldOfWarcraftProvider) GetScreenshots ¶
func (p *WorldOfWarcraftProvider) GetScreenshots() error
func (*WorldOfWarcraftProvider) Run ¶
func (p *WorldOfWarcraftProvider) Run() error
type XboxGameBarProvider ¶
type XboxGameBarProvider struct {
// contains filtered or unexported fields
}
func NewXboxGameBarProvider ¶
func NewXboxGameBarProvider(config Config, gameManager *GameManager, fileManager *FileManager) (*XboxGameBarProvider, error)
func (*XboxGameBarProvider) FindGames ¶
func (p *XboxGameBarProvider) FindGames(options ProviderConfig) ([]Game, error)
func (*XboxGameBarProvider) GetClips ¶
func (p *XboxGameBarProvider) GetClips() ([]Game, error)
func (*XboxGameBarProvider) GetRecordings ¶
func (p *XboxGameBarProvider) GetRecordings() ([]Game, error)
func (*XboxGameBarProvider) GetScreenshots ¶
func (p *XboxGameBarProvider) GetScreenshots() error
func (*XboxGameBarProvider) Requirements ¶ added in v1.6.0
func (p *XboxGameBarProvider) Requirements() []Requirement
Requirements reports the external programs this provider needs.
func (*XboxGameBarProvider) Run ¶
func (p *XboxGameBarProvider) Run() error