database

package
v0.0.0-...-4973d3c Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

movies

Index

Constants

View Source
const (
	QueryDbseriesGetIdentifiedByID                 = "select lower(identifiedby) from dbseries where id = ?"
	QueryDbserieEpisodesGetSeasonEpisodeByDBID     = "select season, episode from dbserie_episodes where dbserie_id = ?"
	QueryDbserieEpisodesCountByDBID                = "select count() from dbserie_episodes where dbserie_id = ?"
	QuerySeriesCountByDBID                         = "select count() from series where dbserie_id = ?"
	QueryUpdateHistory                             = "update job_histories set ended = datetime('now','localtime') where id = ?"
	QueryCountMoviesByDBIDList                     = "select count() from movies where dbmovie_id = ? and listname = ? COLLATE NOCASE"
	QuerySeriesGetIDByDBIDListname                 = "select id from series where dbserie_id = ? and listname = ? COLLATE NOCASE"
	QueryDbseriesGetIDByTvdb                       = "select id from dbseries where thetvdb_id = ?"
	QueryMoviesGetIDByDBIDListname                 = "select id from movies where dbmovie_id = ? and listname = ? COLLATE NOCASE"
	QueryDbseriesGetIDByName                       = "select id from dbseries where seriename = ? COLLATE NOCASE"
	QueryDbmovieTitlesGetTitleByIDLmit1            = "select title from dbmovie_titles where dbmovie_id = ? limit 1"
	QuerySerieEpisodesGetDBSerieEpisodeIDByID      = "select dbserie_episode_id from serie_episodes where id = ?"
	QuerySerieEpisodesGetDBSerieIDByID             = "select dbserie_id from serie_episodes where id = ?"
	QuerySerieEpisodesGetSerieIDByID               = "select serie_id from serie_episodes where id = ?"
	QueryDBSerieEpisodeGetIDByDBSerieIDIdentifier  = "select id from dbserie_episodes where dbserie_id = ? and identifier = ? COLLATE NOCASE"
	QueryDBSerieEpisodeGetIDByDBSerieIDIdentifier2 = "select id from dbserie_episodes where dbserie_id = ? and identifier=REPLACE(?,?,?) COLLATE NOCASE"
)

Variables

View Source
var (
	DBConnect dbGlobal

	DBVersion  = "1"
	DBLogLevel = "Info"
)
View Source
var GlobalCache *globalcache

Functions

func AppendOneStringTwoIntCache

func AppendOneStringTwoIntCache(a string, v DbstaticOneStringTwoInt)

AppendOneStringTwoIntCache appends the DbstaticOneStringTwoInt value v to the cached one string two int array identified by a. It acquires a lock on the cache, appends the value, updates the cache with the modified array, and unlocks before returning.

func AppendStringCache

func AppendStringCache(a string, v string)

AppendStringCache appends the string value v to the cached string array identified by a. It acquires a lock on the cache, appends the value to the array, updates the cache with the modified array, and unlocks before returning.

func AppendThreeStringTwoIntCache

func AppendThreeStringTwoIntCache(s string, v DbstaticThreeStringTwoInt)

AppendThreeStringTwoIntCache appends the DbstaticThreeStringTwoInt value v to the cached three string two int array identified by a. It acquires a lock on the cache, defers unlocking, gets the cached array object, appends the value, updates the cache with the modified array, and returns.

func AppendTwoStringIntCache

func AppendTwoStringIntCache(s string, v DbstaticTwoStringOneInt)

AppendTwoStringIntCache appends the DbstaticTwoStringOneInt value v to the cached two string one int array identified by a. It acquires a lock on the cache, appends the value to the array, updates the cache with the modified array, and unlocks before returning.

func Backup

func Backup(backupPath string, maxbackups int) error

Backup the database. If db is nil, then uses the existing database connection.

func CacheOneStringTwoIntIndexFunc

func CacheOneStringTwoIntIndexFunc(s string, f func(DbstaticOneStringTwoInt) bool) bool

CacheOneStringTwoIntIndexFunc looks up the cached one string two int array identified by s and calls the passed in function f on each element. Returns true if f returns true for any element.

func CacheOneStringTwoIntIndexFuncRet

func CacheOneStringTwoIntIndexFuncRet(s string, id int, listname string) uint

CacheOneStringTwoIntIndexFuncRet searches the cached one string two int array identified by s by applying the passed in function f to each element. If f returns true for any element, the Num2 field of that element is returned. If no match is found, 0 is returned.

func CacheOneStringTwoIntIndexFuncStr

func CacheOneStringTwoIntIndexFuncStr(s string, i uint) string

CacheOneStringTwoIntIndexFuncStr looks up the cached one string, two int array identified by s and returns the string value for the entry where the second int matches the passed in uint i. It stores the returned string in listname. If no match is found, it sets listname to an empty string.

func CacheThreeStringIntIndexFunc

func CacheThreeStringIntIndexFunc(s string, str *string) uint

CacheThreeStringIntIndexFunc looks up the cached three string, two int array identified by s and returns the second int value for the entry where the third string matches the string str. Returns 0 if no match found.

func CacheThreeStringIntIndexFuncGetImdb

func CacheThreeStringIntIndexFuncGetImdb(s string, str int, m *ParseInfo)

CacheThreeStringIntIndexFuncGetImdb searches the cached three string two int array identified by s and returns the imdb ID string for the entry where Num2 matches the passed in integer str. It stores the returned string in m.Imdb.

func CacheThreeStringIntIndexFuncGetYear

func CacheThreeStringIntIndexFuncGetYear(s string, str int) int

CacheThreeStringIntIndexFuncGetYear looks up the cached three string, two int array identified by s and returns the first int value for the entry where the second int matches the int str. Returns 0 if no match found.

func CacheTwoStringIntIndexFunc

func CacheTwoStringIntIndexFunc(s string, usestr1 bool, str *string, m *ParseInfo)

CacheTwoStringIntIndexFunc searches the cached two string int array identified by s to find an entry matching str. If usestr1 is true, it matches on Str1, otherwise it matches on Str2. If a match is found, it sets m.DbserieID to the Num value for the matching entry and returns.

func CheckcachedTitleHistory

func CheckcachedTitleHistory(useseries bool, file string) bool

CheckcachedMovieTitleHistory checks if the given movie title exists in the movie_histories table. It first checks the file cache if enabled, otherwise queries the database. Returns true if the title exists, false otherwise.

func CheckcachedUrlHistory

func CheckcachedUrlHistory(useseries bool, file string) bool

CheckcachedMovieUrlHistory checks if the given movie URL exists in the movie_histories table. It first checks the file cache if enabled, otherwise queries the database. Returns true if the URL exists, false otherwise.

func CheckcacheexpireDataType

func CheckcacheexpireDataType[T any](a *cacheTypeExpire[T]) bool

CheckcacheexpireData checks if the given cached data has expired based on its internal timestamp. Returns false if the cache entry has expired.

func ClearCaches

func ClearCaches()

ClearCaches iterates over the cached string, three string two int, and two string int arrays, sets the Expire field on each cached array object to two hours in the past based on the config cache duration, and updates the cache with the expired array object. This effectively clears those cached arrays by expiring all entries.

func CloseImdb

func CloseImdb()

CloseImdb closes the dbImdb database connection if it is open.

func DBClose

func DBClose()

DBClose closes any open database connections to the data.db and imdb.db SQLite databases. It is intended to be called when the application is shutting down to cleanly close the connections.

func DBIntegrityCheck

func DBIntegrityCheck() string

DBIntegrityCheck checks the database integrity using the PRAGMA integrity_check statement. It logs informational messages before and after running the statement. The string result from running the statement is returned.

func DBLock

func DBLock()

DBLock locks the database for write access by calling Lock on readWriteMu.

func DBQuickCheck

func DBQuickCheck() string

DBQuickCheck checks the database for errors using the PRAGMA quick_check statement. It logs informational messages before and after running the statement. The string result from running the statement is returned.

func DBUnlock

func DBUnlock()

DBUnlock unlocks the database by calling Unlock on readWriteMu, which releases the write lock.

func DeleteRow

func DeleteRow(table string, where string, args ...any) (sql.Result, error)

DeleteRow deletes rows from the given database table that match the provided WHERE clause and arguments. It returns the sql.Result and error from the query execution. The table parameter specifies the table name to delete from. The where parameter allows specifying a WHERE condition to filter the rows to delete. The args parameters allow providing arguments to replace any ? placeholders in the where condition.

func ExchangeImdbDB

func ExchangeImdbDB()

ExchangeImdbDB exchanges the imdb.db file with a temp copy. It first checks if the main imdb.db file exists, locks the db, makes the main file writable, deletes it, renames the temp copy to the main name, unlocks the db, and logs the result.

func ExecN

func ExecN(querystring string, args ...any) (sql.Result, error)

execN executes a SQL statement with multiple arguments and returns the sql.Result and error. It locks access to the database during the query, logs any errors, and handles error cases.

func ExecNid

func ExecNid(querystring string, args ...any) (int64, error)

ExecNid executes the given querystring with multiple arguments, returns the generated ID from the insert statement, handles errors.

func GetCachedTypeObj

func GetCachedTypeObj[T any](key string) *cacheTypeExpire[T]

func GetCachedTypeObjArr

func GetCachedTypeObjArr[T any](key string) []T

func GetDbStaticOneStringOneIntIdx

func GetDbStaticOneStringOneIntIdx(tbl []DbstaticOneStringOneInt, v string) int

GetDbStaticOneStringOneIntIdx searches tbl for an element where Str equals v, and returns the index of that element, or -1 if not found.

func GetDbStaticTwoStringIdx1

func GetDbStaticTwoStringIdx1(tbl []DbstaticTwoString, v string) int

GetDbStaticTwoStringIdx1 returns the index of the DbstaticTwoString element with Str1 equal to v, or -1 if not found.

func GetDbmovieByIDP

func GetDbmovieByIDP(id *uint, u *Dbmovie) error

GetDbmovieByIDP retrieves a Dbmovie by ID. It takes a uint ID and a pointer to a Dbmovie struct to scan the result into. It executes a SQL query using the structscan function to select the dbmovie data and scan it into the Dbmovie struct. Returns an error if there was a problem retrieving the data.

func GetDbserieByIDP

func GetDbserieByIDP(id *uint, u *Dbserie) error

GetDbserieByIDP retrieves a Dbserie by ID. It takes a uint ID and a pointer to a Dbserie struct to scan the result into. It executes a SQL query using the structscan function to select the dbserie data and scan it into the Dbserie struct. Returns an error if there was a problem retrieving the data.

func GetDbserieEpisodesByIDP

func GetDbserieEpisodesByIDP(id *uint, u *DbserieEpisode) error

GetDbserieEpisodesByIDP retrieves a DbserieEpisode by ID. It takes a uint ID and a pointer to a DbserieEpisode struct to scan the result into. It executes a SQL query using the structscan function to select the dbserie episode data and scan it into the DbserieEpisode struct. Returns an error if there was a problem retrieving the data.

func GetImdbRating

func GetImdbRating(arg *string, movie *Dbmovie, overwrite bool)

GetImdbRating queries the imdb_ratings table to get the average rating and number of votes for the given IMDb ID. It populates the rating fields on the Dbmovie struct if they are empty or overwrite is true.

func GetImdbTitle

func GetImdbTitle(arg *string, movie *Dbmovie, overwrite bool)

GetImdbTitle queries the imdb_titles table to populate movie details from IMDb. It takes the IMDb id pointer, movie struct pointer, and a boolean overwrite flag. It will populate the movie struct with data from IMDb if fields are empty or overwrite is true. This handles setting the title, year, adult flag, genres, original title, runtime, slug, url, vote average, and vote count.

func GetMediaListID

func GetMediaListID(cfgp *config.MediaTypeConfig, listname string) int

GetMediaListID returns the index of the media list with the given name in cfgp. It returns -1 if cfgp is nil, listname is empty, or no list with that name exists.

func GetMediaListIDGetListname

func GetMediaListIDGetListname(cfgp *config.MediaTypeConfig, mediaid uint) int

GetMediaListIDMovies returns the index of the media list with the given name in cfgp for the movie with the given ID. It returns -1 if cfgp is nil, listname is empty, or no list with that name exists.

func GetMediaQualityConfig

func GetMediaQualityConfig(cfgp *config.MediaTypeConfig, mediaid *uint) *config.QualityConfig

GetMediaQualityConfig returns the QualityConfig from cfgp for the media with the given ID. It first checks if there is a quality profile set for that media in the database. If not, it returns the default QualityConfig from cfgp.

func GetMediaQualityConfigStr

func GetMediaQualityConfigStr(cfgp *config.MediaTypeConfig, str string) *config.QualityConfig

GetMediaQualityConfig returns the QualityConfig from cfgp for the media with the given ID. It first checks if there is a quality profile set for that media in the database. If not, it returns the default QualityConfig from cfgp.

func GetMoviesByIDP

func GetMoviesByIDP(id *uint, u *Movie) error

GetMoviesByIDP retrieves a Movie by ID. It takes a uint ID and a pointer to a Movie struct to scan the result into. It executes a SQL query using the structscan function to select the movie data and scan it into the Movie struct. Returns an error if there was a problem retrieving the data.

func GetSerieByIDP

func GetSerieByIDP(id *uint, u *Serie) error

GetSerieByIDP retrieves a Serie by ID. It takes a uint ID and a pointer to a Serie struct to scan the result into. It executes a SQL query using the structscan function to select the serie data and scan it into the Serie struct. Returns an error if there was a problem retrieving the data.

func GetSerieEpisodesByIDP

func GetSerieEpisodesByIDP(id *uint, u *SerieEpisode) error

GetSerieEpisodesByIDP retrieves a SerieEpisode by ID. It takes a uint ID and a pointer to a SerieEpisode struct to scan the result into. It executes a SQL query using the structscan function to select the serie episode data and scan it into the SerieEpisode struct. Returns an error if there was a problem retrieving the data.

func GetVersion

func GetVersion() string

GetVersion returns the current database version string stored in the DBVersion global variable.

func GetdatarowArgs

func GetdatarowArgs(querystring string, arg any, objs ...any)

GetdatarowArgs executes the given querystring with the provided argument and scans the result into the given slice of objects, handling locking, logging errors, and returning the scanned objects.

func GetdatarowN

func GetdatarowN[O any](imdb bool, querystring string, args ...any) O

getdatarowN executes the given querystring with multiple arguments and scans the result into obj, handling locking, logging errors, and returning the scanned object.

func Getfirstsubmatchindex

func Getfirstsubmatchindex(key string, matchfor string) []int

Getfirstsubmatchindex returns the indexes of the first submatch found in matchfor using the compiled regular expression stored in cache under key.

func Getrows1size

func Getrows1size[T any, R any](imdb bool, sizeq string, querystring string, arg *R) []T

getrows1 executes the given querystring with one argument, scans the result rows into a slice of the generic type T, handles locking, logging errors, and returns the slice. The size parameter limits the number of rows scanned.

func GetrowsN

func GetrowsN[T any](imdb bool, size int, querystring string, args ...any) []T

getrowsN executes the given querystring with multiple arguments, scans the result rows into a slice of the generic type T, handles locking, logging errors, and returns the slice. The size parameter limits the number of rows scanned.

func GetrowsNuncached

func GetrowsNuncached[T any](size int, querystring string, args []any) []T

getrowsNuncached executes the given querystring with multiple arguments against the uncached database connection, scans the result rows into a slice of the generic type T, handles locking, logging errors, and returns the slice. The size parameter limits the number of rows scanned.

func InitCache

func InitCache()

InitCache initializes the global cache by creating a new Cache instance with the provided expiration times and logger. It is called on startup to initialize the cache before it is used.

func InitDB

func InitDB(dbloglevel string) error

InitDB initializes a connection to the data.db SQLite database. It creates the file if it does not exist and sets database connection parameters.

func InitImdbdb

func InitImdbdb() error

InitImdbdb initializes a connection to the imdb.db SQLite database. It creates the file if it does not exist.

func InsertArray

func InsertArray(table string, columns []string, values ...any) (sql.Result, error)

InsertArray inserts a row into the given database table, with the provided columns and values. The number of columns must match the number of value parameters. It handles building the SQL insert statement from the parameters, executing the insert, and returning the result or any error.

func InvalidateImdbStmt

func InvalidateImdbStmt()

func MapLoadP

func MapLoadP[T any](m *sync.Map, key string) (*T, bool)

MapLoadP loads a value for the given key from the sync.Map m. It returns a pointer to the value and a bool indicating if it was found. This allows convenient loading of typed values from a sync.Map. The Type needs to be stored in the sync.Map as a pointer.

func NewCache

func NewCache(cleaningInterval time.Duration, extension time.Duration, log *zerolog.Logger) *globalcache

NewRegex creates a new GlobalcacheRegex instance. cleaningInterval specifies the interval to clean up expired regex entries. extension specifies the default expiration duration to use for cached regexes. log is the logger used for logging. It initializes the cache and starts a goroutine to clean up expired entries based on the cleaningInterval.

func OpenImdbdb

func OpenImdbdb()

func ParseDate

func ParseDate(date string) sql.NullTime

ParseDate parses a date string in "2006-01-02" format and returns a sql.NullTime. Returns a null sql.NullTime if the date string is empty or fails to parse.

func ParseDateTime

func ParseDateTime(date string) time.Time

ParseDate parses a date string in "2006-01-02" format and returns a sql.NullTime. Returns a null sql.NullTime if the date string is empty or fails to parse.

func PingImdbdb

func PingImdbdb() error

func QueryDBEpisodeID

func QueryDBEpisodeID(dbserie *uint, season *int, episode any, outid *uint)

QueryDBEpisodeID retrieves the database episode ID for the given series ID, season number, and episode number. It handles locking, error logging, and zeroing the output ID on error.

func QueryImdbAka

func QueryImdbAka(qu Querywithargs, arg any) []imdbAka

QueryImdbAka queries the imdb_akas table to get alternate titles and regional releases for the given IMDb ID. It takes a Querywithargs for pagination and filtering, and a pointer to the IMDb ID to query on. It returns a slice of ImdbAka structs containing the alternate title data.

func QueryImdbAkaCountByTitleSlug

func QueryImdbAkaCountByTitleSlug(arg *string, arg2 *string) int

QueryImdbAkaCountByTitleSlug executes a query against the imdb database to get the number of aka title records matching the given title or slug parameters. Returns 0 if either parameter is nil. The title and slug values are matched case insensitively.

func RefreshCached

func RefreshCached(key string)

func RefreshMediaCache

func RefreshMediaCache(useseries bool)

RefreshMediaCache refreshes the media caches for movies and series. It will refresh the caches based on the useseries parameter: - if useseries is false, it will refresh the movie caches - if useseries is true, it will refresh the series caches It locks access to the caches while refreshing to prevent concurrent access issues.

func RefreshMediaCacheTitles

func RefreshMediaCacheTitles(useseries bool)

RefreshMediaCacheTitles refreshes the cached media title arrays for movies or series. It handles locking and unlocking the cache mutex. The useseries parameter determines if it refreshes the cache for series or movies.

func Refreshfilescached

func Refreshfilescached(useseries bool)

Refreshfilescached refreshes the cached file location arrays for movies or series. It handles locking and unlocking the cache mutex. The useseries parameter determines if it refreshes the cache for series or movies.

func Refreshhistorycache

func Refreshhistorycache(useseries bool)

Refreshhistorycache refreshes the cached history title and URL arrays for movies or series. It handles locking and unlocking the cache mutex. The useseries parameter determines if it refreshes the cache for series or movies.

func Refreshunmatchedcached

func Refreshunmatchedcached(useseries bool)

Refreshunmatchedcached refreshes the cached string array of unmatched files for movies or series. It handles locking and unlocking the cache mutex. The useseries parameter determines if it refreshes the cache for series or movies.

func RegexGetMatchesFind

func RegexGetMatchesFind(key string, matchfor string, mincount int) bool

RegexGetMatchesFind checks if the regular expression matches the input string at least mincount times. It returns true if there are at least mincount matches, false otherwise. The regular expression is retrieved from the global cache.

func RegexGetMatchesStr1Str2

func RegexGetMatchesStr1Str2(cached bool, key string, matchfor string) (string, string)

RegexGetMatchesStr1Str2 searches for regex matches in a string. It takes a boolean to indicate if the regex should use the cached compiled version, the regex string, and the string to search. It returns two submatch strings from the match or empty strings if no match.

func ScanrowsNdyn

func ScanrowsNdyn(imdb bool, querystring string, obj any, args ...any) error

ScanrowsNdyn scans a single row into a pointer to a struct, setting fields of the struct to zero values if sql.ErrNoRows is returned. It takes a bool indicating if the query is for the imdb database, the query string, a pointer to the struct to scan into, and optional variadic arguments. It returns any error from the query.

func SetCachedObj

func SetCachedObj(key string, val any)

SetCachedObj stores the given value in the cache under the given key. If the key already exists, the existing value is deleted first.

func SetDBEpisodeIDByIdentifier

func SetDBEpisodeIDByIdentifier(dbepiid *uint, dbserieid *uint, identifier *string)

SetDBEpisodeIDByIdentifier sets the database episode ID for the given series ID and identifier. It handles nil checks, retries with normalized identifiers, error handling, and zeroing the ID on error.

func SetVars

func SetVars()

GetVars populates the global regex variables from the database. It retrieves the quality regexes from the database and processes them to populate: - DBConnect.GetresolutionsIn - DBConnect.GetqualitiesIn - DBConnect.GetcodecsIn - DBConnect.GetaudiosIn It also processes the config regex settings, and splits the regex strings to populate: - DBConnect.AudioStrIn - DBConnect.CodecStrIn - DBConnect.QualityStrIn - DBConnect.ResolutionStrIn

func SetVersion

func SetVersion(str string)

SetVersion sets the global DBVersion variable to the given version string.

func SlicesCacheContains

func SlicesCacheContains(s string, v string) bool

SlicesCacheContains checks if the cached string array identified by s contains the value v. It iterates over the array and returns true if a match is found.

func SlicesCacheContainsDelete

func SlicesCacheContainsDelete(s string, v string)

SlicesCacheContainsDelete removes an element matching v from the cached string array identified by s. It acquires a lock, defers unlocking, and iterates over the array to find a match. When found, it uses slices.Delete to remove the element while preserving order, updates the cache, and returns.

func SlicesCacheContainsI

func SlicesCacheContainsI(s string, v string) bool

SlicesCacheContainsI checks if string v exists in the cached string array identified by s using a case-insensitive comparison. It gets the cached array, iterates over it, compares each element to v with EqualFold, and returns true if a match is found.

func UpdateArray

func UpdateArray(table string, columns []string, where string, args ...any) (sql.Result, error)

UpdateArray updates rows in the given database table by setting the provided columns to the corresponding value parameters. It builds the SQL UPDATE statement dynamically based on the parameters. The optional where parameter allows specifying a WHERE clause to filter the rows to update. It handles executing the statement and returning the result or any error.

func Upgrade

func Upgrade(c *gin.Context)

Upgrade handles upgrading the database by calling UpgradeDB.

func UpgradeDB

func UpgradeDB() error

UpgradeDB initializes the database schema and upgrades to the latest version. It returns an error if migration fails.

func UpgradeIMDB

func UpgradeIMDB()

UpgradeIMDB migrates the imdb database to the latest version. It initializes a database migration manager, pointing it to the migration scripts. It then runs the Up() method to apply any necessary changes. Any errors are printed.

Types

type Dbmovie

type Dbmovie struct {
	ID               uint
	CreatedAt        time.Time `db:"created_at"`
	UpdatedAt        time.Time `db:"updated_at"`
	Title            string
	ReleaseDate      sql.NullTime `db:"release_date" json:"release_date" time_format:"2006-01-02" time_utc:"1"`
	Year             int
	Adult            bool
	Budget           int
	Genres           string
	OriginalLanguage string `db:"original_language"`
	OriginalTitle    string `db:"original_title"`
	Overview         string
	Popularity       float32
	Revenue          int
	Runtime          int
	SpokenLanguages  string `db:"spoken_languages"`
	Status           string
	Tagline          string
	VoteAverage      float32 `db:"vote_average"`
	VoteCount        int     `db:"vote_count"`
	TraktID          int     `db:"trakt_id"`
	MoviedbID        int     `db:"moviedb_id"`
	ImdbID           string  `db:"imdb_id"`
	FreebaseMID      string  `db:"freebase_m_id"`
	FreebaseID       string  `db:"freebase_id"`
	FacebookID       string  `db:"facebook_id"`
	InstagramID      string  `db:"instagram_id"`
	TwitterID        string  `db:"twitter_id"`
	URL              string
	Backdrop         string
	Poster           string
	Slug             string
}

func GetDbmovieByID

func GetDbmovieByID(id *uint) (Dbmovie, error)

GetDbmovieByID retrieves a Dbmovie by ID. It takes a uint ID and returns a Dbmovie struct and error. It executes a SQL query using the structscanG function to select the dbmovie data and scan it into the Dbmovie struct. Returns an error if there was a problem retrieving the data.

func QueryDbmovie

func QueryDbmovie(qu Querywithargs, args ...any) []Dbmovie

QueryDbmovie queries the dbmovies table using the provided Querywithargs struct and arguments. It sets the query size and limit, table name, default columns to select, builds the query if needed, and executes the query using QueryStaticArrayN, returning a slice of Dbmovie structs.

func (*Dbmovie) Close

func (s *Dbmovie) Close()

Close cleans up the Dbmovie value after use. This avoids keeping unnecessary data in memory.

type DbmovieTitle

type DbmovieTitle struct {
	ID        uint
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	DbmovieID uint      `db:"dbmovie_id"`
	Title     string
	Slug      string
	Region    string
}

func QueryDbmovieTitle

func QueryDbmovieTitle(qu Querywithargs, args ...any) []DbmovieTitle

QueryDbmovieTitle queries the dbmovie_titles table using the provided Querywithargs struct and arguments. It sets the query size and limit, table name, default columns to select, builds the query if needed, and executes the query using QueryStaticArrayN, returning a slice of DbmovieTitle structs.

type Dbserie

type Dbserie struct {
	ID              uint
	CreatedAt       time.Time `db:"created_at"`
	UpdatedAt       time.Time `db:"updated_at"`
	Seriename       string
	Aliases         string
	Season          string
	Status          string
	Firstaired      string
	Network         string
	Runtime         string
	Language        string
	Genre           string
	Overview        string
	Rating          string
	Siterating      string
	SiteratingCount string `db:"siterating_count"`
	Slug            string
	TraktID         int    `db:"trakt_id"`
	ImdbID          string `db:"imdb_id"`
	ThetvdbID       int    `db:"thetvdb_id"`
	FreebaseMID     string `db:"freebase_m_id"`
	FreebaseID      string `db:"freebase_id"`
	TvrageID        int    `db:"tvrage_id"`
	Facebook        string
	Instagram       string
	Twitter         string
	Banner          string
	Poster          string
	Fanart          string
	Identifiedby    string
}

func GetDbserieByID

func GetDbserieByID(id *uint) (Dbserie, error)

GetDbserieByID retrieves a Dbserie by ID. It takes a uint ID and returns a Dbserie struct and error. It executes a SQL query using the structscanG function to select the dbserie data and scan it into the Dbserie struct. Returns an error if there was a problem retrieving the data.

func QueryDbserie

func QueryDbserie(qu Querywithargs, args ...any) []Dbserie

QueryDbserie queries the dbseries table using the provided Querywithargs struct and arguments. It sets the query size and limit, table name, default columns to select, builds the query if needed, and executes the query using QueryStaticArrayN, returning a slice of Dbserie structs.

func (*Dbserie) Close

func (s *Dbserie) Close()

Close cleans up the Dbserie value after use. It nulls out fields to avoid lingering references and aid garbage collection. This is useful to do after finishing using a Dbserie value that was retrieved from the database.

type DbserieAlternate

type DbserieAlternate struct {
	ID        uint
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	Title     string
	Slug      string
	Region    string
	DbserieID uint `db:"dbserie_id"`
}

func QueryDbserieAlternates

func QueryDbserieAlternates(qu Querywithargs, args ...any) []DbserieAlternate

QueryDbserieAlternates queries the dbserie_alternates table based on the provided Querywithargs struct and arguments. It sets the query size limit from the Limit field if greater than 0. It sets the default columns to query. It builds the query string if not already set. It executes the query using QueryStaticArrayN to return a slice of DbserieAlternate structs.

type DbserieEpisode

type DbserieEpisode struct {
	ID         uint
	CreatedAt  time.Time `db:"created_at"`
	UpdatedAt  time.Time `db:"updated_at"`
	Episode    string
	Season     string
	Identifier string
	Title      string
	FirstAired sql.NullTime `db:"first_aired" json:"first_aired" time_format:"2006-01-02" time_utc:"1"`
	Overview   string
	Poster     string
	Runtime    int
	DbserieID  uint `db:"dbserie_id"`
}

func QueryDbserieEpisodes

func QueryDbserieEpisodes(qu Querywithargs, args ...any) []DbserieEpisode

QueryDbserieEpisodes queries the dbserie_episodes table based on the provided Querywithargs struct and arguments. It sets the query size limit from the Limit field if greater than 0. It sets the default columns to query. It builds the query string if not already set. It executes the query using QueryStaticArrayN to return a slice of DbserieEpisode structs.

type DbstaticOneIntOneBool

type DbstaticOneIntOneBool struct {
	Num int  `db:"num"`
	Bl  bool `db:"bl"`
}

type DbstaticOneStringOneInt

type DbstaticOneStringOneInt struct {
	Str string `db:"str"`
	Num int    `db:"num"`
}

type DbstaticOneStringOneUInt

type DbstaticOneStringOneUInt struct {
	Str string `db:"str"`
	Num uint   `db:"num"`
}

type DbstaticOneStringTwoInt

type DbstaticOneStringTwoInt struct {
	Str  string `db:"str"`
	Num1 int    `db:"num1"`
	Num2 int    `db:"num2"`
}

type DbstaticThreeString

type DbstaticThreeString struct {
	Str1 string `db:"str1"`
	Str2 string `db:"str2"`
	Str3 string `db:"str3"`
}

type DbstaticThreeStringTwoInt

type DbstaticThreeStringTwoInt struct {
	Str1 string `db:"str1"`
	Str2 string `db:"str2"`
	Str3 string `db:"str3"`
	Num1 int    `db:"num1"`
	Num2 int    `db:"num2"`
}

type DbstaticTwoInt

type DbstaticTwoInt struct {
	Num1 int `db:"num1"`
	Num2 int `db:"num2"`
}

type DbstaticTwoString

type DbstaticTwoString struct {
	Str1 string `db:"str1"`
	Str2 string `db:"str2"`
}

type DbstaticTwoStringOneInt

type DbstaticTwoStringOneInt struct {
	Str1 string `db:"str1"`
	Str2 string `db:"str2"`
	Num  int    `db:"num"`
}

func Getentryalternatetitlesdirect

func Getentryalternatetitlesdirect(dbid uint, useseries bool) []DbstaticTwoStringOneInt

getentryalternatetitlesdirect queries the database to get alternate titles for the given media entry ID. It returns a slice of DbstaticTwoString structs containing the alternate titles and slugs. If useseries is true, it will query the series alternates table, otherwise it queries the movies titles table. It first checks the cache if enabled, otherwise queries the DB directly.

type DbstaticTwoUint

type DbstaticTwoUint struct {
	Num1 uint `db:"num1"`
	Num2 uint `db:"num2"`
}

type FilePrio

type FilePrio struct {
	Location     string
	DBID         uint
	ID           uint
	ResolutionID uint
	QualityID    uint
	CodecID      uint
	AudioID      uint
	Proper       bool
	Repack       bool
	Extended     bool
}

type ImdbRatings

type ImdbRatings struct {
	ID            uint
	CreatedAt     time.Time `db:"created_at"`
	UpdatedAt     time.Time `db:"updated_at"`
	Tconst        string
	NumVotes      int     `db:"num_votes"`
	AverageRating float32 `db:"average_rating"`
}

func (*ImdbRatings) Close

func (s *ImdbRatings) Close()

Close cleans up the imdbRatings struct by zeroing it after use. This avoids leaving sensitive data in memory.

type ImdbTitle

type ImdbTitle struct {
	Tconst         string
	TitleType      string `db:"title_type"`
	PrimaryTitle   string `db:"primary_title"`
	Slug           string
	OriginalTitle  string `db:"original_title"`
	IsAdult        bool   `db:"is_adult"`
	StartYear      int    `db:"start_year"`
	EndYear        int    `db:"end_year"`
	RuntimeMinutes int    `db:"runtime_minutes"`
	Genres         string
}

func (*ImdbTitle) Close

func (s *ImdbTitle) Close()

Close cleans up the imdbTitle struct by zeroing out fields when variable cleanup is enabled. This allows the struct to be garbage collected and avoids potential memory leaks.

type JobHistory

type JobHistory struct {
	ID          uint
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	JobType     string    `db:"job_type"`
	JobCategory string    `db:"job_category"`
	JobGroup    string    `db:"job_group"`
	Started     sql.NullTime
	Ended       sql.NullTime
}

func QueryJobHistory

func QueryJobHistory(qu Querywithargs, args ...any) []JobHistory

QueryJobHistory retrieves JobHistory records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of JobHistory structs matching the query.

type Movie

type Movie struct {
	ID             uint
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
	Lastscan       sql.NullTime
	Blacklisted    bool
	QualityReached bool   `db:"quality_reached"`
	QualityProfile string `db:"quality_profile"`
	Missing        bool
	DontUpgrade    bool `db:"dont_upgrade"`
	DontSearch     bool `db:"dont_search"`
	Listname       string
	Rootpath       string
	DbmovieID      uint `db:"dbmovie_id"`
}

func GetMovies

func GetMovies(qu Querywithargs, args ...any) (Movie, error)

GetMovies retrieves a Movie struct based on the provided Querywithargs. It sets the query table and columns. It builds the query if not already set. It executes the query and scans the result into a Movie struct. Returns the Movie struct and any error.

func QueryMovies

func QueryMovies(arg string) []Movie

QueryMovies retrieves all Movie records matching the given listname. It takes a string containing the listname to search for. It returns a slice of Movie structs matching the listname.

type MovieFile

type MovieFile struct {
	ID             uint
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
	Location       string
	Filename       string
	Extension      string
	QualityProfile string `db:"quality_profile"`
	Proper         bool
	Extended       bool
	Repack         bool
	Height         int
	Width          int
	ResolutionID   uint `db:"resolution_id"`
	QualityID      uint `db:"quality_id"`
	CodecID        uint `db:"codec_id"`
	AudioID        uint `db:"audio_id"`
	MovieID        uint `db:"movie_id"`
	DbmovieID      uint `db:"dbmovie_id"`
}

type MovieFileUnmatched

type MovieFileUnmatched struct {
	ID          uint
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	Listname    string
	Filepath    string
	LastChecked sql.NullTime `db:"last_checked"`
	ParsedData  string       `db:"parsed_data"`
}

func QueryMovieFileUnmatched

func QueryMovieFileUnmatched(qu Querywithargs, args ...any) []MovieFileUnmatched

QueryMovieFileUnmatched retrieves MovieFileUnmatched records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of MovieFileUnmatched structs matching the query.

type MovieHistory

type MovieHistory struct {
	ID             uint
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
	Title          string
	URL            string
	Indexer        string
	HistoryType    string `db:"type"`
	Target         string
	DownloadedAt   time.Time `db:"downloaded_at"`
	Blacklisted    bool
	QualityProfile string `db:"quality_profile"`
	ResolutionID   uint   `db:"resolution_id"`
	QualityID      uint   `db:"quality_id"`
	CodecID        uint   `db:"codec_id"`
	AudioID        uint   `db:"audio_id"`
	MovieID        uint   `db:"movie_id"`
	DbmovieID      uint   `db:"dbmovie_id"`
}

type Mysqlite

type Mysqlite struct {
	db.Base
}

Sqlite is a Connection of sqlite.

func GetSqliteDB

func GetSqliteDB() *Mysqlite

GetSqliteDB return the global sqlite connection.

func (*Mysqlite) BeginTx

func (d *Mysqlite) BeginTx() *sql.Tx

BeginTx starts a transaction with level LevelDefault.

func (*Mysqlite) BeginTxAndConnection

func (d *Mysqlite) BeginTxAndConnection(conn string) *sql.Tx

BeginTxAndConnection starts a transaction with level LevelDefault and connection.

func (*Mysqlite) BeginTxWithLevel

func (d *Mysqlite) BeginTxWithLevel(level sql.IsolationLevel) *sql.Tx

BeginTxWithLevel starts a transaction with given transaction isolation level.

func (*Mysqlite) BeginTxWithLevelAndConnection

func (d *Mysqlite) BeginTxWithLevelAndConnection(conn string, level sql.IsolationLevel) *sql.Tx

BeginTxWithLevelAndConnection starts a transaction with given transaction isolation level and connection.

func (*Mysqlite) BeginTxWithReadCommitted

func (d *Mysqlite) BeginTxWithReadCommitted() *sql.Tx

BeginTxWithReadCommitted starts a transaction with level LevelReadCommitted.

func (*Mysqlite) BeginTxWithReadCommittedAndConnection

func (d *Mysqlite) BeginTxWithReadCommittedAndConnection(conn string) *sql.Tx

BeginTxWithReadCommittedAndConnection starts a transaction with level LevelReadCommitted and connection.

func (*Mysqlite) BeginTxWithReadUncommitted

func (d *Mysqlite) BeginTxWithReadUncommitted() *sql.Tx

BeginTxWithReadUncommitted starts a transaction with level LevelReadUncommitted.

func (*Mysqlite) BeginTxWithReadUncommittedAndConnection

func (d *Mysqlite) BeginTxWithReadUncommittedAndConnection(conn string) *sql.Tx

BeginTxWithReadUncommittedAndConnection starts a transaction with level LevelReadUncommitted and connection.

func (*Mysqlite) BeginTxWithRepeatableRead

func (d *Mysqlite) BeginTxWithRepeatableRead() *sql.Tx

BeginTxWithRepeatableRead starts a transaction with level LevelRepeatableRead.

func (*Mysqlite) BeginTxWithRepeatableReadAndConnection

func (d *Mysqlite) BeginTxWithRepeatableReadAndConnection(conn string) *sql.Tx

BeginTxWithRepeatableReadAndConnection starts a transaction with level LevelRepeatableRead and connection.

func (*Mysqlite) Exec

func (d *Mysqlite) Exec(query string, args ...any) (sql.Result, error)

Exec implements the method Connection.Exec.

func (*Mysqlite) ExecWith

func (d *Mysqlite) ExecWith(tx *sql.Tx, conn, query string, args ...any) (sql.Result, error)

func (*Mysqlite) ExecWithConnection

func (d *Mysqlite) ExecWithConnection(con string, query string, args ...any) (sql.Result, error)

ExecWithConnection implements the method Connection.ExecWithConnection.

func (*Mysqlite) ExecWithTx

func (d *Mysqlite) ExecWithTx(tx *sql.Tx, query string, args ...any) (sql.Result, error)

ExecWithTx is exec method within the transaction.

func (*Mysqlite) GetDelimiter

func (d *Mysqlite) GetDelimiter() string

GetDelimiter implements the method Connection.GetDelimiter.

func (*Mysqlite) GetDelimiter2

func (d *Mysqlite) GetDelimiter2() string

GetDelimiter2 implements the method Connection.GetDelimiter2.

func (*Mysqlite) GetDelimiters

func (d *Mysqlite) GetDelimiters() []string

GetDelimiters implements the method Connection.GetDelimiters.

func (*Mysqlite) InitDB

func (d *Mysqlite) InitDB(cfgList map[string]config.Database) db.Connection

InitDB implements the method Connection.InitDB.

func (*Mysqlite) Name

func (d *Mysqlite) Name() string

Name implements the method Connection.Name.

func (*Mysqlite) Query

func (d *Mysqlite) Query(query string, args ...any) ([]map[string]any, error)

Query implements the method Connection.Query.

func (*Mysqlite) QueryWith

func (d *Mysqlite) QueryWith(tx *sql.Tx, conn, query string, args ...any) ([]map[string]any, error)

func (*Mysqlite) QueryWithConnection

func (d *Mysqlite) QueryWithConnection(con string, query string, args ...any) ([]map[string]any, error)

QueryWithConnection implements the method Connection.QueryWithConnection.

func (*Mysqlite) QueryWithTx

func (d *Mysqlite) QueryWithTx(tx *sql.Tx, query string, args ...any) ([]map[string]any, error)

QueryWithTx is query method within the transaction.

type ParseInfo

type ParseInfo struct {
	// File is the path to the media file
	File string
	// Title is the title of the media
	Title string
	// Season is the season number, if applicable
	Season int `json:"season,omitempty"`
	// Episode is the episode number, if applicable
	Episode int `json:"episode,omitempty"`
	// SeasonStr is the season number as a string, if applicable
	SeasonStr string `json:"seasonstr,omitempty"`
	// EpisodeStr is the episode number as a string, if applicable
	EpisodeStr string `json:"episodestr,omitempty"`
	// Year is the year of release
	Year int `json:"year,omitempty"`
	// Resolution is the video resolution
	Resolution string `json:"resolution,omitempty"`
	// ResolutionID is the database ID of the resolution
	ResolutionID uint `json:"resolutionid,omitempty"`
	// Quality is the video quality description
	Quality string `json:"quality,omitempty"`
	// QualityID is the database ID of the quality
	QualityID uint `json:"qualityid,omitempty"`
	// Codec is the video codec
	Codec string `json:"codec,omitempty"`
	// CodecID is the database ID of the codec
	CodecID uint `json:"codecid,omitempty"`
	// Audio is the audio description
	Audio string `json:"audio,omitempty"`
	// AudioID is the database ID of the audio
	AudioID uint `json:"audioid,omitempty"`
	// Priority is the priority for downloading
	Priority int `json:"priority,omitempty"`
	// Identifier is an identifier string
	Identifier string `json:"identifier,omitempty"`
	// Date is the release date
	Date string `json:"date,omitempty"`
	// Extended is a flag indicating if it is an extended version
	Extended bool `json:"extended,omitempty"`
	// Proper is a flag indicating if it is a proper release
	Proper bool `json:"proper,omitempty"`
	// Repack is a flag indicating if it is a repack release
	Repack bool `json:"repack,omitempty"`
	// Imdb is the IMDB ID
	Imdb string `json:"imdb,omitempty"`
	// Tvdb is the TVDB ID
	Tvdb string `json:"tvdb,omitempty"`
	// Qualityset is the quality configuration
	Qualityset *config.QualityConfig `json:"qualityset,omitempty"`
	// Languages is a list of language codes
	Languages []string `json:"languages,omitempty"`
	// Runtime is the runtime in minutes
	Runtime int `json:"runtime,omitempty"`
	// Height is the video height in pixels
	Height int `json:"height,omitempty"`
	// Width is the video width in pixels
	Width int `json:"width,omitempty"`
	// DbmovieID is the database ID of the movie
	DbmovieID uint `json:"dbmovieid,omitempty"`
	// MovieID is the application ID of the movie
	MovieID uint `json:"movieid,omitempty"`
	// DbserieID is the database ID of the TV series
	DbserieID uint `json:"dbserieid,omitempty"`
	// DbserieEpisodeID is the database ID of the episode
	DbserieEpisodeID uint `json:"dbserieepisodeid,omitempty"`
	// SerieID is the application ID of the TV series
	SerieID uint `json:"serieid,omitempty"`
	// SerieEpisodeID is the application ID of the episode
	SerieEpisodeID uint `json:"serieepisodeid,omitempty"`
	// ListID is the ID of the list this came from
	ListID int
}

ParseInfo is a struct containing parsed information about media files

func (*ParseInfo) Buildparsedstring

func (m *ParseInfo) Buildparsedstring() string

Buildparsedstring concatenates the ParseInfo fields into a string for logging.

type Qualities

type Qualities struct {
	ID           uint
	CreatedAt    time.Time `db:"created_at"`
	UpdatedAt    time.Time `db:"updated_at"`
	QualityType  int       `db:"type"`
	Name         string
	Regex        string
	Strings      string
	StringsLower string
	Priority     int
	UseRegex     bool `db:"use_regex"`
	Regexgroup   int
}

type 1 reso 2 qual 3 codec 4 audio

type QualitiesRegex

type QualitiesRegex struct {
	Regex string
	Qualities
}

type Querywithargs

type Querywithargs struct {
	// QueryString is the base SQL query
	QueryString string
	// Select is the columns to select
	Select string
	// Table is the main table in the query
	Table string
	// InnerJoin is any inner join statements
	InnerJoin string
	// Where is the WHERE clause
	Where string
	// OrderBy is the ORDER BY clause
	OrderBy string
	// Limit is the LIMIT clause value
	Limit int
	// Offset is the OFFSET clause value
	Offset int
	// contains filtered or unexported fields
}

Querywithargs is a struct to hold query arguments

func (*Querywithargs) Buildquery

func (qu *Querywithargs) Buildquery(count bool)

Buildquery constructs the SQL query string from the Querywithargs fields. It handles adding the SELECT columns, FROM table, JOINs, WHERE, ORDER BY and LIMIT clauses based on the configured fields.

type ResultMovies

type ResultMovies struct {
	Dbmovie
	Listname       string
	Lastscan       sql.NullTime
	Blacklisted    bool
	QualityReached bool   `db:"quality_reached"`
	QualityProfile string `db:"quality_profile"`
	Rootpath       string
	Missing        bool
	DbmovieID      uint `db:"dbmovie_id"`
}

func QueryResultMovies

func QueryResultMovies(qu Querywithargs, args ...any) []ResultMovies

QueryResultMovies retrieves ResultMovies records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of ResultMovies structs matching the query.

type ResultSerieEpisodes

type ResultSerieEpisodes struct {
	DbserieEpisode
	Listname         string
	Rootpath         string
	Lastscan         sql.NullTime
	Blacklisted      bool
	QualityReached   bool   `db:"quality_reached"`
	QualityProfile   string `db:"quality_profile"`
	Missing          bool
	DbserieEpisodeID uint `db:"dbserie_episode_id"`
}

func QueryResultSerieEpisodes

func QueryResultSerieEpisodes(qu Querywithargs, args ...any) []ResultSerieEpisodes

QueryResultSerieEpisodes retrieves ResultSerieEpisodes records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of ResultSerieEpisodes structs matching the query.

type ResultSeries

type ResultSeries struct {
	Dbserie
	Listname  string
	Rootpath  string
	DbserieID uint `db:"dbserie_id"`
}

func QueryResultSeries

func QueryResultSeries(qu Querywithargs, args ...any) []ResultSeries

QueryResultSeries retrieves ResultSeries records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of ResultSeries structs matching the query.

type Serie

type Serie struct {
	ID             uint
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
	Listname       string
	Rootpath       string
	DbserieID      uint `db:"dbserie_id"`
	DontUpgrade    bool `db:"dont_upgrade"`
	DontSearch     bool `db:"dont_search"`
	SearchSpecials bool `db:"search_specials"`
	IgnoreRuntime  bool `db:"ignore_runtime"`
}

func GetSeries

func GetSeries(qu Querywithargs, args ...any) (Serie, error)

GetSeries retrieves a Serie struct based on the provided Querywithargs. It sets the query table and columns. It builds the query if not already set. It executes the query and scans the result into a Serie struct. Returns the Serie struct and any error.

type SerieEpisode

type SerieEpisode struct {
	ID               uint
	CreatedAt        time.Time `db:"created_at"`
	UpdatedAt        time.Time `db:"updated_at"`
	Lastscan         sql.NullTime
	Blacklisted      bool
	QualityReached   bool   `db:"quality_reached"`
	QualityProfile   string `db:"quality_profile"`
	Missing          bool
	DontUpgrade      bool `db:"dont_upgrade"`
	DontSearch       bool `db:"dont_search"`
	IgnoreRuntime    bool `db:"ignore_runtime"`
	DbserieEpisodeID uint `db:"dbserie_episode_id"`
	SerieID          uint `db:"serie_id"`
	DbserieID        uint `db:"dbserie_id"`
}

func GetSerieEpisodes

func GetSerieEpisodes(qu Querywithargs, args ...any) (SerieEpisode, error)

GetSerieEpisodes retrieves a SerieEpisode struct based on the provided Querywithargs. It sets the query table and columns. It builds the query if not already set. It executes the query and scans the result into a SerieEpisode struct. Returns a SerieEpisode struct and any error.

func QuerySerieEpisodes

func QuerySerieEpisodes(arg *string) []SerieEpisode

QuerySerieEpisodes retrieves all SerieEpisode records for the given series listname. It takes a pointer to a string containing the listname to search for. It returns a slice of SerieEpisode structs matching the listname.

type SerieEpisodeFile

type SerieEpisodeFile struct {
	ID               uint
	CreatedAt        time.Time `db:"created_at"`
	UpdatedAt        time.Time `db:"updated_at"`
	Location         string
	Filename         string
	Extension        string
	QualityProfile   string `db:"quality_profile"`
	Proper           bool
	Extended         bool
	Repack           bool
	Height           int
	Width            int
	ResolutionID     uint `db:"resolution_id"`
	QualityID        uint `db:"quality_id"`
	CodecID          uint `db:"codec_id"`
	AudioID          uint `db:"audio_id"`
	SerieID          uint `db:"serie_id"`
	SerieEpisodeID   uint `db:"serie_episode_id"`
	DbserieEpisodeID uint `db:"dbserie_episode_id"`
	DbserieID        uint `db:"dbserie_id"`
}

type SerieEpisodeHistory

type SerieEpisodeHistory struct {
	ID               uint
	CreatedAt        time.Time `db:"created_at"`
	UpdatedAt        time.Time `db:"updated_at"`
	Title            string
	URL              string
	Indexer          string
	SerieType        string `db:"type"`
	Target           string
	DownloadedAt     time.Time `db:"downloaded_at"`
	Blacklisted      bool
	QualityProfile   string `db:"quality_profile"`
	ResolutionID     uint   `db:"resolution_id"`
	QualityID        uint   `db:"quality_id"`
	CodecID          uint   `db:"codec_id"`
	AudioID          uint   `db:"audio_id"`
	SerieID          uint   `db:"serie_id"`
	SerieEpisodeID   uint   `db:"serie_episode_id"`
	DbserieEpisodeID uint   `db:"dbserie_episode_id"`
	DbserieID        uint   `db:"dbserie_id"`
}

type SerieFileUnmatched

type SerieFileUnmatched struct {
	ID          uint
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	Listname    string
	Filepath    string
	LastChecked sql.NullTime `db:"last_checked"`
	ParsedData  string       `db:"parsed_data"`
}

func QuerySerieFileUnmatched

func QuerySerieFileUnmatched(qu Querywithargs, args ...any) []SerieFileUnmatched

QuerySerieFileUnmatched retrieves SerieFileUnmatched records matching the query arguments. It takes a Querywithargs struct to define the query parameters. It returns a slice of SerieFileUnmatched structs matching the query.

Jump to

Keyboard shortcuts

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