return false;
}
-bool CMusicDatabase::ScraperInUse(const ADDON::ScraperPtr &scraper) const
+bool CMusicDatabase::ScraperInUse(const CStdString &scraperID) const
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- if (!scraper) return false;
- CStdString sql = PrepareSQL("select count(1) from content where strScraperPath='%s'",scraper->ID().c_str());
+ CStdString sql = PrepareSQL("select count(1) from content where strScraperPath='%s'",scraperID.c_str());
if (!m_pDS->query(sql.c_str()) || m_pDS->num_rows() == 0)
return false;
bool found = m_pDS->fv(0).get_asInt() > 0;
}
catch (...)
{
- CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, scraper->ID().c_str());
+ CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, scraperID.c_str());
}
return false;
}
bool GetScraperForPath(const CStdString& strPath, ADDON::ScraperPtr& info, const ADDON::TYPE &type);
/*! \brief Check whether a given scraper is in use.
- \param scraper the scraper to check for.
+ \param scraperID the scraper to check for.
\return true if the scraper is in use, false otherwise.
*/
- bool ScraperInUse(const ADDON::ScraperPtr &scraper) const;
+ bool ScraperInUse(const CStdString &scraperID) const;
void ExportToXML(const CStdString &xmlFile, bool singleFiles = false, bool images=false, bool overwrite=false);
void ImportFromXML(const CStdString &xmlFile);
}
}
-bool CVideoDatabase::ScraperInUse(const ADDON::ScraperPtr &scraper) const
+bool CVideoDatabase::ScraperInUse(const CStdString &scraperID) const
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- if (!scraper) return false;
- CStdString sql = PrepareSQL("select count(1) from path where strScraper='%s'",scraper->ID().c_str());
+ CStdString sql = PrepareSQL("select count(1) from path where strScraper='%s'", scraperID.c_str());
if (!m_pDS->query(sql.c_str()) || m_pDS->num_rows() == 0)
return false;
bool found = m_pDS->fv(0).get_asInt() > 0;
}
catch (...)
{
- CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, scraper->ID().c_str());
+ CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, scraperID.c_str());
}
return false;
}
CONTENT_TYPE GetContentForPath(const CStdString& strPath);
/*! \brief Check whether a given scraper is in use.
- \param scraper the scraper to check for.
+ \param scraperID the scraper to check for.
\return true if the scraper is in use, false otherwise.
*/
- bool ScraperInUse(const ADDON::ScraperPtr &scraper) const;
+ bool ScraperInUse(const CStdString &scraperID) const;
// scanning hashes and paths scanned
bool SetPathHash(const CStdString &path, const CStdString &hash);
const CStdString ID() const { return m_props.id; }
const CStdString Name() const { return m_props.name; }
bool Enabled() const { return m_enabled; }
+ virtual bool IsInUse() const { return false; };
const AddonVersion Version();
const CStdString Summary() const { return m_props.summary; }
const CStdString Description() const { return m_props.description; }
virtual const CStdString ID() const =0;
virtual const CStdString Name() const =0;
virtual bool Enabled() const =0;
+ virtual bool IsInUse() const =0;
virtual const AddonVersion Version() =0;
virtual const CStdString Summary() const =0;
virtual const CStdString Description() const =0;
#include "AdvancedSettings.h"
#include "FileItem.h"
#include "XMLUtils.h"
+#include "MusicDatabase.h"
+#include "VideoDatabase.h"
#include <sstream>
using namespace std;
return result;
}
+bool CScraper::IsInUse() const
+{
+ if (Supports(CONTENT_ALBUMS) || Supports(CONTENT_ARTISTS))
+ { // music scraper
+ CMusicDatabase db;
+ if (db.Open() && db.ScraperInUse(ID()))
+ return true;
+ }
+ else
+ { // video scraper
+ CVideoDatabase db;
+ if (db.Open() && db.ScraperInUse(ID()))
+ return true;
+ }
+ return false;
+}
+
}; /* namespace ADDON */
XFILE::CFileCurl& http,
const std::vector<CStdString>* extras=NULL);
CScraperParser& GetParser() { return m_parser; }
+
+ bool IsInUse() const;
+
private:
CScraper(const CScraper&, const AddonPtr&);
return startWindow;
}
+bool CSkinInfo::IsInUse() const
+{
+ // Could extend this to prompt for reverting to the standard skin perhaps
+ return g_guiSettings.GetString("lookandfeel.skin") == ID();
+}
+
} /*namespace ADDON*/
*/
void GetSkinPaths(std::vector<CStdString> &paths) const;
+ bool IsInUse() const;
+
// static bool Check(const CStdString& strSkinDir); // checks if everything is present and accounted for without loading the skin
static double GetMinVersion();
protected: