Documentation ¶
Overview ¶
Package library is an SQL-based movie library which supports Movies, Series and Episodes
Index ¶
- func JustShows(showsWithFiles <-chan ShowWithFile) chan *Show
- type CommonData
- type EpisodeData
- type Library
- func (lib *Library) GetFileByPath(path string) (*VideoFile, error)
- func (lib *Library) GetSeriesByEpisode(episode *Show) (*Series, error)
- func (lib *Library) GetSeriesByImdbID(id int) (*Series, error)
- func (lib *Library) GetShowByImdbID(id int) (*Show, error)
- func (lib *Library) GetSubtitleByFilename(filename string) (*Subtitle, error)
- func (lib *Library) GetSubtitleByHash(hash string) (*Subtitle, error)
- func (lib *Library) HasFileWithPath(path string) (bool, error)
- func (lib *Library) HasSeriesWithImdbID(id int) (bool, error)
- func (lib *Library) HasShowWithImdbID(id int) (bool, error)
- func (lib *Library) Save(item interface{}) error
- type Series
- type Show
- type ShowWithFile
- type Subtitle
- type VideoFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JustShows ¶
func JustShows(showsWithFiles <-chan ShowWithFile) chan *Show
JustShows extracts just the shows from a ShowWithFile channel
Types ¶
type CommonData ¶
type CommonData struct { ImdbID int `json:"imdb_id",sql:"unique"` Title string `json:"title"` Year int `json:"year"` OtherTitles types.MapStringString `gorm:"type:blob",json:"other_titles"` Duration types.Duration `gorm:"type:integer",json:"duration"` Plot string `json:"plot"` PlotMedium string `json:"plot_medium"` PlotLong string `json:"plot_long"` PosterURL string `json:"poster_url"` ImdbRating float32 `json:"imdb_rating"` ImdbVotes int `json:"imdb_votes"` Languages types.Languages `gorm:"type:text",json:"languages"` ImdbError *string `json:"imdb_error"` }
CommonData contains fields shared by movies, episodes and series
type EpisodeData ¶
EpisodeData contains episode-specific keys
type Library ¶
type Library struct {
// contains filtered or unexported fields
}
Library is a searchable library of movies, series and episodes
func (*Library) GetFileByPath ¶
GetFileByPath finds the file by its path, creating it if it doesn't exist
func (*Library) GetSeriesByEpisode ¶
GetSeriesByEpisode returns the series this show belongs to (if it's an episode) or nil otherwise
func (*Library) GetSeriesByImdbID ¶
GetSeriesByImdbID finds the series by its imdb id, creating it if it doesn't exist
func (*Library) GetShowByImdbID ¶
GetShowByImdbID finds the show by its imdb id, creating it if it doesn't exist
func (*Library) GetSubtitleByFilename ¶
GetSubtitleByFilename finds the subtitle by its filename, creating it if it doesn't exist
func (*Library) GetSubtitleByHash ¶
GetSubtitleByHash finds the subtitle by its hash, creating it if it doesn't exist
func (*Library) HasFileWithPath ¶
HasFileWithPath checks if there exists a file with this path in the library
func (*Library) HasSeriesWithImdbID ¶
HasSeriesWithImdbID checks if there exists a series with this id in the library
func (*Library) HasShowWithImdbID ¶
HasShowWithImdbID checks if there exists a show with this id in the library
type Series ¶
type Series struct { gorm.Model sync.Mutex CommonData Episodes []*Show `json:"episodes",gorm:"ForeignKey:SeriesID"` }
Series represents a series
func (*Series) AfterCreate ¶
AfterCreate initializes values on an empty series
type Show ¶
type Show struct { gorm.Model sync.Mutex CommonData EpisodeData ReleaseDate time.Time `json:"release_date"` Tagline string `json:"tagline"` Files []*VideoFile `json:"files",gorm:"ForeignKey:ShowID"` }
Show is a movie or an episode of a series
func (*Show) AfterCreate ¶
AfterCreate initializes values on an empty show
type ShowWithFile ¶
ShowWithFile is a pair of a Show and a VideoFile Used for cases where Show.ID == File.ShowID, but we don't want to search in the library for the show with this ID every time.
type Subtitle ¶
type Subtitle struct { gorm.Model sync.Mutex Hash string `json:"hash"` Language types.Language `gorm:"type:varchar(3)",json:"language"` HearingImpaired bool `json:"hearing_impaired"` Filename string `json:"filename",sql:"unique"` Score int `json:"score"` VideoFileID uint }
Subtitle represents a subtitle file
type VideoFile ¶
type VideoFile struct { gorm.Model sync.Mutex Path string `json:"filename",sql:"unique"` OriginalBasename string `json:"original_basename"` Size uint64 `json:"filesize"` ResolutionX uint `json:"resolution"` ResolutionY uint `json:"resolution"` OsdbHash types.BigUint64 `gorm:"type:varchar(16)",json:"osdb_hash"` VideoFormat string `json:"video_format"` AudioFormat string `json:"audio_format"` Framerate float32 `json:"framerate"` VideoBitrate float32 `json:"video_bitrate"` AudioBitrate float32 `json:"audio_bitrate"` Duration types.Duration `json:"duration"` LastPlayed time.Time `json:"last_played"` LastPosition types.Duration `json:"last_position"` ShowID uint Subtitles []*Subtitle `json:"subtitles",gorm:"ForeignKey:VideoFileID"` ImportError *string `json:"import_error"` OsdbError *string `json:"osdb_error"` SubtitlesError *string `json:"subtitles_error"` }
VideoFile reprsesents a file for an episode or movie
func (*VideoFile) AfterCreate ¶
AfterCreate initializes values on an empty video file