diff options
-rw-r--r-- | addons/metadata.tvdb.com/addon.xml | 3 | ||||
-rw-r--r-- | addons/metadata.tvdb.com/tvdb.xml | 2 | ||||
-rw-r--r-- | xbmc/addons/Scraper.cpp | 4 | ||||
-rw-r--r-- | xbmc/addons/Scraper.h | 4 | ||||
-rw-r--r-- | xbmc/utils/ScraperParser.cpp | 9 | ||||
-rw-r--r-- | xbmc/utils/ScraperParser.h | 2 |
6 files changed, 13 insertions, 11 deletions
diff --git a/addons/metadata.tvdb.com/addon.xml b/addons/metadata.tvdb.com/addon.xml index 3ac2af70fd..d0fea60f46 100644 --- a/addons/metadata.tvdb.com/addon.xml +++ b/addons/metadata.tvdb.com/addon.xml @@ -8,7 +8,8 @@ </requires> <extension point="xbmc.metadata.scraper.tvshows" language="multi" - library="tvdb.xml"/> + library="tvdb.xml" + cachepersistence="00:15"/> <extension point="xbmc.addon.metadata"> <summary>Fetch TV show metadata from TheTVDB.com</summary> <description>TheTVDB.com is a TV Scraper. The site is a massive open database that can be modified by anybody and contains full meta data for many shows in different languages. All content and images on the site have been contributed by their users for users and have a high standard or quality. The database schema and website are open source under the GPL.</description> diff --git a/addons/metadata.tvdb.com/tvdb.xml b/addons/metadata.tvdb.com/tvdb.xml index e6a8adcd76..a62ee9fa15 100644 --- a/addons/metadata.tvdb.com/tvdb.xml +++ b/addons/metadata.tvdb.com/tvdb.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- should be self-explanatory --> -<scraper framework="1.1" date="2009-01-27" cachePersistence="00:15"> +<scraper framework="1.1" date="2009-01-27"> <NfoUrl dest="3"> <RegExp input="$$1" output="<url cache="\1.xml">http://www.thetvdb.com/api/1D62F2F90030C444/series/\1/all/$INFO[language].zip</url><id>\1</id>" dest="3"> <expression>http://(?:www\.)?thetvdb.com/(?:index\.php)?\?tab=series&id=([0-9]+)</expression> diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp index 0682777d52..f8df84ff8c 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -108,6 +108,9 @@ CScraper::CScraper(const cp_extension_t *ext) : { m_language = CAddonMgr::Get().GetExtValue(ext->configuration, "language"); m_requiressettings = CAddonMgr::Get().GetExtValue(ext->configuration,"requiressettings").Equals("true"); + CStdString persistence = CAddonMgr::Get().GetExtValue(ext->configuration, "cachepersistence"); + if (!persistence.IsEmpty()) + m_persistence.SetFromTimeString(persistence); } switch (Type()) { @@ -141,6 +144,7 @@ CScraper::CScraper(const CScraper &rhs, const AddonPtr &self) : CAddon(rhs, self) { m_pathContent = rhs.m_pathContent; + m_persistence = rhs.m_persistence; } bool CScraper::Supports(const CONTENT_TYPE &content) const diff --git a/xbmc/addons/Scraper.h b/xbmc/addons/Scraper.h index 48df816f17..411cd41bb1 100644 --- a/xbmc/addons/Scraper.h +++ b/xbmc/addons/Scraper.h @@ -21,6 +21,7 @@ */ #include "addons/Addon.h" #include "utils/ScraperUrl.h" +#include "DateTime.h" typedef enum { @@ -71,7 +72,7 @@ namespace ADDON const CStdString& Framework() const { return m_framework; } const CStdString& Language() const { return m_language; } bool RequiresSettings() const { return m_requiressettings; } - + const CDateTimeSpan &Persistence() const { return m_persistence; } bool Supports(const CONTENT_TYPE &content) const; private: @@ -80,6 +81,7 @@ namespace ADDON CStdString m_framework; CStdString m_language; bool m_requiressettings; + CDateTimeSpan m_persistence; CONTENT_TYPE m_pathContent; }; diff --git a/xbmc/utils/ScraperParser.cpp b/xbmc/utils/ScraperParser.cpp index 208457f8d6..1f4620acc9 100644 --- a/xbmc/utils/ScraperParser.cpp +++ b/xbmc/utils/ScraperParser.cpp @@ -61,7 +61,6 @@ CScraperParser &CScraperParser::operator=(const CScraperParser &parser) if (parser.m_document) { m_scraper = parser.m_scraper; - m_persistence = parser.m_persistence; m_document = new TiXmlDocument(*parser.m_document); LoadFromXML(); } @@ -124,9 +123,6 @@ bool CScraperParser::LoadFromXML() bool result=false; if (strValue == "scraper") { - if (m_pRootElement->Attribute("cachePersistence")) - m_persistence.SetFromTimeString(m_pRootElement->Attribute("cachePersistence")); - TiXmlElement* pChildElement = m_pRootElement->FirstChildElement("CreateSearchUrl"); if (pChildElement) { @@ -506,14 +502,15 @@ void CScraperParser::ClearCache() strCachePath = CUtil::AddFileToFolder(strCachePath,CUtil::GetFileName(m_strFile)); CUtil::AddSlashAtEnd(strCachePath); - if (CDirectory::Exists(strCachePath)) + ScraperPtr scraper = boost::dynamic_pointer_cast<CScraper>(m_scraper); + if (CDirectory::Exists(strCachePath) && scraper) { CFileItemList items; CDirectory::GetDirectory(strCachePath,items); for (int i=0;i<items.Size();++i) { // wipe cache - if (items[i]->m_dateTime+m_persistence <= CDateTime::GetUTCDateTime()) + if (items[i]->m_dateTime + scraper->Persistence() <= CDateTime::GetUTCDateTime()) CFile::Delete(items[i]->m_strPath); } } diff --git a/xbmc/utils/ScraperParser.h b/xbmc/utils/ScraperParser.h index e38a291a7a..8330d8b872 100644 --- a/xbmc/utils/ScraperParser.h +++ b/xbmc/utils/ScraperParser.h @@ -25,7 +25,6 @@ #include <vector> #include "StdString.h" #include "addons/IAddon.h" -#include "DateTime.h" #define MAX_SCRAPER_BUFFERS 20 @@ -69,7 +68,6 @@ private: TiXmlElement* m_pRootElement; const char* m_SearchStringEncoding; - CDateTimeSpan m_persistence; CStdString m_strFile; }; |