Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.47 KB | None | 0 0
  1. Index: xbmc/VideoInfoTag.cpp
  2. ===================================================================
  3. --- xbmc/VideoInfoTag.cpp (revision 35107)
  4. +++ xbmc/VideoInfoTag.cpp (working copy)
  5. @@ -565,6 +565,7 @@
  6. bool CVideoInfoTag::IsEmpty() const
  7. {
  8. return (m_strTitle.IsEmpty() &&
  9. + m_strPlot.IsEmpty() &&
  10. m_strFile.IsEmpty() &&
  11. m_strPath.IsEmpty());
  12. }
  13. Index: xbmc/FileSystem/IDirectory.cpp
  14. ===================================================================
  15. --- xbmc/FileSystem/IDirectory.cpp (revision 35107)
  16. +++ xbmc/FileSystem/IDirectory.cpp (working copy)
  17. @@ -32,6 +32,7 @@
  18. m_cacheDirectory = DIR_CACHE_NEVER;
  19. m_useFileDirectories = false;
  20. m_extFileInfo = true;
  21. + m_fileItem = NULL;
  22. }
  23.  
  24. IDirectory::~IDirectory(void)
  25. @@ -129,3 +130,25 @@
  26. {
  27. m_extFileInfo = extFileInfo;
  28. }
  29. +
  30. +CFileItem *IDirectory::GetFileItem(const CStdString& strPath)
  31. +{
  32. + if (! m_fileItem)
  33. + {
  34. + m_fileItem = new CFileItem(CUtil::GetFileName(strPath));
  35. + m_fileItem->m_strPath = strPath;
  36. + m_fileItem->m_bIsFolder = true;
  37. + }
  38. + return m_fileItem;
  39. +}
  40. +
  41. +CFileItem *IDirectory::GetFileItem(const CStdString& strPath)
  42. +{
  43. + if (! m_fileItem)
  44. + {
  45. + m_fileItem = new CFileItem(CUtil::GetFileName(strPath));
  46. + m_fileItem->m_strPath = strPath;
  47. + m_fileItem->m_bIsFolder = true;
  48. + }
  49. + return m_fileItem;
  50. +}
  51. Index: xbmc/FileSystem/Directory.cpp
  52. ===================================================================
  53. --- xbmc/FileSystem/Directory.cpp (revision 35107)
  54. +++ xbmc/FileSystem/Directory.cpp (working copy)
  55. @@ -319,3 +319,25 @@
  56. }
  57. }
  58. }
  59. +
  60. +CFileItem *CDirectory::GetFileItem(const CStdString& strPath)
  61. +{
  62. + try
  63. + {
  64. + auto_ptr<IDirectory> pDirectory(CFactoryDirectory::Create(strPath));
  65. + if (pDirectory.get())
  66. + return pDirectory->GetFileItem(strPath);
  67. + }
  68. +#ifndef _LINUX
  69. + catch (const win32_exception &e)
  70. + {
  71. + e.writelog(__FUNCTION__);
  72. + }
  73. +#endif
  74. + catch (...)
  75. + {
  76. + CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__);
  77. + }
  78. + CLog::Log(LOGERROR, "%s - Error checking for %s", __FUNCTION__, strPath.c_str());
  79. + return false;
  80. +}
  81. Index: xbmc/FileSystem/VideoDatabaseDirectory.cpp
  82. ===================================================================
  83. --- xbmc/FileSystem/VideoDatabaseDirectory.cpp (revision 35107)
  84. +++ xbmc/FileSystem/VideoDatabaseDirectory.cpp (working copy)
  85. @@ -30,17 +30,19 @@
  86. #include "Crc32.h"
  87. #include "LocalizeStrings.h"
  88. #include "utils/log.h"
  89. -
  90. +#include "MythDirectory.h"
  91. using namespace std;
  92. using namespace XFILE;
  93. using namespace VIDEODATABASEDIRECTORY;
  94.  
  95. CVideoDatabaseDirectory::CVideoDatabaseDirectory(void)
  96. {
  97. + m_myth_directory = new CMythDirectory();
  98. }
  99.  
  100. CVideoDatabaseDirectory::~CVideoDatabaseDirectory(void)
  101. {
  102. + delete m_myth_directory;
  103. }
  104.  
  105. bool CVideoDatabaseDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
  106. @@ -62,9 +64,47 @@
  107. }
  108. }
  109.  
  110. + CStdString mythPath = VideodbToMyth(strPath);
  111. + if(mythPath != "") {
  112. + CFileItemList myth_items;
  113. + m_myth_directory->GetDirectory(mythPath, myth_items);
  114. + for (int i=0;i<myth_items.Size();++i)
  115. + {
  116. + CFileItemPtr item = myth_items[i];
  117. + items.Add(item);
  118. + }
  119. + }
  120. return bResult;
  121. }
  122.  
  123. +CStdString CVideoDatabaseDirectory::VideodbToMyth(const CStdString& strPath)
  124. +{
  125. + CStdString outStr = "";
  126. + VECSOURCES *shares = g_settings.GetSourcesFromType("video");
  127. + if (!shares) return outStr;
  128. +
  129. + for (IVECSOURCES it = shares->begin(); it != shares->end(); it++)
  130. + {
  131. + CURL url((*it).strPath);
  132. + CStdString strProtocol = url.GetProtocol();
  133. + if(strProtocol.Equals("myth")) {
  134. + outStr = (*it).strPath;
  135. + break;
  136. + }
  137. + }
  138. + if(outStr == "")
  139. + return outStr;
  140. +
  141. + if(strPath.Equals("videodb://1/2/")) {
  142. + outStr += "movies/";
  143. + } else if(strPath.Equals("videodb://2/2/")) {
  144. + outStr += "tvshows/";
  145. + } else {
  146. + outStr = "";
  147. + }
  148. + return outStr;
  149. +}
  150. +
  151. NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const CStdString& strPath)
  152. {
  153. auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath));
  154. Index: xbmc/FileSystem/IDirectory.h
  155. ===================================================================
  156. --- xbmc/FileSystem/IDirectory.h (revision 35107)
  157. +++ xbmc/FileSystem/IDirectory.h (working copy)
  158. @@ -23,6 +23,7 @@
  159. #include "StdString.h"
  160.  
  161. class CFileItemList;
  162. +class CFileItem;
  163.  
  164. namespace XFILE
  165. {
  166. @@ -83,6 +84,13 @@
  167. virtual bool IsAllowed(const CStdString& strFile) const;
  168.  
  169. /*!
  170. + \brief Get a CFileItem reference for this directory
  171. + \param strPath Path to directory
  172. + \return Returns a pointer to a CFileItem
  173. + */
  174. + virtual CFileItem *GetFileItem(const CStdString& strPath);
  175. +
  176. + /*!
  177. \brief How this directory should be cached
  178. \param strPath Directory at hand.
  179. \return Returns the cache type.
  180. Index: xbmc/FileSystem/MythDirectory.cpp
  181. ===================================================================
  182. --- xbmc/FileSystem/MythDirectory.cpp (revision 35107)
  183. +++ xbmc/FileSystem/MythDirectory.cpp (working copy)
  184. @@ -394,6 +394,13 @@
  185. {
  186. CFileItemPtr item(new CFileItem(path, true));
  187. item->m_dateTime = GetValue(m_dll->proginfo_rec_start(program));
  188. + /*
  189. + * We set videoInfoTag on the directory to indicate that we have info for the contents
  190. + * in case the scraper can't match the show name
  191. + */
  192. + CVideoInfoTag* tag = item->GetVideoInfoTag();
  193. + tag->m_strPath = path;
  194. + tag->m_strTitle = title;
  195. item->SetLabel(title);
  196. items.Add(item);
  197. }
  198. @@ -555,6 +562,12 @@
  199. return false;
  200. }
  201.  
  202. +bool CMythDirectory::Exists(const char *strPath)
  203. +{
  204. + CFileItemList items;
  205. + return GetDirectory(strPath, items);
  206. +}
  207. +
  208. bool CMythDirectory::IsVisible(const cmyth_proginfo_t program)
  209. {
  210. CStdString group = GetValue(m_dll->proginfo_recgroup(program));
  211. @@ -625,3 +638,26 @@
  212. CURL url(strPath);
  213. return url.GetFileName().Left(9) == "channels/";
  214. }
  215. +
  216. +CFileItem *CMythDirectory::GetFileItem(const CStdString& strPath)
  217. +{
  218. + CFileItem *item = IDirectory::GetFileItem(strPath);
  219. + if (item->HasVideoInfoTag())
  220. + return item;
  221. +
  222. + CURL url(strPath);
  223. + CStdString fileName = url.GetFileName();
  224. + CUtil::RemoveSlashAtEnd(fileName);
  225. + if (fileName.Left(8) == "tvshows/")
  226. + {
  227. + CStdString show = fileName.substr(8);
  228. + if (! show.IsEmpty())
  229. + {
  230. + CVideoInfoTag* tag = item->GetVideoInfoTag();
  231. + tag->m_strPath = strPath;
  232. + tag->m_strTitle = show;
  233. + }
  234. + }
  235. + return item;
  236. +}
  237. +
  238. Index: xbmc/FileSystem/Directory.h
  239. ===================================================================
  240. --- xbmc/FileSystem/Directory.h (revision 35107)
  241. +++ xbmc/FileSystem/Directory.h (working copy)
  242. @@ -22,6 +22,8 @@
  243.  
  244. #include "IDirectory.h"
  245.  
  246. +class CFileItem;
  247. +
  248. namespace XFILE
  249. {
  250. /*!
  251. @@ -46,6 +48,7 @@
  252. static bool Create(const CStdString& strPath);
  253. static bool Exists(const CStdString& strPath);
  254. static bool Remove(const CStdString& strPath);
  255. + static CFileItem *GetFileItem(const CStdString& strPath);
  256.  
  257. /*! \brief Filter files that act like directories from the list, replacing them with their directory counterparts
  258. \param items The item list to filter
  259. Index: xbmc/FileSystem/MythDirectory.h
  260. ===================================================================
  261. --- xbmc/FileSystem/MythDirectory.h (revision 35107)
  262. +++ xbmc/FileSystem/MythDirectory.h (working copy)
  263. @@ -42,7 +42,9 @@
  264. virtual ~CMythDirectory();
  265.  
  266. virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
  267. + virtual bool Exists(const char* strPath);
  268. virtual bool IsAllowed(const CStdString &strFile) const { return true; };
  269. + virtual CFileItem *GetFileItem(const CStdString& strPath);
  270. virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
  271.  
  272. static bool SupportsFileOperations(const CStdString& strPath);
  273. Index: xbmc/FileSystem/VideoDatabaseDirectory.h
  274. ===================================================================
  275. --- xbmc/FileSystem/VideoDatabaseDirectory.h (revision 35107)
  276. +++ xbmc/FileSystem/VideoDatabaseDirectory.h (working copy)
  277. @@ -44,5 +44,7 @@
  278. static CStdString GetIcon(const CStdString& strDirectory);
  279. bool ContainsMovies(const CStdString &path);
  280. static bool CanCache(const CStdString &path);
  281. + CStdString VideodbToMyth(const CStdString& strPath);
  282. + IDirectory *m_myth_directory;
  283. };
  284. }
  285. Index: xbmc/screensavers/rsxs-0.9/config.h.in
  286. ===================================================================
  287. --- xbmc/screensavers/rsxs-0.9/config.h.in (revision 35107)
  288. +++ xbmc/screensavers/rsxs-0.9/config.h.in (working copy)
  289. @@ -486,6 +486,9 @@
  290. /* Define to the one symbol short name of this package. */
  291. #undef PACKAGE_TARNAME
  292.  
  293. +/* Define to the home page for this package. */
  294. +#undef PACKAGE_URL
  295. +
  296. /* Define to the version of this package. */
  297. #undef PACKAGE_VERSION
  298.  
  299. Index: xbmc/VideoInfoScanner.h
  300. ===================================================================
  301. --- xbmc/VideoInfoScanner.h (revision 35107)
  302. +++ xbmc/VideoInfoScanner.h (working copy)
  303. @@ -47,6 +47,7 @@
  304. int iSeason;
  305. int iEpisode;
  306. CDateTime cDate;
  307. + CVideoInfoTag tag;
  308. } SEpisode;
  309.  
  310. typedef std::vector<SEpisode> EPISODES;
  311. Index: xbmc/VideoInfoScanner.cpp
  312. ===================================================================
  313. --- xbmc/VideoInfoScanner.cpp (revision 35107)
  314. +++ xbmc/VideoInfoScanner.cpp (working copy)
  315. @@ -272,9 +272,7 @@
  316. }
  317. else
  318. {
  319. - CFileItemPtr item(new CFileItem(CUtil::GetFileName(strDirectory)));
  320. - item->m_strPath = strDirectory;
  321. - item->m_bIsFolder = true;
  322. + CFileItemPtr item(CDirectory::GetFileItem(strDirectory));
  323. items.Add(item);
  324. CUtil::GetParentPath(item->m_strPath, items.m_strPath);
  325. }
  326. @@ -530,9 +528,25 @@
  327. int retVal = 0;
  328. if (pURL)
  329. url = *pURL;
  330. - else if ((retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress)) <= 0)
  331. - return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;
  332. -
  333. + else
  334. + {
  335. + retVal = FindVideo(pItem->GetMovieName(bDirNames), info2, url, pDlgProgress);
  336. + if (retVal == 0 && pItem->m_bIsFolder)
  337. + { // Check for VideoInfoTag in folder contents. If it is there, fake the show info
  338. + if (pItem->HasVideoInfoTag() && ! pItem->GetVideoInfoTag()->m_strTitle.IsEmpty()) {
  339. + printf("Found VideoInfo for '%s': '%s'\n", pItem->m_strPath.c_str(), pItem->GetVideoInfoTag()->m_strTitle.c_str());
  340. + long lResult;
  341. + if ((lResult = AddVideo(pItem.get(), info2->Content())) < 0)
  342. + return INFO_ERROR;
  343. + INFO_RET ret = RetrieveInfoForEpisodes(pItem, lResult, info2, useLocal, pDlgProgress);
  344. + if (ret == INFO_ADDED)
  345. + m_database.SetPathHash(pItem->m_strPath, pItem->GetProperty("hash"));
  346. + return ret;
  347. + }
  348. + }
  349. + if (retVal <= 0)
  350. + return retVal < 0 ? INFO_CANCELLED : INFO_NOT_FOUND;
  351. + }
  352. if (m_pObserver && !url.strTitle.IsEmpty())
  353. m_pObserver->OnSetTitle(url.strTitle);
  354.  
  355. @@ -1133,7 +1147,7 @@
  356. continue;
  357. }
  358.  
  359. - if (episodes.empty())
  360. + if (episodes.empty() && file->tag.IsEmpty()) // No hope of getting into the library.
  361. {
  362. CLog::Log(LOGERROR, "VideoInfoScanner: Asked to lookup episode %s"
  363. " online, but we have no episode guide. Check your tvshow.nfo and make"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement