![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <VideoInfoScanner.h>
Public Member Functions | |
CVideoInfoScanner () | |
~CVideoInfoScanner () override | |
void | Start (const std::string &strDirectory, bool scanAll=false) |
Scan a folder using the background scanner. | |
void | Stop () |
long | AddVideo (CFileItem *pItem, const CONTENT_TYPE &content, bool videoFolder=false, bool useLocal=true, const CVideoInfoTag *showInfo=NULL, bool libraryImport=false) |
Add an item to the database. | |
bool | RetrieveVideoInfo (CFileItemList &items, bool bDirNames, CONTENT_TYPE content, bool useLocal=true, CScraperUrl *pURL=NULL, bool fetchEpisodes=true, CGUIDialogProgress *pDlgProgress=NULL) |
Retrieve information for a list of items and add them to the database. | |
void | GetArtwork (CFileItem *pItem, const CONTENT_TYPE &content, bool bApplyToDir=false, bool useLocal=true, const std::string &actorArtPath="") |
Retrieve any artwork associated with an item. | |
bool | EnumerateEpisodeItem (const CFileItem *item, EPISODELIST &episodeList) |
![]() | |
virtual | ~CInfoScanner ()=default |
Empty destructor. | |
void | ShowDialog (bool show) |
Set whether or not to show a progress dialog. | |
bool | IsScanning () const |
Returns whether or not a scan is in progress. | |
Static Public Member Functions | |
static void | ApplyThumbToFolder (const std::string &folder, const std::string &imdbThumb) |
static bool | DownloadFailed (CGUIDialogProgress *pDlgProgress) |
static void | GetSeasonThumbs (const CVideoInfoTag &show, std::map< int, std::map< std::string, std::string > > &art, const std::vector< std::string > &artTypes, bool useLocal=true) |
Get season thumbs for a tvshow. All seasons (regardless of whether the user has episodes) are added to the art map. | |
static std::string | GetImage (const CScraperUrl::SUrlEntry &image, const std::string &itemPath) |
static std::string | GetMovieSetInfoFolder (const std::string &setTitle) |
![]() | |
static bool | HasNoMedia (const std::string &strDirectory) |
Check if the folder is excluded from scanning process. | |
Protected Member Functions | |
virtual void | Process () |
bool | DoScan (const std::string &strDirectory) override |
InfoRet | RetrieveInfoForTvShow (CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl *pURL, bool fetchEpisodes, CGUIDialogProgress *pDlgProgress) |
InfoRet | RetrieveInfoForMovie (CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl *pURL, CGUIDialogProgress *pDlgProgress) |
InfoRet | RetrieveInfoForMusicVideo (CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl *pURL, CGUIDialogProgress *pDlgProgress) |
InfoRet | RetrieveInfoForEpisodes (CFileItem *item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress=nullptr, bool alreadyHasArt=false) |
bool | ProgressCancelled (CGUIDialogProgress *progress, int heading, const std::string &line1) |
Update the progress bar with the heading and line and check for cancellation. | |
int | FindVideo (const std::string &title, int year, const ADDON::ScraperPtr &scraper, CScraperUrl &url, CGUIDialogProgress *progress) |
Find a url for the given video using the given scraper. | |
int | FindVideoUsingTag (CFileItem &item, const ADDON::ScraperPtr &scraper, CScraperUrl &url, CGUIDialogProgress *progress) |
Find a url for the given video using the given scraper. | |
bool | GetDetails (CFileItem *pItem, const std::unordered_map< std::string, std::string > &uniqueIDs, CScraperUrl &url, const ADDON::ScraperPtr &scraper, VIDEO::IVideoInfoTagLoader *nfoFile=nullptr, CGUIDialogProgress *pDialog=nullptr) |
Retrieve detailed information for an item from an online source, optionally supplemented with local data. | |
bool | GetEpisodeAndSeasonFromRegExp (CRegExp ®, EPISODE &episodeInfo, int defaultSeason) |
Extract episode and season numbers from a processed regexp. | |
bool | GetAirDateFromRegExp (CRegExp ®, EPISODE &episodeInfo) |
Extract episode air-date from a processed regexp. | |
bool | GetEpisodeTitleFromRegExp (CRegExp ®, EPISODE &episodeInfo) |
Extract episode title from a processed regexp. | |
void | FetchActorThumbs (std::vector< SActorInfo > &actors, const std::string &strPath) |
Fetch thumbs for actors Updates each actor with their thumb (local or online) | |
std::string | GetFastHash (const std::string &directory, const std::vector< std::string > &excludes) const |
Retrieve a "fast" hash of the given directory (if available) Performs a stat() on the directory, and uses modified time to create a "fast" hash of the folder. If no modified time is available, the create time is used, and if neither are available, an empty hash is returned. In case exclude from scan expressions are present, the string array will be appended to the md5 hash to ensure we're doing a re-scan whenever the user modifies those. | |
std::string | GetRecursiveFastHash (const std::string &directory, const std::vector< std::string > &excludes) const |
Retrieve a "fast" hash of the given directory recursively (if available) Performs a stat() on the directory, and uses modified time to create a "fast" hash of each folder. If no modified time is available, the create time is used, and if neither are available, an empty hash is returned. In case exclude from scan expressions are present, the string array will be appended to the md5 hash to ensure we're doing a re-scan whenever the user modifies those. | |
bool | CanFastHash (const CFileItemList &items, const std::vector< std::string > &excludes) const |
Decide whether a folder listing could use the "fast" hash Fast hashing can be done whenever the folder contains no scannable subfolders, as the fast hash technique uses modified time to determine when folder content changes, which is generally not propagated up the directory tree. | |
InfoRet | OnProcessSeriesFolder (EPISODELIST &files, const ADDON::ScraperPtr &scraper, bool useLocal, const CVideoInfoTag &showInfo, CGUIDialogProgress *pDlgProgress=nullptr) |
Process a series folder, filling in episode details and adding them to the database. | |
bool | EnumerateSeriesFolder (CFileItem *item, EPISODELIST &episodeList) |
bool | ProcessItemByVideoInfoTag (const CFileItem *item, EPISODELIST &episodeList) |
bool | AddVideoExtras (CFileItemList &items, const CONTENT_TYPE &content, const std::string &path) |
bool | ProcessVideoVersion (VideoDbContentType itemType, int dbId) |
std::pair< InfoType, std::unique_ptr< IVideoInfoTagLoader > > | ReadInfoTag (CFileItem &item, const ADDON::ScraperPtr &scraper, bool lookInFolder, bool resetTag) |
![]() | |
CInfoScanner ()=default | |
Protected constructor to only allow subclass instances. | |
Static Protected Member Functions | |
static int | GetPathHash (const CFileItemList &items, std::string &hash) |
Protected Attributes | |
bool | m_bStop |
bool | m_scanAll |
bool | m_ignoreVideoVersions {false} |
bool | m_ignoreVideoExtras {false} |
std::string | m_strStartDir |
CVideoDatabase | m_database |
std::set< std::string > | m_pathsToCount |
std::set< int > | m_pathsToClean |
std::shared_ptr< CAdvancedSettings > | m_advancedSettings |
CVideoDatabase::ScraperCache | m_scraperCache |
![]() | |
std::set< std::string > | m_pathsToScan |
Set of paths to scan. | |
bool | m_showDialog = false |
Whether or not to show progress bar dialog. | |
CGUIDialogProgressBarHandle * | m_handle = nullptr |
Progress bar handle. | |
bool | m_bRunning = false |
Whether or not scanner is running. | |
bool | m_bCanInterrupt = false |
Whether or not scanner is currently interruptible. | |
bool | m_bClean = false |
Whether or not to perform cleaning during scanning. | |
Additional Inherited Members | |
![]() | |
enum class | InfoRet { CANCELLED , INFO_ERROR , NOT_NEEDED , HAVE_ALREADY , NOT_FOUND , ADDED } |
Return values from the information lookup functions. More... | |
enum class | InfoType { NONE = 0 , FULL = 1 , URL = 2 , OVERRIDE = 3 , COMBINED = 4 , ERROR_NFO = 5 , TITLE = 6 } |
KODI::VIDEO::CVideoInfoScanner::CVideoInfoScanner | ( | ) |
|
override |
long KODI::VIDEO::CVideoInfoScanner::AddVideo | ( | CFileItem * | pItem, |
const CONTENT_TYPE & | content, | ||
bool | videoFolder = false, | ||
bool | useLocal = true, | ||
const CVideoInfoTag * | showInfo = NULL, | ||
bool | libraryImport = false ) |
Add an item to the database.
pItem | item to add to the database. |
content | content type of the item. |
videoFolder | whether the video is represented by a folder (single movie per folder). Defaults to false. |
useLocal | whether to use local information for artwork etc. |
showInfo | pointer to CVideoInfoTag details for the show if this is an episode. Defaults to NULL. |
libraryImport | Whether this call belongs to a full library import or not. Defaults to false. |
|
protected |
|
static |
|
protected |
Decide whether a folder listing could use the "fast" hash Fast hashing can be done whenever the folder contains no scannable subfolders, as the fast hash technique uses modified time to determine when folder content changes, which is generally not propagated up the directory tree.
items | the directory listing |
excludes | string array of exclude expressions |
|
overrideprotectedvirtual |
Implements CInfoScanner.
|
static |
bool KODI::VIDEO::CVideoInfoScanner::EnumerateEpisodeItem | ( | const CFileItem * | item, |
EPISODELIST & | episodeList ) |
|
protected |
|
protected |
Fetch thumbs for actors Updates each actor with their thumb (local or online)
actors | - vector of SActorInfo |
strPath | - path on filesystem to look for local thumbs |
|
protected |
Find a url for the given video using the given scraper.
title | title of the video to lookup |
year | year of the video to lookup |
scraper | scraper to use for the lookup |
url | [out] returned url from the scraper |
progress | CGUIDialogProgress bar |
|
protected |
Find a url for the given video using the given scraper.
item | the video to lookup |
scraper | scraper to use for the lookup |
url | [out] returned url from the scraper |
progress | CGUIDialogProgress bar |
|
protected |
Extract episode air-date from a processed regexp.
reg | Regular expression object with at least 3 matches |
episodeInfo | Episode information to fill in. |
void KODI::VIDEO::CVideoInfoScanner::GetArtwork | ( | CFileItem * | pItem, |
const CONTENT_TYPE & | content, | ||
bool | bApplyToDir = false, | ||
bool | useLocal = true, | ||
const std::string & | actorArtPath = "" ) |
Retrieve any artwork associated with an item.
pItem | item to find artwork for. |
content | content type of the item. |
bApplyToDir | whether we should apply any thumbs to a folder. Defaults to false. |
useLocal | whether we should use local thumbs. Defaults to true. |
actorArtPath | the path to search for actor thumbs. Defaults to empty. |
|
protected |
Retrieve detailed information for an item from an online source, optionally supplemented with local data.
pItem | item to retrieve online details for. |
uniqueIDs | Unique IDs for additional information for scrapers. |
url | URL to use to retrieve online details. |
scraper | Scraper that handles parsing the online data. |
nfoFile | if set, we override the online data with the locally supplied data. Defaults to NULL. |
pDialog | progress dialog to update and check for cancellation during processing. Defaults to NULL. |
|
protected |
Extract episode and season numbers from a processed regexp.
reg | Regular expression object with at least 2 matches |
episodeInfo | Episode information to fill in. |
defaultSeason | Season to use if not found in reg. |
|
protected |
Extract episode title from a processed regexp.
reg | Regular expression object with at least 1 match |
episodeInfo | Episode information to fill in. |
|
protected |
Retrieve a "fast" hash of the given directory (if available) Performs a stat() on the directory, and uses modified time to create a "fast" hash of the folder. If no modified time is available, the create time is used, and if neither are available, an empty hash is returned. In case exclude from scan expressions are present, the string array will be appended to the md5 hash to ensure we're doing a re-scan whenever the user modifies those.
directory | folder to hash |
excludes | string array of exclude expressions |
|
static |
|
static |
|
staticprotected |
|
protected |
Retrieve a "fast" hash of the given directory recursively (if available) Performs a stat() on the directory, and uses modified time to create a "fast" hash of each folder. If no modified time is available, the create time is used, and if neither are available, an empty hash is returned. In case exclude from scan expressions are present, the string array will be appended to the md5 hash to ensure we're doing a re-scan whenever the user modifies those.
directory | folder to hash (recursively) |
excludes | string array of exclude expressions |
|
static |
Get season thumbs for a tvshow. All seasons (regardless of whether the user has episodes) are added to the art map.
show | tvshow info tag |
art | artwork map to which season thumbs are added. |
useLocal | whether to use local thumbs, defaults to true |
|
protected |
Process a series folder, filling in episode details and adding them to the database.
files | the episode files to process. |
scraper | scraper to use for finding online info |
showInfo | information for the show. |
pDlgProcess | progress dialog to update during processing. Defaults to NULL. |
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
Update the progress bar with the heading and line and check for cancellation.
progress | CGUIDialogProgress bar |
heading | string id of heading |
line1 | string to set for the first line |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool KODI::VIDEO::CVideoInfoScanner::RetrieveVideoInfo | ( | CFileItemList & | items, |
bool | bDirNames, | ||
CONTENT_TYPE | content, | ||
bool | useLocal = true, | ||
CScraperUrl * | pURL = NULL, | ||
bool | fetchEpisodes = true, | ||
CGUIDialogProgress * | pDlgProgress = NULL ) |
Retrieve information for a list of items and add them to the database.
items | list of items to retrieve info for. |
bDirNames | whether we should use folder or file names for lookups. |
content | type of content to retrieve. |
useLocal | should local data (.nfo and art) be used. Defaults to true. |
pURL | an optional URL to use to retrieve online info. Defaults to NULL. |
fetchEpisodes | whether we are fetching episodes with shows. Defaults to true. |
pDlgProgress | progress dialog to update and check for cancellation during processing. Defaults to NULL. |
void KODI::VIDEO::CVideoInfoScanner::Start | ( | const std::string & | strDirectory, |
bool | scanAll = false ) |
Scan a folder using the background scanner.
strDirectory | path to scan |
scanAll | whether to scan everything not already scanned (regardless of whether the user normally doesn't want a folder scanned.) Defaults to false. |
void KODI::VIDEO::CVideoInfoScanner::Stop | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |