Documentation ¶
Index ¶
- type FileStorer
- type FileWatcher
- type FilmCacher
- type FilmManager
- type FilmManagerWrapper
- func (fmw FilmManagerWrapper) AddFilm(film *model.Film, update bool) error
- func (fmw FilmManagerWrapper) CacheFilms()
- func (fmw FilmManagerWrapper) EditFilmWithLink(filmID, inputUrl string) error
- func (fmw FilmManagerWrapper) GetFilm(filmHexID string) (*model.Film, error)
- func (fmw FilmManagerWrapper) GetFilmPath(filmHexID, filmIndex string) (string, error)
- func (fmw FilmManagerWrapper) GetFilmSubtitlePath(filmHexID, filmIndex, subtitleIndex string) (string, error)
- func (fmw FilmManagerWrapper) GetFilms() []model.Film
- func (fmw FilmManagerWrapper) GetFilmsFiltered(years []int, genre, country, search string) []model.Film
- func (fmw FilmManagerWrapper) GetFilmsWithActor(actorID int64) (films []model.Film)
- func (fmw FilmManagerWrapper) GetFilmsWithDirector(directorID int64) (films []model.Film)
- func (fmw FilmManagerWrapper) GetFilmsWithWriter(writerID int64) (films []model.Film)
- type FilmMetadataGetter
- type FilmStorer
- type Filterer
- type FiltererWrapper
- func (f *FiltererWrapper) AddFilm(film *model.Film)
- func (f *FiltererWrapper) AddFilms(films []model.Film)
- func (f *FiltererWrapper) GetCountries() []string
- func (f *FiltererWrapper) GetCountryName(code string) string
- func (f *FiltererWrapper) GetDecades() []model.Decade
- func (f *FiltererWrapper) GetGenres() []string
- func (f *FiltererWrapper) ParseParamsFilters(params string) (yearFilter string, years []int, genre, country string, page int, err error)
- type PersonManager
- type PersonManagerWrapper
- type PersonStorer
- type TMDB
- type UserManager
- type UserManagerWrapper
- func (umw UserManagerWrapper) CheckLogin(username, password string) (user *model.User, err error)
- func (umw UserManagerWrapper) CreateOwner(username, password1, password2 string) (*model.User, error)
- func (umw UserManagerWrapper) CreateUser(username, password1, password2 string, isAdmin, isOwner bool) (*model.User, error)
- func (umw UserManagerWrapper) DeleteUser(userHexID string) error
- func (umw UserManagerWrapper) GetUser(userHexID string) (*model.User, error)
- func (umw UserManagerWrapper) GetUserNb() (int64, error)
- func (umw UserManagerWrapper) GetUsers() ([]model.User, error)
- func (umw UserManagerWrapper) SetUserPassword(username, oldPassword, password1, password2 string) error
- type UserStorer
- type VolumeManager
- type VolumeManagerWrapper
- func (vmw VolumeManagerWrapper) CreateVolume(name, path string, isRecursive bool, mediaType string) error
- func (vmw VolumeManagerWrapper) DeleteVolume(volumeHexID string) error
- func (vmw VolumeManagerWrapper) GetVolume(volumeHexID string) (*model.Volume, error)
- func (vmw VolumeManagerWrapper) GetVolumes() ([]model.Volume, error)
- type VolumeMetadataGetter
- type VolumeStorer
- type WatcherMetadataGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStorer ¶
type FileStorer interface { GetVolumes() ([]model.Volume, error) AddSubtitleToFilmPath(filmFilePath string, sub model.Subtitle) error RemoveSubtitleFile(mediaPath, subtitlePath string) error GetFilmFromPath(filmPath string) (film *model.Film, err error) UpdateFilmVolumeFile(film *model.Film, oldPath string, newVolumeFile model.VolumeFile) error DeleteFilmVolumeFile(path string) error IsFilmPathPresent(filmPath string) bool IsSubtitlePathPresent(subPath string) bool GetFilmsFromVolume(id primitive.ObjectID) (films []model.Film) }
type FileWatcher ¶
type FileWatcher struct { FileStorer FilmManager WatcherMetadataGetter // contains filtered or unexported fields }
func NewFileWatcher ¶
func NewFileWatcher(fs FileStorer, fm FilmManager, wmg WatcherMetadataGetter) *FileWatcher
func (*FileWatcher) AddVolume ¶
func (fw *FileWatcher) AddVolume(v *model.Volume)
func (*FileWatcher) Run ¶
func (fw *FileWatcher) Run()
func (*FileWatcher) Stop ¶
func (fw *FileWatcher) Stop()
type FilmCacher ¶
type FilmManager ¶
type FilmManager interface { CacheFilms() GetFilms() []model.Film GetFilmsFiltered(years []int, genre, country, search string) (films []model.Film) GetFilmsWithActor(actorID int64) (films []model.Film) GetFilmsWithDirector(directorID int64) (films []model.Film) GetFilmsWithWriter(writerID int64) (films []model.Film) GetFilm(filmHexID string) (*model.Film, error) GetFilmPath(filmHexID, filmIndex string) (string, error) GetFilmSubtitlePath(filmHexID, filmIndex, subtitleIndex string) (string, error) EditFilmWithLink(filmID, inputUrl string) error AddFilm(film *model.Film, update bool) error }
type FilmManagerWrapper ¶
type FilmManagerWrapper struct { FilmStorer FilmCacher FilmMetadataGetter Filterer TMDB // contains filtered or unexported fields }
func NewFilmManagerWrapper ¶
func NewFilmManagerWrapper(fs FilmStorer, fc FilmCacher, fdg FilmMetadataGetter, f Filterer) *FilmManagerWrapper
func (FilmManagerWrapper) AddFilm ¶
func (fmw FilmManagerWrapper) AddFilm(film *model.Film, update bool) error
func (FilmManagerWrapper) CacheFilms ¶
func (fmw FilmManagerWrapper) CacheFilms()
func (FilmManagerWrapper) EditFilmWithLink ¶
func (fmw FilmManagerWrapper) EditFilmWithLink(filmID, inputUrl string) error
func (FilmManagerWrapper) GetFilm ¶
func (fmw FilmManagerWrapper) GetFilm(filmHexID string) (*model.Film, error)
GetFilm returns a Film from its hexadecimal ID
func (FilmManagerWrapper) GetFilmPath ¶
func (fmw FilmManagerWrapper) GetFilmPath(filmHexID, filmIndex string) (string, error)
GetFilmPath returns the filepath to a film given its hexadecimal ID and its index in the volume file slice
func (FilmManagerWrapper) GetFilmSubtitlePath ¶
func (fmw FilmManagerWrapper) GetFilmSubtitlePath(filmHexID, filmIndex, subtitleIndex string) (string, error)
GetFilmSubtitlePath returns the filepath to a subtitle for a film given the film's hexadecimal ID, the film's index in the volume file slice, and the subtitle's index in the external subtitle slice
func (FilmManagerWrapper) GetFilms ¶
func (fmw FilmManagerWrapper) GetFilms() []model.Film
GetFilms returns the full slice of films in the database
func (FilmManagerWrapper) GetFilmsFiltered ¶
func (fmw FilmManagerWrapper) GetFilmsFiltered(years []int, genre, country, search string) []model.Film
GetFilmsFiltered returns a slice of films, filtered with years of release date, genre, country, and search terms
func (FilmManagerWrapper) GetFilmsWithActor ¶
func (fmw FilmManagerWrapper) GetFilmsWithActor(actorID int64) (films []model.Film)
func (FilmManagerWrapper) GetFilmsWithDirector ¶
func (fmw FilmManagerWrapper) GetFilmsWithDirector(directorID int64) (films []model.Film)
func (FilmManagerWrapper) GetFilmsWithWriter ¶
func (fmw FilmManagerWrapper) GetFilmsWithWriter(writerID int64) (films []model.Film)
type FilmMetadataGetter ¶
type FilmStorer ¶
type FilmStorer interface { GetFilms() ([]model.Film, error) GetFilmsFiltered(years []int, genre, country string) (films []model.Film) GetFilmsWithActor(actorID int64) (films []model.Film) GetFilmsWithDirector(directorID int64) (films []model.Film) GetFilmsWithWriter(writerID int64) (films []model.Film) GetFilmFromID(primitive.ObjectID) (*model.Film, error) GetPersonFromTMDBID(int64) (*model.Person, error) IsFilmPresent(film *model.Film) bool AddFilm(film *model.Film) error AddVolumeSourceToFilm(film *model.Film) error IsPersonPresent(personID int64) bool AddPerson(person *model.Person) }
type Filterer ¶
type Filterer interface { AddFilms(films []model.Film) AddFilm(films *model.Film) ParseParamsFilters(params string) (yearFilter string, years []int, genre, country string, page int, err error) GetCountryName(code string) string GetCountries() []string GetDecades() []model.Decade GetGenres() []string }
Filterer holds the different filters that can be applied
type FiltererWrapper ¶
type FiltererWrapper struct { Decades []model.Decade Genres []string Countries []string // contains filtered or unexported fields }
func NewFiltererWrapper ¶
func NewFiltererWrapper() *FiltererWrapper
func (*FiltererWrapper) AddFilm ¶
func (f *FiltererWrapper) AddFilm(film *model.Film)
AddFilm adds release year if new min or max, and missing genres to the filter
func (*FiltererWrapper) AddFilms ¶
func (f *FiltererWrapper) AddFilms(films []model.Film)
AddFilm adds release year if new min or max, and missing genres to the filter
func (*FiltererWrapper) GetCountries ¶
func (f *FiltererWrapper) GetCountries() []string
func (*FiltererWrapper) GetCountryName ¶
func (f *FiltererWrapper) GetCountryName(code string) string
func (*FiltererWrapper) GetDecades ¶
func (f *FiltererWrapper) GetDecades() []model.Decade
func (*FiltererWrapper) GetGenres ¶
func (f *FiltererWrapper) GetGenres() []string
func (*FiltererWrapper) ParseParamsFilters ¶
func (f *FiltererWrapper) ParseParamsFilters(params string) (yearFilter string, years []int, genre, country string, page int, err error)
ParseParamsFilters parses a params string and returns the filtered years, genre, country and page number
type PersonManager ¶
type PersonManagerWrapper ¶
type PersonManagerWrapper struct {
PersonStorer
}
func NewPersonManagerWrapper ¶
func NewPersonManagerWrapper(ps PersonStorer) *PersonManagerWrapper
func (PersonManagerWrapper) GetFilmStaff ¶
func (pmw PersonManagerWrapper) GetFilmStaff(film *model.Film) (cast []model.Cast, directors []model.Person, writers []model.Person, err error)
GetFilmStaff returns slices of cast, directors, and writers who worked on the film
func (PersonManagerWrapper) GetPeople ¶
func (fmw PersonManagerWrapper) GetPeople() []model.Person
type PersonStorer ¶
type UserManager ¶
type UserManager interface { CreateOwner(username, password1, password2 string) (*model.User, error) GetUserNb() (int64, error) CreateUser(username, password1, password2 string, isAdmin, isOwner bool) (*model.User, error) DeleteUser(userHexID string) error CheckLogin(username, password string) (user *model.User, err error) SetUserPassword(username, oldPassword, password1, password2 string) error GetUser(userHexID string) (*model.User, error) GetUsers() ([]model.User, error) }
type UserManagerWrapper ¶
type UserManagerWrapper struct {
UserStorer
}
func NewUserManagerWrapper ¶
func NewUserManagerWrapper(us UserStorer) *UserManagerWrapper
NewUserManager creates a new UserManager
func (UserManagerWrapper) CheckLogin ¶
func (umw UserManagerWrapper) CheckLogin(username, password string) (user *model.User, err error)
CheckLogin checks that the login is correct and returns the user it corresponds to
func (UserManagerWrapper) CreateOwner ¶
func (umw UserManagerWrapper) CreateOwner(username, password1, password2 string) (*model.User, error)
func (UserManagerWrapper) CreateUser ¶
func (umw UserManagerWrapper) CreateUser(username, password1, password2 string, isAdmin, isOwner bool) (*model.User, error)
CreateUser checks that the user and password follow specific rules and adds it to the database
func (UserManagerWrapper) DeleteUser ¶
func (umw UserManagerWrapper) DeleteUser(userHexID string) error
func (UserManagerWrapper) GetUser ¶
func (umw UserManagerWrapper) GetUser(userHexID string) (*model.User, error)
func (UserManagerWrapper) GetUserNb ¶
func (umw UserManagerWrapper) GetUserNb() (int64, error)
func (UserManagerWrapper) SetUserPassword ¶
func (umw UserManagerWrapper) SetUserPassword(username, oldPassword, password1, password2 string) error
SetUserPassword checks that the password change follows specific rules and updates it in the database
type UserStorer ¶
type UserStorer interface { IsOwnerPresent() (bool, error) IsUsernameAvailable(username string) (bool, error) GetUserFromName(username string, user *model.User) error GetUserFromID(id primitive.ObjectID) (*model.User, error) GetUserNb() (int64, error) GetUsers() ([]model.User, error) CreateUser(user *model.User) error DeleteUser(userId primitive.ObjectID) error SetUserPassword(userID primitive.ObjectID, newPassword string) error }
type VolumeManager ¶
type VolumeManagerWrapper ¶
type VolumeManagerWrapper struct { VolumeStorer VolumeMetadataGetter FilmManager *FileWatcher }
func NewVolumeManagerWrapper ¶
func NewVolumeManagerWrapper(vs VolumeStorer, fw *FileWatcher, fm FilmManager, m VolumeMetadataGetter) *VolumeManagerWrapper
func (VolumeManagerWrapper) CreateVolume ¶
func (vmw VolumeManagerWrapper) CreateVolume(name, path string, isRecursive bool, mediaType string) error
func (VolumeManagerWrapper) DeleteVolume ¶
func (vmw VolumeManagerWrapper) DeleteVolume(volumeHexID string) error
func (VolumeManagerWrapper) GetVolume ¶
func (vmw VolumeManagerWrapper) GetVolume(volumeHexID string) (*model.Volume, error)
func (VolumeManagerWrapper) GetVolumes ¶
func (vmw VolumeManagerWrapper) GetVolumes() ([]model.Volume, error)