data

package
v0.0.0-...-c6f433c Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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

func DatabaseNew(useTestDB bool, config *config.Config) *Database

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

func (d *Database) DeleteMovie(rootDir string, movie *Movie) error

DeleteMovie removes a movie from the database.

func (*Database) GetAllIgnoredPaths

func (d *Database) GetAllIgnoredPaths() ([]*IgnoredPath, error)

GetAllIgnoredPaths returns all ignored paths.

func (*Database) GetAllMoviePaths

func (d *Database) GetAllMoviePaths() ([]string, error)

GetAllMoviePaths returns a list of all the movie paths in the database. Used when adding new movies.

func (*Database) GetAllMovieTitles

func (d *Database) GetAllMovieTitles() ([]string, error)

GetAllMovieTitles returns a list of all the movie titles in the database. Used when adding new movies.

func (*Database) GetGenres

func (d *Database) GetGenres() ([]Genre, error)

GetGenres returns all genres

func (*Database) GetPerson

func (d *Database) GetPerson(name string) (*Person, error)

GetPerson returns a person by name.

func (*Database) GetPersonsForMovie

func (d *Database) GetPersonsForMovie(movie *Movie) ([]Person, error)

GetPersonsForMovie returns a list of persons (director, writer or actor) connected to the given movie.

func (*Database) GetPersonsForMovies

func (d *Database) GetPersonsForMovies(movies []*Movie) ([]*Movie, error)

func (*Database) InsertIgnorePath

func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error

InsertIgnorePath inserts a path to be ignored.

func (*Database) InsertMovie

func (d *Database) InsertMovie(movie *Movie) error

InsertMovie adds a new movie to the database.

func (*Database) InsertMovieGenre

func (d *Database) InsertMovieGenre(movie *Movie, Genre *Genre) error

InsertMovieGenre inserts a movie Genre into the database.

func (*Database) InsertMoviePerson

func (d *Database) InsertMoviePerson(movie *Movie, person *Person) error

InsertMoviePerson inserts a person (director, writer or actor) into the database.

func (*Database) InsertPerson

func (d *Database) InsertPerson(person *Person) (*Person, error)

InsertPerson inserts a new person and returns it.

func (*Database) RemoveMovieGenre

func (d *Database) RemoveMovieGenre(movie *Movie, genre *Genre) error

RemoveMovieGenre removes a movie genre from the database. RemoveMovieGenre removes a genre association from a movie.

func (*Database) RemovePerson

func (d *Database) RemovePerson(person *Person) error

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

func (d *Database) SetProcessed(movie *Movie) error

SetProcessed sets the movie as processed

func (*Database) UpdateImage

func (d *Database) UpdateImage(movie *Movie, imageData []byte) error

UpdateImage replaces an image in the database.

func (*Database) UpdateMovie

func (d *Database) UpdateMovie(movie *Movie) error

UpdateMovie update a movie.

func (*Database) UpdateMoviePersons

func (d *Database) UpdateMoviePersons(movie *Movie) error

UpdateMoviePersons update a movie with its directors, writers and actors.

func (*Database) UpdateWatchedAt

func (d *Database) UpdateWatchedAt(movie *Movie) error

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.

func (*Genre) TableName

func (t *Genre) TableName() string

TableName returns the genre table name.

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.

func (*Movie) TableName

func (m *Movie) TableName() string

TableName returns the name of the table.

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.

type Person

type Person struct {
	Id     int        `gorm:"column:id;primary_key"`
	Name   string     `gorm:"column:name;size:50"`
	Type   PersonType `gorm:"-"`
	Movies []Movie    `gorm:"-"`
}

Person represents a person (director, writer or actor).

func (*Person) TableName

func (m *Person) TableName() string

TableName returns the person's table name.

type PersonType

type PersonType int
const (
	Director PersonType = iota
	Writer
	Actor
)

Jump to

Keyboard shortcuts

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