pkg

package
v0.0.0-...-ad0698c Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendJobLog

func AppendJobLog(message string)

func ClearFolderContent

func ClearFolderContent(source string) error

func ClearJobLogs

func ClearJobLogs(newJobName string)

func GetJobName

func GetJobName() string

func IsDirectoryExists

func IsDirectoryExists(path string) bool

func MoveFile

func MoveFile(source, destination string) error

func SanitizeMovieFilename

func SanitizeMovieFilename(filename string) (string, string)

SanitizeMovieFilename sanitize a movie filename by removing non ASCII characters, removing non-relevant information, returning the name and the year

func SanitizeTVShowFilename

func SanitizeTVShowFilename(filename string) (string, int, int)

SanitizeTVShowFilename separates a TV show filename into title, season number, and episode number

Types

type AtomicMovieList

type AtomicMovieList struct {
	// contains filtered or unexported fields
}

func NewAtomicMovieList

func NewAtomicMovieList() *AtomicMovieList

func (*AtomicMovieList) Get

func (a *AtomicMovieList) Get(mediaFile MovieFile) (Movie, bool)

func (*AtomicMovieList) GetAll

func (a *AtomicMovieList) GetAll() map[MovieFile]Movie

func (*AtomicMovieList) LinkMediaFile

func (a *AtomicMovieList) LinkMediaFile(mediaFile MovieFile, media Movie)

type AtomicTVEpisodeList

type AtomicTVEpisodeList struct {
	// contains filtered or unexported fields
}

func NewAtomicTVEpisodeList

func NewAtomicTVEpisodeList() *AtomicTVEpisodeList

func (*AtomicTVEpisodeList) Get

func (a *AtomicTVEpisodeList) Get(mediaFile TVShowFile) (TVEpisode, bool)

func (*AtomicTVEpisodeList) GetAll

func (a *AtomicTVEpisodeList) GetAll() map[TVShowFile]TVEpisode

func (*AtomicTVEpisodeList) LinkMediaFile

func (a *AtomicTVEpisodeList) LinkMediaFile(mediaFile TVShowFile, media TVEpisode)

type AudioData

type AudioData struct {
	Codec    string  // The codec used to encode the audio (e.g. AAC, MP3, etc)
	Language string  // The language of the audio stream (e.g. English, Spanish, etc)
	Bitrate  float64 // The bitrate of the audio stream in bits per second
}

AudioData is a struct that holds information about an audio stream

type Category

type Category struct {
	ID   int
	Name string
}

type JobLog

type JobLog struct {
	JobName string `json:"jobName" example:"upload movie"`
	Date    string `json:"date" example:"2021-01-01 12:00:00"`
	Message string `json:"message" example:"Uploading movie test.mp4"`
}

func GetJobLogs

func GetJobLogs() []JobLog

func PopJobLogs

func PopJobLogs() []JobLog

type Media

type Media struct {
	ID          int
	Name        string
	ReleaseDate string
	Categories  []Category
}

func (*Media) Year

func (m *Media) Year() string

type MediaClient

type MediaClient interface {
	SearchMovie(query string, year string) (Movie, error)
	SearchTVShow(query string, season, episode int) (TVEpisode, error)
}

func NewMediaClient

func NewMediaClient(apiKey string) MediaClient

func NewRedisMediaClient

func NewRedisMediaClient(apiKey, redisHost, redisPassword string) MediaClient

type MediaData

type MediaData struct {
	Size      float64        // The size of the media file in bytes
	Duration  float64        // The duration of the media file in seconds
	Codec     string         // The codec used to encode the video (e.g. H.264, H.265, etc)
	Mimetype  string         // File MIME Type
	Audios    []AudioData    // An array of AudioData structs representing the audio streams in the media file
	Subtitles []SubtitleData // An array of SubtitleData structs representing the subtitle streams in the media file
}

MediaData is a struct that holds information about a media file

func RetrieveMediaData

func RetrieveMediaData(filePath string) (MediaData, error)

RetrieveMediaData retrieves media data from a file using ffprobe

type Movie

type Movie struct {
	Media
}

type MovieFile

type MovieFile struct {
	Path          string
	Filename      string
	SanitizedName string
	Year          string
	Extension     string
}

func BuildMovieTree

func BuildMovieTree(source string) ([]MovieFile, error)

func (*MovieFile) String

func (m *MovieFile) String() string

type SubtitleData

type SubtitleData struct {
	Language string // The language of the subtitle stream (e.g. English, Spanish, etc)
	Codec    string // The codec used to encode the subtitles (e.g. SRT, ASS, etc)
}

SubtitleData is a struct that holds information about a subtitle stream

type TVEpisode

type TVEpisode struct {
	ID            int
	EpisodeName   string
	ReleaseDate   string
	Categories    []Category
	TvShowID      int
	TvShowName    string
	TvReleaseDate string
	Season        int
	Episode       int
}

func (*TVEpisode) Year

func (m *TVEpisode) Year() string

type TVShowFile

type TVShowFile struct {
	Path          string
	SanitizedName string
	Season        int
	Episode       int
	Filename      string
	Extension     string
}

func BuildTVShowTree

func BuildTVShowTree(source string) ([]TVShowFile, error)

BuildTVShowTree recursively builds a tree of TV show files in the given source directory.

func (TVShowFile) String

func (t TVShowFile) String() string

Jump to

Keyboard shortcuts

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