Kodi Documentation 23.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
TestVideoInfoScanner.cpp File Reference
#include "FileItem.h"
#include "FileItemList.h"
#include "MediaSource.h"
#include "ServiceBroker.h"
#include "TextureCache.h"
#include "addons/AddonManager.h"
#include "addons/AddonVersion.h"
#include "addons/IAddon.h"
#include "addons/Scraper.h"
#include "addons/addoninfo/AddonInfo.h"
#include "addons/addoninfo/AddonInfoBuilder.h"
#include "addons/addoninfo/AddonType.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "interfaces/AnnouncementManager.h"
#include "jobs/JobManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/URIUtils.h"
#include "video/SetInfoTag.h"
#include "video/VideoDatabase.h"
#include "video/VideoInfoScanner.h"
#include "video/VideoManagerTypes.h"
#include "video/jobs/VideoLibraryScanningJob.h"
#include <chrono>
#include <filesystem>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <gtest/gtest.h>

Functions

void TearDown () override
 
void Scan (bool ignoreVideoExtras=false, bool clean=false, const std::string &path={})
 
void UseTestScraper (ADDON::AddonType type)
 
void InstallOtherScraper ()
 
bool IsExtraOf (const std::string &path, int idMovie)
 
int CountExtras ()
 
int CountMovies ()
 
void ScanChangesBelowTheExtras (bool disc=false)
 
 TEST_F (TestVideoInfoScanner, ABlurayRipOfADatedEpisodeIsOneEpisode)
 
 TEST_F (TestVideoInfoScanner, AddingASetLeavesTheDatabaseAsItWas)
 
 TEST_F (TestVideoInfoScanner, ACancelledScanDoesNotHideTheSameScanAskedForAgain)
 
 TEST_F (TestVideoInfoScanner, AMovieIsAddedFromItsNfo)
 
 TEST_F (TestVideoInfoScanner, AMovieAddedToAScannedFolderIsFound)
 
 TEST_F (TestVideoInfoScanner, AnUnchangedFolderAddsNothingAgain)
 
 TEST_F (TestVideoInfoScanner, AMovieDeletedIsCleanedOnUpdate)
 
 TEST_F (TestVideoInfoScanner, AFileStackIsOneMovie)
 
 TEST_F (TestVideoInfoScanner, AFolderStackIsOneMovie)
 
 TEST_F (TestVideoInfoScanner, ABlurayFolderRipIsOneMovie)
 
 TEST_F (TestVideoInfoScanner, ADvdFolderRipIsOneMovie)
 
 TEST_F (TestVideoInfoScanner, AFolderHoldingANomediaFileIsSkipped)
 
 TEST_F (TestVideoInfoScanner, ATrailerIsTheMoviesTrailerNotAMovie)
 
 TEST_F (TestVideoInfoScanner, ASampleIsNotAMovie)
 
 TEST_F (TestVideoInfoScanner, AMovieIsAddedToTheSetItsNfoNames)
 
 TEST_F (TestVideoInfoScanner, AnEditionInTheFileNameNamesTheMoviesVersion)
 
 TEST_F (TestVideoInfoScanner, AMovieIsAddedFromTheScraper)
 
 TEST_F (TestVideoInfoScanner, AFailedSearchDoesNotStopTheScan)
 
 TEST_F (TestVideoInfoScanner, AnUnchangedFolderIsLookedUpAgainAfterASearchFailed)
 
 TEST_F (TestVideoInfoScanner, AnUnchangedFolderIsLookedUpAgainAfterDetailsFailed)
 
 TEST_F (TestVideoInfoScanner, AMovieIsLookedUpWithItsPathsScraperWhenItsNfoNamesAnother)
 
 TEST_F (TestVideoInfoScanner, AMovieFolderGetsItsExtras)
 
 TEST_F (TestVideoInfoScanner, ExtrasBesideTwoMoviesGoToNeither)
 
 TEST_F (TestVideoInfoScanner, TheExtrasOfAStackGoToItsMovie)
 
 TEST_F (TestVideoInfoScanner, ExtrasBesideTheFolderOfTheirMovieGoToIt)
 
 TEST_F (TestVideoInfoScanner, AnExtrasFolderIsNotScannedForMovies)
 
 TEST_F (TestVideoInfoScanner, IgnoredExtrasAreNeitherExtrasNorMovies)
 
 TEST_F (TestVideoInfoScanner, AVideoAddedToTheExtrasOfAnUnchangedFolderIsAdded)
 
 TEST_F (TestVideoInfoScanner, AnExtraDeletedIsCleanedOnUpdate)
 
 TEST_F (TestVideoInfoScanner, AnExtraDeletedIsCleanedByAScanOfItsMovieFolder)
 
 TEST_F (TestVideoInfoScanner, ExtrasAreAddedWithFastHashingOff)
 
 TEST_F (TestVideoInfoScanner, AVideoAddedOrDeletedBelowTheExtrasOfAnUnchangedFolderIsSeen)
 
 TEST_F (TestVideoInfoScanner, AVideoAddedOrDeletedBelowTheExtrasIsSeenWithFastHashingOff)
 
 TEST_F (TestVideoInfoScanner, AnExtrasFolderThatIsASourceIsScannedForMovies)
 
 TEST_F (TestVideoInfoScanner, ARefreshOfAMovieWithAnExportedNfoAddsItsExtras)
 
 TEST_F (TestVideoInfoScannerTvShows, AShowIsAddedWithItsEpisodes)
 
 TEST_F (TestVideoInfoScannerTvShows, AnEpisodeWithoutAnNfoIsNotAdded)
 
 TEST_F (TestVideoInfoScannerTvShows, AnEpisodeAddedToAScannedSeasonIsFound)
 
 TEST_F (TestVideoInfoScannerTvShows, AnUnchangedShowAddsNothingAgain)
 
 TEST_F (TestVideoInfoScannerTvShows, AFileOfTwoEpisodesIsTwoEpisodes)
 
 TEST_F (TestVideoInfoScannerTvShows, ASpecialIsInSeasonZero)
 
 TEST_F (TestVideoInfoScannerTvShows, ABlurayRipInAShowIsOneEpisode)
 
 TEST_F (TestVideoInfoScannerTvShows, AShowsCastHaveTheThumbsInItsActorsFolder)
 
 TEST_F (TestVideoInfoScannerTvShows, AShowWhoseDetailsFailedIsLookedUpAgain)
 
 TEST_F (TestVideoInfoScannerTvShows, AnEpisodeWithAnNfoIsAddedWhenTheEpisodeGuideFails)
 
 TEST_F (TestVideoInfoScannerTvShows, AnEpisodeWhoseDetailsFailedIsLookedUpAgain)
 
 TEST_F (TestVideoInfoScannerTvShows, AnExistingShowKeepsItsScraperWhenItsNfoNamesAnother)
 

Variables

std::string m_root
 
DatabaseSettings m_settings
 
CVideoDatabase m_db
 
std::shared_ptr< ANNOUNCEMENT::CAnnouncementManager > m_previousAnnouncementManager
 
const bool m_fastHash
 
const bool m_ignoreErrors
 
ADDON::AddonInfoPtr m_scraperInfo
 
ADDON::AddonType m_scraperType {ADDON::AddonType::SCRAPER_MOVIES}
 
bool m_eventLog {false}
 
std::string m_otherScraper
 

Function Documentation

◆ CountExtras()

int CountExtras ( )

◆ CountMovies()

int CountMovies ( )

◆ InstallOtherScraper()

void InstallOtherScraper ( )

Installs the other scraper. Neither scraper can fetch the url it recognises, nor does the other one find an episode guide.

◆ IsExtraOf()

bool IsExtraOf ( const std::string & path,
int idMovie )

◆ Scan()

void Scan ( bool ignoreVideoExtras = false,
bool clean = false,
const std::string & path = {} )

◆ ScanChangesBelowTheExtras()

void ScanChangesBelowTheExtras ( bool disc = false)

A file added or deleted below an extras folder changes only the folder holding it. The movie is a file in its folder, or a disc structure the folder holds.

◆ TearDown()

void TearDown ( )
override

◆ TEST_F() [1/47]

TEST_F ( TestVideoInfoScanner ,
ABlurayFolderRipIsOneMovie  )

◆ TEST_F() [2/47]

TEST_F ( TestVideoInfoScanner ,
ABlurayRipOfADatedEpisodeIsOneEpisode  )

◆ TEST_F() [3/47]

TEST_F ( TestVideoInfoScanner ,
ACancelledScanDoesNotHideTheSameScanAskedForAgain  )

◆ TEST_F() [4/47]

TEST_F ( TestVideoInfoScanner ,
AddingASetLeavesTheDatabaseAsItWas  )

◆ TEST_F() [5/47]

TEST_F ( TestVideoInfoScanner ,
ADvdFolderRipIsOneMovie  )

◆ TEST_F() [6/47]

TEST_F ( TestVideoInfoScanner ,
AFailedSearchDoesNotStopTheScan  )

◆ TEST_F() [7/47]

TEST_F ( TestVideoInfoScanner ,
AFileStackIsOneMovie  )

◆ TEST_F() [8/47]

TEST_F ( TestVideoInfoScanner ,
AFolderHoldingANomediaFileIsSkipped  )

◆ TEST_F() [9/47]

TEST_F ( TestVideoInfoScanner ,
AFolderStackIsOneMovie  )

◆ TEST_F() [10/47]

TEST_F ( TestVideoInfoScanner ,
AMovieAddedToAScannedFolderIsFound  )

◆ TEST_F() [11/47]

TEST_F ( TestVideoInfoScanner ,
AMovieDeletedIsCleanedOnUpdate  )

◆ TEST_F() [12/47]

TEST_F ( TestVideoInfoScanner ,
AMovieFolderGetsItsExtras  )

◆ TEST_F() [13/47]

TEST_F ( TestVideoInfoScanner ,
AMovieIsAddedFromItsNfo  )

◆ TEST_F() [14/47]

TEST_F ( TestVideoInfoScanner ,
AMovieIsAddedFromTheScraper  )

◆ TEST_F() [15/47]

TEST_F ( TestVideoInfoScanner ,
AMovieIsAddedToTheSetItsNfoNames  )

◆ TEST_F() [16/47]

TEST_F ( TestVideoInfoScanner ,
AMovieIsLookedUpWithItsPathsScraperWhenItsNfoNamesAnother  )

◆ TEST_F() [17/47]

TEST_F ( TestVideoInfoScanner ,
AnEditionInTheFileNameNamesTheMoviesVersion  )

◆ TEST_F() [18/47]

TEST_F ( TestVideoInfoScanner ,
AnExtraDeletedIsCleanedByAScanOfItsMovieFolder  )

◆ TEST_F() [19/47]

TEST_F ( TestVideoInfoScanner ,
AnExtraDeletedIsCleanedOnUpdate  )

◆ TEST_F() [20/47]

TEST_F ( TestVideoInfoScanner ,
AnExtrasFolderIsNotScannedForMovies  )

◆ TEST_F() [21/47]

TEST_F ( TestVideoInfoScanner ,
AnExtrasFolderThatIsASourceIsScannedForMovies  )

◆ TEST_F() [22/47]

TEST_F ( TestVideoInfoScanner ,
AnUnchangedFolderAddsNothingAgain  )

◆ TEST_F() [23/47]

TEST_F ( TestVideoInfoScanner ,
AnUnchangedFolderIsLookedUpAgainAfterASearchFailed  )

◆ TEST_F() [24/47]

TEST_F ( TestVideoInfoScanner ,
AnUnchangedFolderIsLookedUpAgainAfterDetailsFailed  )

◆ TEST_F() [25/47]

TEST_F ( TestVideoInfoScanner ,
ARefreshOfAMovieWithAnExportedNfoAddsItsExtras  )

◆ TEST_F() [26/47]

TEST_F ( TestVideoInfoScanner ,
ASampleIsNotAMovie  )

◆ TEST_F() [27/47]

TEST_F ( TestVideoInfoScanner ,
ATrailerIsTheMoviesTrailerNotAMovie  )

◆ TEST_F() [28/47]

TEST_F ( TestVideoInfoScanner ,
AVideoAddedOrDeletedBelowTheExtrasIsSeenWithFastHashingOff  )

◆ TEST_F() [29/47]

TEST_F ( TestVideoInfoScanner ,
AVideoAddedOrDeletedBelowTheExtrasOfAnUnchangedFolderIsSeen  )

◆ TEST_F() [30/47]

TEST_F ( TestVideoInfoScanner ,
AVideoAddedToTheExtrasOfAnUnchangedFolderIsAdded  )

◆ TEST_F() [31/47]

TEST_F ( TestVideoInfoScanner ,
ExtrasAreAddedWithFastHashingOff  )

◆ TEST_F() [32/47]

TEST_F ( TestVideoInfoScanner ,
ExtrasBesideTheFolderOfTheirMovieGoToIt  )

◆ TEST_F() [33/47]

TEST_F ( TestVideoInfoScanner ,
ExtrasBesideTwoMoviesGoToNeither  )

◆ TEST_F() [34/47]

TEST_F ( TestVideoInfoScanner ,
IgnoredExtrasAreNeitherExtrasNorMovies  )

◆ TEST_F() [35/47]

TEST_F ( TestVideoInfoScanner ,
TheExtrasOfAStackGoToItsMovie  )

◆ TEST_F() [36/47]

TEST_F ( TestVideoInfoScannerTvShows ,
ABlurayRipInAShowIsOneEpisode  )

◆ TEST_F() [37/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AFileOfTwoEpisodesIsTwoEpisodes  )

◆ TEST_F() [38/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnEpisodeAddedToAScannedSeasonIsFound  )

◆ TEST_F() [39/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnEpisodeWhoseDetailsFailedIsLookedUpAgain  )

◆ TEST_F() [40/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnEpisodeWithAnNfoIsAddedWhenTheEpisodeGuideFails  )

◆ TEST_F() [41/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnEpisodeWithoutAnNfoIsNotAdded  )

◆ TEST_F() [42/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnExistingShowKeepsItsScraperWhenItsNfoNamesAnother  )

◆ TEST_F() [43/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AnUnchangedShowAddsNothingAgain  )

◆ TEST_F() [44/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AShowIsAddedWithItsEpisodes  )

◆ TEST_F() [45/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AShowsCastHaveTheThumbsInItsActorsFolder  )

◆ TEST_F() [46/47]

TEST_F ( TestVideoInfoScannerTvShows ,
AShowWhoseDetailsFailedIsLookedUpAgain  )

◆ TEST_F() [47/47]

TEST_F ( TestVideoInfoScannerTvShows ,
ASpecialIsInSeasonZero  )

◆ UseTestScraper()

void UseTestScraper ( ADDON::AddonType type)

Looks the source's videos up with the test scraper, rather than reading them only from their nfos. A failed lookup is passed over, as it would otherwise ask whether to carry on.

Variable Documentation

◆ m_db

◆ m_eventLog

bool m_eventLog {false}

◆ m_fastHash

const bool m_fastHash
Initial value:
{
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bVideoLibraryUseFastHash}
static std::shared_ptr< CSettingsComponent > GetSettingsComponent()
Definition ServiceBroker.cpp:167

◆ m_ignoreErrors

const bool m_ignoreErrors
Initial value:
{
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bVideoScannerIgnoreErrors}

◆ m_otherScraper

std::string m_otherScraper

◆ m_previousAnnouncementManager

std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_previousAnnouncementManager

◆ m_root

std::string m_root

◆ m_scraperInfo

ADDON::AddonInfoPtr m_scraperInfo

◆ m_scraperType

◆ m_settings

DatabaseSettings m_settings