Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: xbmc/VideoInfoTag.cpp
- ===================================================================
- --- xbmc/VideoInfoTag.cpp (revision 35107)
- +++ xbmc/VideoInfoTag.cpp (working copy)
- @@ -565,6 +565,7 @@
- bool CVideoInfoTag::IsEmpty() const
- {
- return (m_strTitle.IsEmpty() &&
- + m_strPlot.IsEmpty() &&
- m_strFile.IsEmpty() &&
- m_strPath.IsEmpty());
- }
- Index: xbmc/FileSystem/IDirectory.cpp
- ===================================================================
- --- xbmc/FileSystem/IDirectory.cpp (revision 35107)
- +++ xbmc/FileSystem/IDirectory.cpp (working copy)
- @@ -32,6 +32,7 @@
- m_cacheDirectory = DIR_CACHE_NEVER;
- m_useFileDirectories = false;
- m_extFileInfo = true;
- + m_fileItem = NULL;
- }
- IDirectory::~IDirectory(void)
- @@ -129,3 +130,25 @@
- {
- m_extFileInfo = extFileInfo;
- }
- +
- +CFileItem *IDirectory::GetFileItem(const CStdString& strPath)
- +{
- + if (! m_fileItem)
- + {
- + m_fileItem = new CFileItem(CUtil::GetFileName(strPath));
- + m_fileItem->m_strPath = strPath;
- + m_fileItem->m_bIsFolder = true;
- + }
- + return m_fileItem;
- +}
- +
- +CFileItem *IDirectory::GetFileItem(const CStdString& strPath)
- +{
- + if (! m_fileItem)
- + {
- + m_fileItem = new CFileItem(CUtil::GetFileName(strPath));
- + m_fileItem->m_strPath = strPath;
- + m_fileItem->m_bIsFolder = true;
- + }
- + return m_fileItem;
- +}
- Index: xbmc/FileSystem/Directory.cpp
- ===================================================================
- --- xbmc/FileSystem/Directory.cpp (revision 35107)
- +++ xbmc/FileSystem/Directory.cpp (working copy)
- @@ -319,3 +319,25 @@
- }
- }
- }
- +
- +CFileItem *CDirectory::GetFileItem(const CStdString& strPath)
- +{
- + try
- + {
- + auto_ptr<IDirectory> pDirectory(CFactoryDirectory::Create(strPath));
- + if (pDirectory.get())
- + return pDirectory->GetFileItem(strPath);
- + }
- +#ifndef _LINUX
- + catch (const win32_exception &e)
- + {
- + e.writelog(__FUNCTION__);
- + }
- +#endif
- + catch (...)
- + {
- + CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__);
- + }
- + CLog::Log(LOGERROR, "%s - Error checking for %s", __FUNCTION__, strPath.c_str());
- + return false;
- +}
- Index: xbmc/FileSystem/VideoDatabaseDirectory.cpp
- ===================================================================
- --- xbmc/FileSystem/VideoDatabaseDirectory.cpp (revision 35107)
- +++ xbmc/FileSystem/VideoDatabaseDirectory.cpp (working copy)
- @@ -30,17 +30,19 @@
- #include "Crc32.h"
- #include "LocalizeStrings.h"
- #include "utils/log.h"
- -
- +#include "MythDirectory.h"
- using namespace std;
- using namespace XFILE;
- using namespace VIDEODATABASEDIRECTORY;
- CVideoDatabaseDirectory::CVideoDatabaseDirectory(void)
- {
- + m_myth_directory = new CMythDirectory();
- }
- CVideoDatabaseDirectory::~CVideoDatabaseDirectory(void)
- {
- + delete m_myth_directory;
- }
- bool CVideoDatabaseDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
- @@ -62,9 +64,47 @@
- }
- }
- + CStdString mythPath = VideodbToMyth(strPath);
- + if(mythPath != "") {
- + CFileItemList myth_items;
- + m_myth_directory->GetDirectory(mythPath, myth_items);
- + for (int i=0;i<myth_items.Size();++i)
- + {
- + CFileItemPtr item = myth_items[i];
- + items.Add(item);
- + }
- + }
- return bResult;
- }
- +CStdString CVideoDatabaseDirectory::VideodbToMyth(const CStdString& strPath)
- +{
- + CStdString outStr = "";
- + VECSOURCES *shares = g_settings.GetSourcesFromType("video");
- + if (!shares) return outStr;
- +
- + for (IVECSOURCES it = shares->begin(); it != shares->end(); it++)
- + {
- + CURL url((*it).strPath);
- + CStdString strProtocol = url.GetProtocol();
- + if(strProtocol.Equals("myth")) {
- + outStr = (*it).strPath;
- + break;
- + }
- + }
- + if(outStr == "")
- + return outStr;
- +
- + if(strPath.Equals("videodb://1/2/")) {
- + outStr += "movies/";
- + } else if(strPath.Equals("videodb://2/2/")) {
- + outStr += "tvshows/";
- + } else {
- + outStr = "";
- + }
- + return outStr;
- +}
- +
- NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const CStdString& strPath)
- {
- auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath));
- Index: xbmc/FileSystem/IDirectory.h
- ===================================================================
- --- xbmc/FileSystem/IDirectory.h (revision 35107)
- +++ xbmc/FileSystem/IDirectory.h (working copy)
- @@ -23,6 +23,7 @@
- #include "StdString.h"
- class CFileItemList;
- +class CFileItem;
- namespace XFILE
- {
- @@ -83,6 +84,13 @@
- virtual bool IsAllowed(const CStdString& strFile) const;
- /*!
- + \brief Get a CFileItem reference for this directory
- + \param strPath Path to directory
- + \return Returns a pointer to a CFileItem
- + */
- + virtual CFileItem *GetFileItem(const CStdString& strPath);
- +
- + /*!
- \brief How this directory should be cached
- \param strPath Directory at hand.
- \return Returns the cache type.
- Index: xbmc/FileSystem/MythDirectory.cpp
- ===================================================================
- --- xbmc/FileSystem/MythDirectory.cpp (revision 35107)
- +++ xbmc/FileSystem/MythDirectory.cpp (working copy)
- @@ -394,6 +394,13 @@
- {
- CFileItemPtr item(new CFileItem(path, true));
- item->m_dateTime = GetValue(m_dll->proginfo_rec_start(program));
- + /*
- + * We set videoInfoTag on the directory to indicate that we have info for the contents
- + * in case the scraper can't match the show name
- + */
- + CVideoInfoTag* tag = item->GetVideoInfoTag();
- + tag->m_strPath = path;
- + tag->m_strTitle = title;
- item->SetLabel(title);
- items.Add(item);
- }
- @@ -555,6 +562,12 @@
- return false;
- }
- +bool CMythDirectory::Exists(const char *strPath)
- +{
- + CFileItemList items;
- + return GetDirectory(strPath, items);
- +}
- +
- bool CMythDirectory::IsVisible(const cmyth_proginfo_t program)
- {
- CStdString group = GetValue(m_dll->proginfo_recgroup(program));
- @@ -625,3 +638,26 @@
- CURL url(strPath);
- return url.GetFileName().Left(9) == "channels/";
- }
- +
- +CFileItem *CMythDirectory::GetFileItem(const CStdString& strPath)
- +{
- + CFileItem *item = IDirectory::GetFileItem(strPath);
- + if (item->HasVideoInfoTag())
- + return item;
- +
- + CURL url(strPath);
- + CStdString fileName = url.GetFileName();
- + CUtil::RemoveSlashAtEnd(fileName);
- + if (fileName.Left(8) == "tvshows/")
- + {
- + CStdString show = fileName.substr(8);
- + if (! show.IsEmpty())
- + {
- + CVideoInfoTag* tag = item->GetVideoInfoTag();
- + tag->m_strPath = strPath;
- + tag->m_strTitle = show;
- + }
- + }
- + return item;
- +}
- +
- Index: xbmc/FileSystem/Directory.h
- ===================================================================
- --- xbmc/FileSystem/Directory.h (revision 35107)
- +++ xbmc/FileSystem/Directory.h (working copy)
- @@ -22,6 +22,8 @@
- #include "IDirectory.h"
- +class CFileItem;
- +
- namespace XFILE
- {
- /*!
- @@ -46,6 +48,7 @@
- static bool Create(const CStdString& strPath);
- static bool Exists(const CStdString& strPath);
- static bool Remove(const CStdString& strPath);
- + static CFileItem *GetFileItem(const CStdString& strPath);
- /*! \brief Filter files that act like directories from the list, replacing them with their directory counterparts
- \param items The item list to filter
- Index: xbmc/FileSystem/MythDirectory.h
- ===================================================================
- --- xbmc/FileSystem/MythDirectory.h (revision 35107)
- +++ xbmc/FileSystem/MythDirectory.h (working copy)
- @@ -42,7 +42,9 @@
- virtual ~CMythDirectory();
- virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
- + virtual bool Exists(const char* strPath);
- virtual bool IsAllowed(const CStdString &strFile) const { return true; };
- + virtual CFileItem *GetFileItem(const CStdString& strPath);
- virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
- static bool SupportsFileOperations(const CStdString& strPath);
- Index: xbmc/FileSystem/VideoDatabaseDirectory.h
- ===================================================================
- --- xbmc/FileSystem/VideoDatabaseDirectory.h (revision 35107)
- +++ xbmc/FileSystem/VideoDatabaseDirectory.h (working copy)
- @@ -44,5 +44,7 @@
- static CStdString GetIcon(const CStdString& strDirectory);
- bool ContainsMovies(const CStdString &path);
- static bool CanCache(const CStdString &path);
- + CStdString VideodbToMyth(const CStdString& strPath);
- + IDirectory *m_myth_directory;
- };
- }
- Index: xbmc/screensavers/rsxs-0.9/config.h.in
- ===================================================================
- --- xbmc/screensavers/rsxs-0.9/config.h.in (revision 35107)
- +++ xbmc/screensavers/rsxs-0.9/config.h.in (working copy)
- @@ -486,6 +486,9 @@
- /* Define to the one symbol short name of this package. */
- #undef PACKAGE_TARNAME
- +/* Define to the home page for this package. */
- +#undef PACKAGE_URL
- +
- /* Define to the version of this package. */
- #undef PACKAGE_VERSION
- Index: xbmc/VideoInfoScanner.h
- ===================================================================
- --- xbmc/VideoInfoScanner.h (revision 35107)
- +++ xbmc/VideoInfoScanner.h (working copy)
- @@ -47,6 +47,7 @@
- int iSeason;
- int iEpisode;
- CDateTime cDate;
- + CVideoInfoTag tag;
- } SEpisode;
- typedef std::vector<SEpisode> EPISODES;
- Index: xbmc/VideoInfoScanner.cpp
- ===================================================================
- --- xbmc/VideoInfoScanner.cpp (revision 35107)
- +++ xbmc/VideoInfoScanner.cpp (working copy)
- @@ -272,9 +272,7 @@
- }
- else
- {
- - CFileItemPtr item(new CFileItem(CUtil::GetFileName(strDirectory)));
- - item->m_strPath = strDirectory;
- - item->m_bIsFolder = true;
- + CFileItemPtr item(CDirectory::GetFileItem(strDirectory));
- items.Add(item);
- CUtil::GetParentPath(item->m_strPath, items.m_strPath);
- }
- @@ -530,9 +528,25 @@
- int retVal = 0;
- if (pURL)
- url = *pURL;
- - else if ((retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress)) <= 0)
- - return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;
- -
- + else
- + {
- + retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress);
- + if (retVal == 0 && pItem->m_bIsFolder)
- + { // Check for VideoInfoTag in folder contents. If it is there, fake the show info
- + if (pItem->HasVideoInfoTag() && ! pItem->GetVideoInfoTag()->m_strTitle.IsEmpty()) {
- + printf("Found VideoInfo for '%s': '%s'\n", pItem->m_strPath.c_str(), pItem->GetVideoInfoTag()->m_strTitle.c_str());
- + long lResult;
- + if ((lResult = AddVideo(pItem.get(), info2->Content())) < 0)
- + return INFO_ERROR;
- + INFO_RET ret = RetrieveInfoForEpisodes(pItem, lResult, info2, useLocal, pDlgProgress);
- + if (ret == INFO_ADDED)
- + m_database.SetPathHash(pItem->m_strPath, pItem->GetProperty("hash"));
- + return ret;
- + }
- + }
- + if (retVal <= 0)
- + return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;
- + }
- if (m_pObserver && !url.strTitle.IsEmpty())
- m_pObserver->OnSetTitle(url.strTitle);
- @@ -1133,7 +1147,7 @@
- continue;
- }
- - if (episodes.empty())
- + if (episodes.empty() && file->tag.IsEmpty()) // No hope of getting into the library.
- {
- CLog::Log(LOGERROR, "VideoInfoScanner: Asked to lookup episode %s"
- " online, but we have no episode guide. Check your tvshow.nfo and make"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement