Documentation ¶
Index ¶
- type Database
- func (d *Database) CloseDatabase()
- func (d *Database) DeleteIgnorePath(ignorePath *IgnoredPath) error
- func (d *Database) DeleteMovie(rootDir string, movie *Movie) error
- func (d *Database) GetAllIgnoredPaths() ([]*IgnoredPath, error)
- func (d *Database) GetAllMoviePaths() ([]string, error)
- func (d *Database) GetAllMovieTitles() ([]string, error)
- func (d *Database) GetGenres() ([]Genre, error)
- func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error
- func (d *Database) InsertMovie(movie *Movie) error
- func (d *Database) InsertMovieGenre(movie *Movie, Genre *Genre) error
- func (d *Database) RemoveMovieGenre(movie *Movie, genre *Genre) error
- func (d *Database) SearchMovies(currentView string, searchFor string, genreId int, orderBy string) ([]*Movie, error)
- func (d *Database) UpdateImage(movie *Movie, imageData []byte) error
- func (d *Database) UpdateMovie(movie *Movie, updateGenres bool) error
- type Genre
- type GenreCache
- type IgnoredPath
- type ImageCache
- type Movie
- type MovieGenre
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { UseTestDatabase bool // contains filtered or unexported fields }
Database represents a connection to the SoftIMDB database.
func DatabaseNew ¶
DatabaseNew creates a new SoftIMDB Database object.
func (*Database) CloseDatabase ¶
func (d *Database) CloseDatabase()
CloseDatabase closes the database.
func (*Database) DeleteIgnorePath ¶
func (d *Database) DeleteIgnorePath(ignorePath *IgnoredPath) error
DeleteIgnorePath deletes a path from the ignored paths
func (*Database) DeleteMovie ¶
DeleteMovie removes a movie from the database.
func (*Database) GetAllIgnoredPaths ¶
func (d *Database) GetAllIgnoredPaths() ([]*IgnoredPath, error)
GetAllIgnoredPaths returns all ignored paths.
func (*Database) GetAllMoviePaths ¶
GetAllMoviePaths returns a list of all the movie paths in the database. Used when adding new movies.
func (*Database) GetAllMovieTitles ¶
GetAllMovieTitles returns a list of all the movie title in the database. Used when adding new movies.
func (*Database) InsertIgnorePath ¶
func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error
InsertIgnorePath inserts a path to be ignored.
func (*Database) InsertMovie ¶
InsertMovie adds a new movie to the database.
func (*Database) InsertMovieGenre ¶
InsertMovieGenre inserts a movie Genre into the database.
func (*Database) RemoveMovieGenre ¶
RemoveMovieGenre removes a movie genre from the database.
func (*Database) SearchMovies ¶
func (d *Database) SearchMovies(currentView string, searchFor string, genreId int, orderBy string) ([]*Movie, error)
SearchMovies returns all movies in the database that matches the search criteria.
func (*Database) UpdateImage ¶
UpdateImage replaces an image in the database.
type Genre ¶
type Genre struct { Id int `gorm:"column:id;primary_key"` Name string `gorm:"column:name;size:255"` IsPrivate bool `gorm:"column:is_private;"` Movies []Movie `gorm:"-"` }
Genre represents a movie genre.
type GenreCache ¶
type GenreCache struct {
// contains filtered or unexported fields
}
func NewGenreCache ¶
func NewGenreCache() *GenreCache
func (*GenreCache) GetByName ¶
func (t *GenreCache) GetByName(name string) *Genre
type IgnoredPath ¶
type IgnoredPath struct { Id int `gorm:"column:id;primary_key"` Path string `gorm:"column:path;size:1024"` IgnoreCompletely bool `gorm:"column:ignore_completely;"` }
IgnoredPath represents the table IgnoredPath.
func (*IgnoredPath) TableName ¶
func (i *IgnoredPath) TableName() string
TableName returns the table name.
type ImageCache ¶
type ImageCache struct {
// contains filtered or unexported fields
}
ImageCache represents an image cache that loads the images from the local filesystem.
type Movie ¶
type Movie struct { Id int `gorm:"column:id;primary_key"` Title string `gorm:"column:title;size:100"` SubTitle string `gorm:"column:sub_title;size:100"` Year int `gorm:"column:year;"` ImdbRating float32 `gorm:"column:imdb_rating;"` MyRating int `gorm:"column:my_rating;"` ImdbUrl string `gorm:"column:imdb_url;size:1024"` ImdbID string `gorm:"column:imdb_id;size:9"` StoryLine string `gorm:"column:story_line;size:65535"` MoviePath string `gorm:"column:path;size:1024"` Runtime int `gorm:"column:length"` Genres []Genre `gorm:"-"` HasImage bool `gorm:"-"` Image []byte `gorm:"-"` ImageId int `gorm:"column:image_id;"` ImagePath string `gorm:"column:image_path;size:1024"` // Not used yet ToWatch bool `gorm:"column:to_watch"` Pack string `gorm:"column:pack"` NeedsSubtitle bool `gorm:"column:needsSubtitle"` }
Movie represents a movie in the database.
type MovieGenre ¶
type MovieGenre struct { MovieId int `gorm:"column:movie_id;primary_key;"` GenreId int `gorm:"column:genre_id;primary_key;"` }
MovieGenre represents a Genre and a movie.
func (*MovieGenre) TableName ¶
func (m *MovieGenre) TableName() string
TableName returns the movie_Genre table name.