dbstore

package
v0.0.0-...-d25a9c8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-3.0, GPL-3.0-only Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUser

func CheckUser(ctx context.Context, username, password string) error

func Close

func Close() error

func ConvertSQL

func ConvertSQL(sql string) map[string]string

ConvertSQL takes a commented SQL string and returns a map of DBMS systems to their respective sql

func CreateIndexer

func CreateIndexer(name string, userID int, baseUrl, apiKey string, forMovies, forSeries bool, downloadType string) (id int, err error)

func CreateMigrationsFor

func CreateMigrationsFor(dbmsKey, inputDir string) (string, error)

CreateMigrationsFor takes a path to a migrations folder. Outputs a path to a temporary directory containing the same migrations but with the requested dbms's conversion applied

func CreateProfile

func CreateProfile(name string) error

func DeleteDownloader

func DeleteDownloader(id int) error

func DeleteIndexer

func DeleteIndexer(id int) error

func DeleteMedia

func DeleteMedia(id int) error

func DeleteMediaServer

func DeleteMediaServer(id int) error

func DeletePath

func DeletePath(id int) error

func DeleteProfile

func DeleteProfile(id int) error

func DeleteReleaseHistory

func DeleteReleaseHistory(releaseID string) error

func GetMonitoringMedia

func GetMonitoringMedia() (*[]Media, error)

func GetPoster

func GetPoster(mediaID int) (poster []byte, err error)

func Init

func Init() error

func NewDownload

func NewDownload(mediaID int, downloaderID int, identifier, status, friendlyName, releaseID string) (id int, err error)

func NewDownloader

func NewDownloader(downloaderType, name, fileAction string, config map[string]interface{}) (id int, err error)

func NewMediaServer

func NewMediaServer(mediaServerType, name string, config map[string]interface{}) (id int, err error)

func NewPath

func NewPath(path string, moviesDefault, seriesDefault bool) error

func NewTx

func NewTx(ctx context.Context, opts sql.TxOptions) (*sql.Tx, error)

func RestoreDownloaders

func RestoreDownloaders(tx *sql.Tx, downloaders []*Downloader) error

func RestoreDownloads

func RestoreDownloads(tx *sql.Tx, downloads []*Download) error

func RestoreIndexers

func RestoreIndexers(tx *sql.Tx, indexers []*Indexer) error

func RestoreMediaServers

func RestoreMediaServers(tx *sql.Tx, mediaServers []*MediaServer) error

func RestoreMedias

func RestoreMedias(tx *sql.Tx, medias []*Media) error

func RestorePaths

func RestorePaths(tx *sql.Tx, paths []*Path) error

func RestoreProfiles

func RestoreProfiles(tx *sql.Tx, profiles []*Profile) error

func SelectAllCols

func SelectAllCols(sb *sqlbuilder.SelectBuilder) *sqlbuilder.SelectBuilder

func SetIndexerLastRSSID

func SetIndexerLastRSSID(id int, rssID string) error

func SetMediaPath

func SetMediaPath(id int, path string) error

func SetUser

func SetUser(ctx context.Context, username, password string) error

func UpdateDownloadStatusByIdentifier

func UpdateDownloadStatusByIdentifier(identifier, status string) error

func UpdateDownloader

func UpdateDownloader(id int, name, fileAction string, config map[string]interface{}) error

func UpdateIndexer

func UpdateIndexer(id int, name string, userID int, baseUrl, apiKey string, forMovies, forSeries bool) error

func UpdateMedia

func UpdateMedia(id int, profileID, pathID int) (err error)

func UpdateMediaMonitoring

func UpdateMediaMonitoring(id int, monitoring bool) error

func UpdateMediaServer

func UpdateMediaServer(id int, name string, config map[string]interface{}) error

func UpdatePath

func UpdatePath(id int, path string, moviesDefault, seriesDefault bool) error

func UpdateProfile

func UpdateProfile(id int, name, filter, sorter string) error

func UpdateReleaseHistory

func UpdateReleaseHistory(mediaID int, releaseID string) error

func UpsertMedia

func UpsertMedia(title *string, description *string, releasedAt *time.Time, endedAt *time.Time,
	contentType *string, parentMediaID *int, tmdbID *int, imdbID *string, tvdbID *int,
	tmdbRating *int, imdbRating *int, runtime *int, poster *[]byte, genres []string, profileID,
	pathID *int, number *int, monitoring bool) (id int, err error)
UpsertMedia inserts the new media described by the parameters, and on a conflict of the item_number

and parent_media_id, it will only update the metadata

Types

type DateInterval

type DateInterval struct {
	DateFrom time.Time
	DateTo   time.Time
}

type Download

type Download struct {
	ID           int
	MediaID      sql.NullInt32
	DownloaderID sql.NullInt32
	Status       string
	FriendlyName string
	Identifier   string
	ReleaseID    sql.NullString
}

func DumpDownloads

func DumpDownloads(tx *sql.Tx) ([]*Download, error)

func GetActiveDownloads

func GetActiveDownloads() ([]Download, error)

func GetDownloadByIdentifier

func GetDownloadByIdentifier(identifier string) (Download, error)

func GetDownloads

func GetDownloads() ([]Download, error)

func GetFinishedDownloads

func GetFinishedDownloads() ([]Download, error)

type Downloader

type Downloader struct {
	ID             int
	Name           string
	DownloaderType string
	FileAction     string
	Config         map[string]interface{}
}

func DumpDownloaders

func DumpDownloaders(tx *sql.Tx) ([]*Downloader, error)

func GetDownloader

func GetDownloader(id int) (downloader Downloader, err error)

func GetDownloaders

func GetDownloaders() (downloaders []Downloader, err error)

type Indexer

type Indexer struct {
	ID           int
	Name         string
	UserID       int
	BaseUrl      string
	ApiKey       string
	ForMovies    bool
	ForSeries    bool
	DownloadType string
	LastRSSID    string
}

func DumpIndexers

func DumpIndexers(tx *sql.Tx) ([]*Indexer, error)

func GetIndexerByID

func GetIndexerByID(id int) (Indexer, error)

func GetIndexers

func GetIndexers() (indexers []Indexer, err error)

type Media

type Media struct {
	ID            int
	Title         sql.NullString
	Description   sql.NullString
	ReleasedAt    sql.NullTime
	EndedAt       sql.NullTime
	ContentType   sql.NullString
	Poster        *[]byte
	ParentMediaID sql.NullInt32
	TmdbID        sql.NullInt32
	ImdbID        sql.NullString
	TvdbID        sql.NullInt32
	TmdbRating    sql.NullInt32
	ImdbRating    sql.NullInt32
	Runtime       sql.NullInt32
	Status        string
	Path          sql.NullString
	Size          sql.NullInt64
	ProfileID     sql.NullInt32
	PathID        sql.NullInt32
	ItemNumber    sql.NullInt32
	Monitoring    bool
	Added         time.Time
}

func DumpMedias

func DumpMedias(tx *sql.Tx) ([]*Media, error)

func GetAllMedia

func GetAllMedia() ([]*Media, error)

func GetMediaByID

func GetMediaByID(id int) (Media, error)

func GetMediaByImdbID

func GetMediaByImdbID(imdbID string) (Media, error)

func GetMediaInIntervals

func GetMediaInIntervals(ctx context.Context, dateIntervals []DateInterval) ([]Media, error)

GetMediaInIntervals select an array of media within a date range. Includes all series and season medias

func GetMediaReferencing

func GetMediaReferencing(parentID int) ([]*Media, error)

func GetRecentlyAddedMedia

func GetRecentlyAddedMedia(max int) ([]Media, error)

func SearchMedia

func SearchMedia(title string, contentType string, page int) ([]Media, int, error)

type MediaServer

type MediaServer struct {
	ID              int
	Name            string
	MediaServerType string
	Config          map[string]interface{}
}

func DumpMediaServers

func DumpMediaServers(tx *sql.Tx) (mediaServers []*MediaServer, err error)

func GetMediaServer

func GetMediaServer(id int) (mediaServer MediaServer, err error)

func GetMediaServers

func GetMediaServers() (mediaServers []MediaServer, err error)

type Path

type Path struct {
	ID            int
	Path          string
	MoviesDefault bool
	SeriesDefault bool
}

func DumpPaths

func DumpPaths(tx *sql.Tx) ([]*Path, error)

func GetPath

func GetPath(id int) (Path, error)

func GetPaths

func GetPaths() ([]Path, error)

type Profile

type Profile struct {
	ID     int
	Name   sql.NullString
	Filter sql.NullString
	Sorter sql.NullString
}

func DumpProfiles

func DumpProfiles(tx *sql.Tx) ([]*Profile, error)

func GetProfileByID

func GetProfileByID(id int) (Profile, error)

func GetProfileByName

func GetProfileByName(name string) (Profile, error)

func GetProfiles

func GetProfiles() ([]*Profile, error)

type ReleaseHistory

type ReleaseHistory struct {
	ID          string
	MediaID     int
	LastAttempt time.Time
}

func GetReleaseHistoryForMedia

func GetReleaseHistoryForMedia(mediaID int) ([]ReleaseHistory, error)

type Scannable

type Scannable interface {
	Scan(dest ...interface{}) error
}

Jump to

Keyboard shortcuts

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