Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove struct SEpisode

This removes struct SEpisode as it is more or less dupe code with struct
EPISODE.  EPISODE has wider reach, so SEpisode dies. Instances of
SEpisode were replaced with EPISODE and their vector equivalents,
EPISODES and EPISODELIST respectively, app wide.
  • Loading branch information...
commit cfd805f44a46e8382518be8e732b2d1476622082 1 parent f674404
t-nelson authored
1  xbmc/addons/Scraper.cpp
View
@@ -46,6 +46,7 @@
using namespace std;
using namespace XFILE;
using namespace MUSIC_GRABBER;
+using namespace VIDEO;
namespace ADDON
{
2  xbmc/addons/Scraper.h
View
@@ -126,7 +126,7 @@ class CScraper : public CAddon
const CStdString &sAlbum, const CStdString &sArtist = "");
std::vector<MUSIC_GRABBER::CMusicArtistInfo> FindArtist(
XFILE::CCurlFile &fcurl, const CStdString &sArtist);
- EPISODELIST GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl);
+ VIDEO::EPISODELIST GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl);
bool GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl,
bool fMovie/*else episode*/, CVideoInfoTag &video);
10 xbmc/video/Episode.h
View
@@ -1,19 +1,26 @@
#pragma once
#include "utils/ScraperUrl.h"
+#include "XBDateTime.h"
// single episode information
+namespace VIDEO
+{
struct EPISODE
{
+ bool isFolder;
int iSeason;
int iEpisode;
int iSubepisode;
+ std::string strPath;
+ std::string strTitle;
CDateTime cDate;
CScraperUrl cScraperUrl;
- EPISODE(int Season = -1, int Episode = -1, int Subepisode = 0)
+ EPISODE(int Season = -1, int Episode = -1, int Subepisode = 0, bool Folder = false)
{
iSeason = Season;
iEpisode = Episode;
iSubepisode = Subepisode;
+ isFolder = Folder;
}
bool operator==(const struct EPISODE& rhs)
{
@@ -24,4 +31,5 @@ struct EPISODE
};
typedef std::vector<EPISODE> EPISODELIST;
+}
1  xbmc/video/VideoInfoDownloader.cpp
View
@@ -31,6 +31,7 @@
#include "utils/URIUtils.h"
using namespace std;
+using namespace VIDEO;
#ifndef __GNUC__
#pragma warning (disable:4018)
4 xbmc/video/VideoInfoDownloader.h
View
@@ -55,7 +55,7 @@ class CVideoInfoDownloader : public CThread
int FindMovie(const CStdString& strMovie, MOVIELIST& movielist, CGUIDialogProgress *pProgress = NULL);
bool GetDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL);
bool GetEpisodeDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL);
- bool GetEpisodeList(const CScraperUrl& url, EPISODELIST& details, CGUIDialogProgress *pProgress = NULL);
+ bool GetEpisodeList(const CScraperUrl& url, VIDEO::EPISODELIST& details, CGUIDialogProgress *pProgress = NULL);
static void ShowErrorDialog(const ADDON::CScraperError &sce);
@@ -71,7 +71,7 @@ class CVideoInfoDownloader : public CThread
MOVIELIST m_movieList;
CVideoInfoTag m_movieDetails;
CScraperUrl m_url;
- EPISODELIST m_episode;
+ VIDEO::EPISODELIST m_episode;
LOOKUP_STATE m_state;
int m_found;
ADDON::ScraperPtr m_info;
38 xbmc/video/VideoInfoScanner.cpp
View
@@ -611,7 +611,7 @@ namespace VIDEO
INFO_RET CVideoInfoScanner::RetrieveInfoForEpisodes(CFileItemPtr item, long showID, const ADDON::ScraperPtr &scraper, bool useLocal, CGUIDialogProgress *progress)
{
// enumerate episodes
- EPISODES files;
+ EPISODELIST files;
EnumerateSeriesFolder(item.get(), files);
if (files.size() == 0) // no update or no files
return INFO_NOT_NEEDED;
@@ -626,7 +626,7 @@ namespace VIDEO
return OnProcessSeriesFolder(files, scraper, useLocal, showID, showTitle, progress);
}
- void CVideoInfoScanner::EnumerateSeriesFolder(CFileItem* item, EPISODES& episodeList)
+ void CVideoInfoScanner::EnumerateSeriesFolder(CFileItem* item, EPISODELIST& episodeList)
{
CFileItemList items;
@@ -744,7 +744,7 @@ namespace VIDEO
}
}
- bool CVideoInfoScanner::ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODES &episodeList)
+ bool CVideoInfoScanner::ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODELIST &episodeList)
{
if (!item->HasVideoInfoTag())
return false;
@@ -756,7 +756,7 @@ namespace VIDEO
*/
if (tag->m_iSeason > -1 && tag->m_iEpisode > 0)
{
- SEpisode episode = {};
+ EPISODE episode;
episode.strPath = item->GetPath();
episode.iSeason = tag->m_iSeason;
episode.iEpisode = tag->m_iEpisode;
@@ -773,7 +773,7 @@ namespace VIDEO
*/
if (tag->m_firstAired.IsValid())
{
- SEpisode episode = {};
+ EPISODE episode;
episode.strPath = item->GetPath();
episode.strTitle = tag->m_strTitle;
episode.isFolder = false;
@@ -799,7 +799,7 @@ namespace VIDEO
*/
if (!tag->m_strTitle.IsEmpty())
{
- SEpisode episode = {};
+ EPISODE episode;
episode.strPath = item->GetPath();
episode.strTitle = tag->m_strTitle;
episode.isFolder = false;
@@ -829,7 +829,7 @@ namespace VIDEO
return false;
}
- bool CVideoInfoScanner::EnumerateEpisodeItem(const CFileItemPtr item, EPISODES& episodeList)
+ bool CVideoInfoScanner::EnumerateEpisodeItem(const CFileItemPtr item, EPISODELIST& episodeList)
{
SETTINGS_TVSHOWLIST expression = g_advancedSettings.m_tvshowEnumRegExps;
@@ -849,7 +849,7 @@ namespace VIDEO
if ((regexppos = reg.RegFind(strLabel.c_str())) < 0)
continue;
- SEpisode episode = {};
+ EPISODE episode;
episode.strPath = item->GetPath();
episode.iSeason = -1;
episode.iEpisode = -1;
@@ -891,7 +891,7 @@ namespace VIDEO
if (reg.RegFind(strBasePath.c_str()) > -1)
{
- SEpisode parent = {};
+ EPISODE parent;
if (byDate)
{
GetAirDateFromRegExp(reg, parent);
@@ -951,7 +951,7 @@ namespace VIDEO
return false;
}
- bool CVideoInfoScanner::GetEpisodeAndSeasonFromRegExp(CRegExp &reg, SEpisode &episodeInfo, int defaultSeason)
+ bool CVideoInfoScanner::GetEpisodeAndSeasonFromRegExp(CRegExp &reg, EPISODE &episodeInfo, int defaultSeason)
{
char* season = reg.GetReplaceString("\\1");
char* episode = reg.GetReplaceString("\\2");
@@ -989,7 +989,7 @@ namespace VIDEO
return (season && episode);
}
- bool CVideoInfoScanner::GetAirDateFromRegExp(CRegExp &reg, SEpisode &episodeInfo)
+ bool CVideoInfoScanner::GetAirDateFromRegExp(CRegExp &reg, EPISODE &episodeInfo)
{
char* param1 = reg.GetReplaceString("\\1");
char* param2 = reg.GetReplaceString("\\2");
@@ -1199,7 +1199,7 @@ namespace VIDEO
ApplyThumbToFolder(parentDir, thumb);
}
- INFO_RET CVideoInfoScanner::OnProcessSeriesFolder(EPISODES& files, const ADDON::ScraperPtr &scraper, bool useLocal, int idShow, const CStdString& strShowTitle, CGUIDialogProgress* pDlgProgress /* = NULL */)
+ INFO_RET CVideoInfoScanner::OnProcessSeriesFolder(EPISODELIST& files, const ADDON::ScraperPtr &scraper, bool useLocal, int idShow, const CStdString& strShowTitle, CGUIDialogProgress* pDlgProgress /* = NULL */)
{
if (pDlgProgress)
{
@@ -1215,7 +1215,7 @@ namespace VIDEO
int iMax = files.size();
int iCurr = 1;
- for (EPISODES::iterator file = files.begin(); file != files.end(); ++file)
+ for (EPISODELIST::iterator file = files.begin(); file != files.end(); ++file)
{
m_nfoReader.Close();
if (pDlgProgress)
@@ -1290,7 +1290,7 @@ namespace VIDEO
continue;
}
- struct EPISODE key(file->iSeason, file->iEpisode, file->iSubepisode);
+ EPISODE key(file->iSeason, file->iEpisode, file->iSubepisode);
bool bFound = false;
EPISODELIST::iterator guide = episodes.begin();;
EPISODELIST matches;
@@ -1307,7 +1307,7 @@ namespace VIDEO
matches.push_back(*guide);
continue;
}
- if (!guide->cScraperUrl.strTitle.IsEmpty() && guide->cScraperUrl.strTitle.CompareNoCase(file->strTitle) == 0)
+ if (!guide->cScraperUrl.strTitle.IsEmpty() && guide->cScraperUrl.strTitle.CompareNoCase(file->strTitle.c_str()) == 0)
{
bFound = true;
break;
@@ -1322,12 +1322,12 @@ namespace VIDEO
*
* Otherwise, use the title to further refine the best match.
*/
- if (matches.size() == 1 || (file->strTitle.IsEmpty() && matches.size() > 1))
+ if (matches.size() == 1 || (file->strTitle.empty() && matches.size() > 1))
{
guide = matches.begin();
bFound = true;
}
- else if (!file->strTitle.IsEmpty())
+ else if (!file->strTitle.empty())
{
double minscore = 0; // Default minimum score is 0 to find whatever is the best match.
@@ -1345,7 +1345,9 @@ namespace VIDEO
titles.push_back(guide->cScraperUrl.strTitle.ToLower());
double matchscore;
- int index = StringUtils::FindBestMatch(file->strTitle.ToLower(), titles, matchscore);
+ std::string loweredTitle(file->strTitle);
+ StringUtils::ToLower(loweredTitle);
+ int index = StringUtils::FindBestMatch(loweredTitle, titles, matchscore);
if (matchscore >= minscore)
{
guide = candidates->begin() + index;
26 xbmc/video/VideoInfoScanner.h
View
@@ -22,7 +22,6 @@
#include "VideoDatabase.h"
#include "addons/Scraper.h"
#include "NfoFile.h"
-#include "XBDateTime.h"
class CRegExp;
@@ -38,19 +37,6 @@ namespace VIDEO
bool exclude; /* exclude this path from scraping */
} SScanSettings;
- typedef struct SEpisode
- {
- CStdString strPath;
- CStdString strTitle;
- int iSeason;
- int iEpisode;
- int iSubepisode;
- bool isFolder;
- CDateTime cDate;
- } SEpisode;
-
- typedef std::vector<SEpisode> EPISODES;
-
enum SCAN_STATE { PREPARING = 0, REMOVING_OLD, CLEANING_UP_DATABASE, FETCHING_MOVIE_INFO, FETCHING_MUSICVIDEO_INFO, FETCHING_TVSHOW_INFO, COMPRESSING_DATABASE, WRITING_CHANGES };
class IVideoInfoScannerObserver
@@ -177,14 +163,14 @@ namespace VIDEO
\param defaultSeason Season to use if not found in reg.
\return true on success (2 matches), false on failure (fewer than 2 matches)
*/
- bool GetEpisodeAndSeasonFromRegExp(CRegExp &reg, SEpisode &episodeInfo, int defaultSeason);
+ bool GetEpisodeAndSeasonFromRegExp(CRegExp &reg, EPISODE &episodeInfo, int defaultSeason);
/*! \brief Extract episode air-date from a processed regexp
\param reg Regular expression object with at least 3 matches
\param episodeInfo Episode information to fill in.
\return true on success (3 matches), false on failure (fewer than 3 matches)
*/
- bool GetAirDateFromRegExp(CRegExp &reg, SEpisode &episodeInfo);
+ bool GetAirDateFromRegExp(CRegExp &reg, EPISODE &episodeInfo);
/*! \brief Fetch thumbs for actors
Updates each actor with their thumb (local or online)
@@ -225,11 +211,11 @@ namespace VIDEO
\return INFO_ERROR on failure, INFO_CANCELLED on cancellation,
INFO_NOT_FOUND if an episode isn't found, or INFO_ADDED if all episodes are added.
*/
- INFO_RET OnProcessSeriesFolder(EPISODES& files, const ADDON::ScraperPtr &scraper, bool useLocal, int idShow, const CStdString& strShowTitle, CGUIDialogProgress* pDlgProgress = NULL);
+ INFO_RET OnProcessSeriesFolder(EPISODELIST& files, const ADDON::ScraperPtr &scraper, bool useLocal, int idShow, const CStdString& strShowTitle, CGUIDialogProgress* pDlgProgress = NULL);
- void EnumerateSeriesFolder(CFileItem* item, EPISODES& episodeList);
- bool EnumerateEpisodeItem(const CFileItemPtr item, EPISODES& episodeList);
- bool ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODES &episodeList);
+ void EnumerateSeriesFolder(CFileItem* item, EPISODELIST& episodeList);
+ bool EnumerateEpisodeItem(const CFileItemPtr item, EPISODELIST& episodeList);
+ bool ProcessItemByVideoInfoTag(const CFileItemPtr item, EPISODELIST &episodeList);
CStdString GetnfoFile(CFileItem *item, bool bGrabAny=false) const;
Please sign in to comment.
Something went wrong with that request. Please try again.