searcher

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineSearchPool

func DefineSearchPool(maxcount int)

func Getnewznabrss

func Getnewznabrss(cfgp *config.MediaTypeConfig, list *config.MediaListsConfig) error

Getnewznabrss queries Newznab indexers from the given MediaListsConfig using the provided MediaTypeConfig. It searches for and downloads any matching RSS feed items.

func Getpriobyfiles

func Getpriobyfiles(useseries bool, id *uint, useall bool, wantedprio int, qualcfg *config.QualityConfig) (int, []string)

Getpriobyfiles returns the minimum priority of existing files for the given media ID, and optionally returns a slice of file paths for existing files below the given wanted priority. If useseries is true it will look up series IDs instead of media IDs. If id is nil it will return 0 priority. If useall is true it will include files marked as deleted. If wantedprio is -1 it will not return any file paths.

func SearchSeriesRSSSeasons

func SearchSeriesRSSSeasons(cfgp *config.MediaTypeConfig)

SearchSeriesRSSSeasons searches the RSS feeds for missing episodes for random series. It selects up to 20 random series that have missing episodes, gets the distinct seasons with missing episodes for each, and searches the RSS feeds for those seasons.

func SearchSeriesRSSSeasonsAll

func SearchSeriesRSSSeasonsAll(cfgp *config.MediaTypeConfig)

SearchSeriesRSSSeasonsAll searches all seasons for series matching the given media type config. It searches series that have missing episodes and calls searchseasons to perform the actual search.

Types

type ConfigSearcher

type ConfigSearcher struct {
	// Cfgp is a pointer to a MediaTypeConfig
	Cfgp *config.MediaTypeConfig
	// Quality is a pointer to a QualityConfig
	Quality *config.QualityConfig

	// Sourceentry is a Nzbwithprio result
	Sourceentry apiexternal.Nzbwithprio
	// Dl contains the search results
	Dl *searchResults
	// Mu is a mutex for synchronization
	Mu sync.Mutex
	// contains filtered or unexported fields
}

ConfigSearcher is a struct containing configuration and search results

func NewSearcher

func NewSearcher(cfgp *config.MediaTypeConfig, quality *config.QualityConfig, searchActionType string, mediaid *uint) *ConfigSearcher

NewSearcher creates a new ConfigSearcher instance. It initializes the searcher with the given media type config, quality config, search action type, and media ID. If no quality config is provided but a media ID is given, it will look up the quality config for that media in the database. It gets a searcher instance from the pool and sets the configs, then returns the initialized searcher.

func SearchSerieRSSSeasonSingle

func SearchSerieRSSSeasonSingle(serieid uint, season string, useseason bool, cfgp *config.MediaTypeConfig, autoclose bool, results *ConfigSearcher) (*ConfigSearcher, error)

SearchSerieRSSSeasonSingle searches for a single season of a series. It takes the series ID, season number, whether to search the full season or missing episodes, media type config, whether to auto close the results, and a pointer to search results. It returns a config searcher instance and error. It queries the database to map the series ID to thetvdb ID, gets the quality config, calls the search function, handles errors, downloads results, closes the results if autoclose is true, and returns the config searcher.

func (*ConfigSearcher) AppendDenied

func (s *ConfigSearcher) AppendDenied(entry *apiexternal.Nzbwithprio)

AppendDenied appends the given Nzbwithprio entry to the denied list. If entry is nil, it returns immediately without appending.

func (*ConfigSearcher) Close

func (s *ConfigSearcher) Close()

Close closes the ConfigSearcher, including closing any open connections and clearing resources.

func (*ConfigSearcher) Download

func (s *ConfigSearcher) Download()

Download iterates through the Accepted list and starts downloading each entry, tracking entries already downloaded to avoid duplicates. It handles both movies and TV series based on config and entry details.

func (*ConfigSearcher) EpisodeFillSearchVar

func (s *ConfigSearcher) EpisodeFillSearchVar(episodeid *uint) error

EpisodeFillSearchVar fills the search variables for the given episode ID. It queries the database to get the necessary data and configures the search based on priorities, upgrade settings etc.

func (*ConfigSearcher) GetRSSFeed

func (s *ConfigSearcher) GetRSSFeed(listentry *config.MediaListsConfig, downloadentries bool, autoclose bool) error

GetRSSFeed queries the RSS feed for the given media list, searches for and downloads new items, and adds them to the search results. It handles checking if the indexer is blocked, configuring the custom RSS feed URL, getting the last ID to prevent duplicates, parsing results, and updating the RSS history.

func (*ConfigSearcher) Getsearchalternatetitles

func (s *ConfigSearcher) Getsearchalternatetitles(sourcealttitles []database.DbstaticTwoStringOneInt, titlesearch bool, qualcfg *config.QualityConfig) []database.DbstaticTwoStringOneInt

Getsearchalternatetitles returns alternate search titles to use when searching for media. It takes in alternate titles from the database, a flag indicating if this is already a title search, and the quality configuration. It returns a slice of string alternate titles.

func (*ConfigSearcher) MediaSearch

func (searchvar *ConfigSearcher) MediaSearch(cfgp *config.MediaTypeConfig, mediaid *uint, titlesearch bool, downloadentries bool, autoclose bool) error

MediaSearch searches indexers for the given media entry (movie or TV episode) using the configured quality profile. It handles filling search variables, executing searches across enabled indexers, parsing results, and optionally downloading accepted entries. Returns the search results and error if any.

func (*ConfigSearcher) MovieFillSearchVar

func (s *ConfigSearcher) MovieFillSearchVar(movieid *uint) error

MovieFillSearchVar fills the search variables for the given movie ID. It queries the database to get the movie details and configures the search based on priorities, upgrade settings etc.

func (*ConfigSearcher) SearchRSS

func (searchvar *ConfigSearcher) SearchRSS(cfgp *config.MediaTypeConfig, quality *config.QualityConfig, fetchall bool, downloadresults bool, autoclose bool) error

SearchRSS searches the RSS feeds of the enabled Newznab indexers for the given media type and quality configuration. It returns a ConfigSearcher instance for managing the search, or an error if no search could be started. Results are added to the passed in DownloadResults instance.

Jump to

Keyboard shortcuts

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