Skip to content

Commit

Permalink
remove FileItem.h header requirement from VideoInfoScanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Oct 15, 2012
1 parent ec98f87 commit 8144ce0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
52 changes: 26 additions & 26 deletions xbmc/video/VideoInfoScanner.cpp
Expand Up @@ -414,11 +414,11 @@ namespace VIDEO

INFO_RET ret = INFO_CANCELLED;
if (info2->Content() == CONTENT_TVSHOWS)
ret = RetrieveInfoForTvShow(pItem, bDirNames, info2, useLocal, pURL, fetchEpisodes, pDlgProgress);
ret = RetrieveInfoForTvShow(pItem.get(), bDirNames, info2, useLocal, pURL, fetchEpisodes, pDlgProgress);
else if (info2->Content() == CONTENT_MOVIES)
ret = RetrieveInfoForMovie(pItem, bDirNames, info2, useLocal, pURL, pDlgProgress);
ret = RetrieveInfoForMovie(pItem.get(), bDirNames, info2, useLocal, pURL, pDlgProgress);
else if (info2->Content() == CONTENT_MUSICVIDEOS)
ret = RetrieveInfoForMusicVideo(pItem, bDirNames, info2, useLocal, pURL, pDlgProgress);
ret = RetrieveInfoForMusicVideo(pItem.get(), bDirNames, info2, useLocal, pURL, pDlgProgress);
else
{
CLog::Log(LOGERROR, "VideoInfoScanner: Unknown content type %d (%s)", info2->Content(), pItem->GetPath().c_str());
Expand Down Expand Up @@ -458,7 +458,7 @@ namespace VIDEO
return FoundSomeInfo;
}

INFO_RET CVideoInfoScanner::RetrieveInfoForTvShow(CFileItemPtr pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, bool fetchEpisodes, CGUIDialogProgress* pDlgProgress)
INFO_RET CVideoInfoScanner::RetrieveInfoForTvShow(CFileItem *pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, bool fetchEpisodes, CGUIDialogProgress* pDlgProgress)
{
long idTvShow = -1;
if (pItem->m_bIsFolder)
Expand All @@ -484,7 +484,7 @@ namespace VIDEO
CScraperUrl scrUrl;
// handle .nfo files
if (useLocal)
result = CheckForNFOFile(pItem.get(), bDirNames, info2, scrUrl);
result = CheckForNFOFile(pItem, bDirNames, info2, scrUrl);
if (result != CNfoFile::NO_NFO && result != CNfoFile::ERROR_NFO)
{ // check for preconfigured scraper; if found, overwrite with interpreted scraper (from Nfofile)
// but keep current scan settings
Expand All @@ -497,7 +497,7 @@ namespace VIDEO
pItem->GetVideoInfoTag()->Reset();
m_nfoReader.GetDetails(*pItem->GetVideoInfoTag());

long lResult = AddVideo(pItem.get(), info2->Content(), bDirNames, useLocal);
long lResult = AddVideo(pItem, info2->Content(), bDirNames, useLocal);
if (lResult < 0)
return INFO_ERROR;
if (fetchEpisodes)
Expand All @@ -520,9 +520,9 @@ namespace VIDEO
return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;

long lResult=-1;
if (GetDetails(pItem.get(), url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
if (GetDetails(pItem, url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
{
if ((lResult = AddVideo(pItem.get(), info2->Content(), false, useLocal)) < 0)
if ((lResult = AddVideo(pItem, info2->Content(), false, useLocal)) < 0)
return INFO_ERROR;
}
if (fetchEpisodes)
Expand All @@ -534,7 +534,7 @@ namespace VIDEO
return INFO_ADDED;
}

INFO_RET CVideoInfoScanner::RetrieveInfoForMovie(CFileItemPtr pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress)
INFO_RET CVideoInfoScanner::RetrieveInfoForMovie(CFileItem *pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress)
{
if (pItem->m_bIsFolder || !pItem->IsVideo() || pItem->IsNFO() ||
(pItem->IsPlayList() && !URIUtils::GetExtension(pItem->GetPath()).Equals(".strm")))
Expand All @@ -550,13 +550,13 @@ namespace VIDEO
CScraperUrl scrUrl;
// handle .nfo files
if (useLocal)
result = CheckForNFOFile(pItem.get(), bDirNames, info2, scrUrl);
result = CheckForNFOFile(pItem, bDirNames, info2, scrUrl);
if (result == CNfoFile::FULL_NFO)
{
pItem->GetVideoInfoTag()->Reset();
m_nfoReader.GetDetails(*pItem->GetVideoInfoTag());

if (AddVideo(pItem.get(), info2->Content(), bDirNames, true) < 0)
if (AddVideo(pItem, info2->Content(), bDirNames, true) < 0)
return INFO_ERROR;
return INFO_ADDED;
}
Expand All @@ -570,17 +570,17 @@ namespace VIDEO
else if ((retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress)) <= 0)
return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;

if (GetDetails(pItem.get(), url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
if (GetDetails(pItem, url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
{
if (AddVideo(pItem.get(), info2->Content(), bDirNames, useLocal) < 0)
if (AddVideo(pItem, info2->Content(), bDirNames, useLocal) < 0)
return INFO_ERROR;
return INFO_ADDED;
}
// TODO: This is not strictly correct as we could fail to download information here or error, or be cancelled
return INFO_NOT_FOUND;
}

INFO_RET CVideoInfoScanner::RetrieveInfoForMusicVideo(CFileItemPtr pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress)
INFO_RET CVideoInfoScanner::RetrieveInfoForMusicVideo(CFileItem *pItem, bool bDirNames, ScraperPtr &info2, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress)
{
if (pItem->m_bIsFolder || !pItem->IsVideo() || pItem->IsNFO() ||
(pItem->IsPlayList() && !URIUtils::GetExtension(pItem->GetPath()).Equals(".strm")))
Expand All @@ -596,13 +596,13 @@ namespace VIDEO
CScraperUrl scrUrl;
// handle .nfo files
if (useLocal)
result = CheckForNFOFile(pItem.get(), bDirNames, info2, scrUrl);
result = CheckForNFOFile(pItem, bDirNames, info2, scrUrl);
if (result == CNfoFile::FULL_NFO)
{
pItem->GetVideoInfoTag()->Reset();
m_nfoReader.GetDetails(*pItem->GetVideoInfoTag());

if (AddVideo(pItem.get(), info2->Content(), bDirNames, true) < 0)
if (AddVideo(pItem, info2->Content(), bDirNames, true) < 0)
return INFO_ERROR;
return INFO_ADDED;
}
Expand All @@ -616,21 +616,21 @@ namespace VIDEO
else if ((retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress)) <= 0)
return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;

if (GetDetails(pItem.get(), url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
if (GetDetails(pItem, url, info2, result == CNfoFile::COMBINED_NFO ? &m_nfoReader : NULL, pDlgProgress))
{
if (AddVideo(pItem.get(), info2->Content(), bDirNames, useLocal) < 0)
if (AddVideo(pItem, info2->Content(), bDirNames, useLocal) < 0)
return INFO_ERROR;
return INFO_ADDED;
}
// TODO: This is not strictly correct as we could fail to download information here or error, or be cancelled
return INFO_NOT_FOUND;
}

INFO_RET CVideoInfoScanner::RetrieveInfoForEpisodes(CFileItemPtr item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress)
INFO_RET CVideoInfoScanner::RetrieveInfoForEpisodes(CFileItem *item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress)
{
// enumerate episodes
EPISODELIST files;
EnumerateSeriesFolder(item.get(), files);
EnumerateSeriesFolder(item, files);
if (files.size() == 0) // no update or no files
return INFO_NOT_NEEDED;

Expand Down Expand Up @@ -749,10 +749,10 @@ namespace VIDEO
* the VideoInfoTag. If it has, do not try to parse any of them from the file path to avoid
* any false positive matches.
*/
if (ProcessItemByVideoInfoTag(items[i], episodeList))
if (ProcessItemByVideoInfoTag(items[i].get(), episodeList))
continue;

if (!EnumerateEpisodeItem(items[i], episodeList))
if (!EnumerateEpisodeItem(items[i].get(), episodeList))
{
CStdString decode(items[i]->GetPath());
CURL::Decode(decode);
Expand All @@ -761,12 +761,12 @@ namespace VIDEO
}
}

bool CVideoInfoScanner::ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODELIST &episodeList)
bool CVideoInfoScanner::ProcessItemByVideoInfoTag(const CFileItem *item, EPISODELIST &episodeList)
{
if (!item->HasVideoInfoTag())
return false;

CVideoInfoTag* tag = item->GetVideoInfoTag();
const CVideoInfoTag* tag = item->GetVideoInfoTag();
/*
* First check the season and episode number. This takes precedence over the original air
* date and episode title. Must be a valid season and episode number combination.
Expand Down Expand Up @@ -846,7 +846,7 @@ namespace VIDEO
return false;
}

bool CVideoInfoScanner::EnumerateEpisodeItem(const CFileItemPtr item, EPISODELIST& episodeList)
bool CVideoInfoScanner::EnumerateEpisodeItem(const CFileItem *item, EPISODELIST& episodeList)
{
SETTINGS_TVSHOWLIST expression = g_advancedSettings.m_tvshowEnumRegExps;

Expand Down Expand Up @@ -1234,7 +1234,7 @@ namespace VIDEO
if (fanart.empty() && useLocal)
fanart = pItem->FindLocalArt("fanart.jpg", true);
if (fanart.empty())
fanart = movieDetails.m_fanart.GetImageURL();
fanart = pItem->GetVideoInfoTag()->m_fanart.GetImageURL();
return fanart;
}

Expand Down
14 changes: 8 additions & 6 deletions xbmc/video/VideoInfoScanner.h
Expand Up @@ -24,6 +24,8 @@
#include "NfoFile.h"

class CRegExp;
class CFileItem;
class CFileItemList;

namespace VIDEO
{
Expand Down Expand Up @@ -114,10 +116,10 @@ namespace VIDEO
virtual void Process();
bool DoScan(const CStdString& strDirectory);

INFO_RET RetrieveInfoForTvShow(CFileItemPtr pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, bool fetchEpisodes, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForMovie(CFileItemPtr pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForMusicVideo(CFileItemPtr pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForEpisodes(CFileItemPtr item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress = NULL);
INFO_RET RetrieveInfoForTvShow(CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, bool fetchEpisodes, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForMovie(CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForMusicVideo(CFileItem *pItem, bool bDirNames, ADDON::ScraperPtr &scraper, bool useLocal, CScraperUrl* pURL, CGUIDialogProgress* pDlgProgress);
INFO_RET RetrieveInfoForEpisodes(CFileItem *item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress = NULL);

/*! \brief Update the progress bar with the heading and line and check for cancellation
\param progress CGUIDialogProgress bar
Expand Down Expand Up @@ -203,8 +205,8 @@ namespace VIDEO
INFO_RET OnProcessSeriesFolder(EPISODELIST& files, const ADDON::ScraperPtr &scraper, bool useLocal, const CVideoInfoTag& showInfo, CGUIDialogProgress* pDlgProgress = NULL);

void EnumerateSeriesFolder(CFileItem* item, EPISODELIST& episodeList);
bool EnumerateEpisodeItem(const CFileItemPtr item, EPISODELIST& episodeList);
bool ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODELIST &episodeList);
bool EnumerateEpisodeItem(const CFileItem *item, EPISODELIST& episodeList);
bool ProcessItemByVideoInfoTag(const CFileItem *item, EPISODELIST &episodeList);

CStdString GetnfoFile(CFileItem *item, bool bGrabAny=false) const;

Expand Down

1 comment on commit 8144ce0

@jmarshallnz
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only that it broke if I pulled out a random header somewhere ;) I doubt it's too bad actually, as VideoInfoScanner.h is only about 12 files.

Please sign in to comment.