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) GetPerson(name string) (*Person, error)
- func (d *Database) GetPersonsForMovie(movie *Movie) ([]Person, error)
- func (d *Database) GetPersonsForMovies(movies []*Movie) ([]*Movie, 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) InsertMoviePerson(movie *Movie, person *Person) error
- func (d *Database) InsertPerson(person *Person) (*Person, error)
- func (d *Database) RemoveMovieGenre(movie *Movie, genre *Genre) error
- func (d *Database) RemovePerson(person *Person) error
- func (d *Database) SearchMovies(currentView string, searchFor string, genreId int, orderBy string) ([]*Movie, error)
- func (d *Database) SetProcessed(movie *Movie) error
- func (d *Database) UpdateImage(movie *Movie, imageData []byte) error
- func (d *Database) UpdateMovie(movie *Movie) error
- func (d *Database) UpdateMoviePersons(movie *Movie) error
- func (d *Database) UpdateWatchedAt(movie *Movie) error
- type Genre
- type GenreCache
- type IgnoredPath
- type ImageCache
- type Movie
- type MovieGenre
- type MoviePerson
- type Person
- type PersonType
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 underlying SQL database connection.
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 titles in the database. Used when adding new movies.
func (*Database) GetPersonsForMovie ¶
GetPersonsForMovie returns a list of persons (director, writer or actor) connected to the given movie.
func (*Database) GetPersonsForMovies ¶
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) InsertMoviePerson ¶
InsertMoviePerson inserts a person (director, writer or actor) into the database.
func (*Database) InsertPerson ¶
InsertPerson inserts a new person and returns it.
func (*Database) RemoveMovieGenre ¶
RemoveMovieGenre removes a movie genre from the database. RemoveMovieGenre removes a genre association from a movie.
func (*Database) RemovePerson ¶
RemovePerson removes a person from the database, including associations.
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) SetProcessed ¶
SetProcessed sets the movie as processed
func (*Database) UpdateImage ¶
UpdateImage replaces an image in the database.
func (*Database) UpdateMovie ¶
UpdateMovie update a movie.
func (*Database) UpdateMoviePersons ¶
UpdateMoviePersons update a movie with its directors, writers and actors.
func (*Database) UpdateWatchedAt ¶
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
}
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"`
StoryLine string `gorm:"column:story_line;size:65535"`
Year int `gorm:"column:year;"`
MyRating int `gorm:"column:my_rating;"`
MoviePath string `gorm:"column:path;size:1024"`
Runtime int `gorm:"column:length"`
Size int `gorm:"column:size"`
Genres []Genre `gorm:"-"`
Persons []Person `gorm:"-"`
ImdbRating float32 `gorm:"column:imdb_rating;"`
ImdbUrl string `gorm:"column:imdb_url;size:1024"`
ImdbID string `gorm:"column:imdb_id;size:9"`
HasImage bool `gorm:"-"`
Image []byte `gorm:"-"`
ImageId int `gorm:"column:image_id;"`
ToWatch bool `gorm:"column:to_watch"`
Pack string `gorm:"column:pack"`
NeedsSubtitle bool `gorm:"column:needsSubtitle"`
WatchedAt sql.NullTime `gorm:"column:watched_at;type=date"`
}
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.
type MoviePerson ¶
type MoviePerson struct {
MovieId int `gorm:"column:movie_id;primary_key;"`
PersonId int `gorm:"column:person_id;primary_key;"`
Type int `gorm:"column:type;"`
}
MoviePerson represents a person (director, writer or actor) and a movie.
func (*MoviePerson) TableName ¶
func (m *MoviePerson) TableName() string
TableName returns the person's table name.