Documentation ¶
Index ¶
- type Database
- func (d *Database) CloseDatabase()
- func (d *Database) DeleteIgnorePath(ignorePath *IgnoredPath) error
- func (d *Database) DeleteMovie(movie *Movie) error
- func (d *Database) GetAllIgnoredPaths() ([]*IgnoredPath, error)
- func (d *Database) GetAllMoviePaths() (*[]string, error)
- func (d *Database) GetAllMovies(currentView string, searchFor string, categoryId int, orderBy string) ([]*Movie, error)
- func (d *Database) GetImage(id int) (*Image, error)
- func (d *Database) GetMovie(id int) (*Movie, error)
- func (d *Database) GetOrInsertTag(tag *Tag) (*Tag, error)
- func (d *Database) GetSettings() (*Setting, error)
- func (d *Database) GetTagByName(name string) (*Tag, error)
- func (d *Database) GetTags() ([]Tag, error)
- func (d *Database) GetTagsForMovie(movie *Movie) ([]Tag, error)
- func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error
- func (d *Database) InsertImage(image *Image) error
- func (d *Database) InsertMovie(movie *Movie) error
- func (d *Database) InsertMovieTag(movie *Movie, tag *Tag) error
- func (d *Database) RemoveMovieTag(movie *Movie, tag *Tag) error
- func (d *Database) UpdateImage(movie *Movie, imageData []byte) error
- func (d *Database) UpdateMovie(movie *Movie, updateTags bool) error
- type IgnoredPath
- type Image
- type ImageCache
- type Movie
- type MovieTag
- type Setting
- type Tag
- type TagCache
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) GetAllMovies ¶
func (d *Database) GetAllMovies(currentView string, searchFor string, categoryId int, orderBy string) ([]*Movie, error)
GetAllMovies returns all movies in the database that matches the search criteria.
func (*Database) GetOrInsertTag ¶
GetOrInsertTag either returns an existing tag or inserts a new tag and returns it.
func (*Database) GetSettings ¶
GetSettings returns the settings.
func (*Database) GetTagByName ¶
GetTagByName returns a tag by name.
func (*Database) GetTagsForMovie ¶
GetTagsForMovie returns a list of tags connected to the given movie.
func (*Database) InsertIgnorePath ¶
func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error
InsertIgnorePath inserts a path to be ignored.
func (*Database) InsertImage ¶
InsertImage inserts an image into the database.
func (*Database) InsertMovie ¶
InsertMovie adds a new movie to the database.
func (*Database) InsertMovieTag ¶
InsertMovieTag inserts a movie tag into the database.
func (*Database) RemoveMovieTag ¶
RemoveMovieTag removes a movie tag from the database.
func (*Database) UpdateImage ¶
UpdateImage removes an image from the database.
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.
func (*ImageCache) Load ¶
func (i *ImageCache) Load(index int) []byte
Load loads the image from the cache.
func (*ImageCache) Save ¶
func (i *ImageCache) Save(index int, image []byte)
Save saves the image to the cache.
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"` Tags []Tag `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"` }
Movie represents a movie in the database.
type MovieTag ¶
type MovieTag struct { MovieId int `gorm:"column:movie_id;primary_key;"` TagId int `gorm:"column:tag_id;primary_key;"` }
MovieTag represents a tag and a movie.
type Setting ¶
type Setting struct { Id int `gorm:"column:id;primary_key"` BasePath string `gorm:"column:base_path;size:1024"` IsSamba bool `gorm:"column:is_samba;"` }
Setting represents SoftIMDB settings table.
type Tag ¶
type Tag struct { Id int `gorm:"column:id;primary_key"` Name string `gorm:"column:name;size:255"` IsPrivate bool `gorm:"column:is_private;"` Movies []Movie `gorm:"-"` }
Tag represents a movie tag.
type TagCache ¶
type TagCache struct {
// contains filtered or unexported fields
}
func NewTagCache ¶
func NewTagCache() *TagCache