diff options
author | anaconda <anaconda@menakite.eu> | 2014-06-09 21:48:16 +0200 |
---|---|---|
committer | anaconda <anaconda@menakite.eu> | 2014-07-14 18:01:31 +0200 |
commit | 67a002d7795dcea56c0655db96186026be9565a3 (patch) | |
tree | d5856f3ee581fea09b28dc6f0ca106d6f1617099 | |
parent | f06f0cf0efd6a3fb5cf98f453f0a017d468f1537 (diff) |
[python] Monitor: add onCleanStarted/onCleanFinished callbacks.
-rw-r--r-- | addons/xbmc.python/addon.xml | 2 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/Monitor.h | 20 | ||||
-rw-r--r-- | xbmc/interfaces/python/PythonSwig.cpp.template | 2 | ||||
-rw-r--r-- | xbmc/interfaces/python/XBPython.cpp | 30 | ||||
-rw-r--r-- | xbmc/interfaces/python/XBPython.h | 2 |
5 files changed, 54 insertions, 2 deletions
diff --git a/addons/xbmc.python/addon.xml b/addons/xbmc.python/addon.xml index 6cc1c2ee46..374281e87b 100644 --- a/addons/xbmc.python/addon.xml +++ b/addons/xbmc.python/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<addon id="xbmc.python" version="2.16.0" provider-name="Team XBMC"> +<addon id="xbmc.python" version="2.17.0" provider-name="Team XBMC"> <backwards-compatibility abi="2.1.0"/> <requires> <import addon="xbmc.core" version="0.1.0"/> diff --git a/xbmc/interfaces/legacy/Monitor.h b/xbmc/interfaces/legacy/Monitor.h index 8270b9c9c2..07085eddd4 100644 --- a/xbmc/interfaces/legacy/Monitor.h +++ b/xbmc/interfaces/legacy/Monitor.h @@ -56,6 +56,8 @@ namespace XBMCAddon invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onScanFinished,library)); invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onDatabaseUpdated,library)); } + inline void OnCleanStarted(const String &library) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onCleanStarted,library)); } + inline void OnCleanFinished(const String &library) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onCleanFinished,library)); } inline void OnAbortRequested() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onAbortRequested)); } inline void OnNotification(const String &sender, const String &method, const String &data) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String,const String,const String>(this,&Monitor::onNotification,sender,method,data)); } @@ -126,6 +128,24 @@ namespace XBMCAddon virtual void onDatabaseUpdated(const String database) { XBMC_TRACE; } /** + * onCleanStarted(library) -- onCleanStarted method.\n + * \n + * library : video/music as string\n + * \n + * Will be called when library clean has started and return video or music to indicate which library is being cleaned\n + */ + virtual void onCleanStarted(const String library) { XBMC_TRACE; } + + /** + * onCleanFinished(library) -- onCleanFinished method.\n + * \n + * library : video/music as string\n + * \n + * Will be called when library clean has ended and return video or music to indicate which library has been cleaned\n + */ + virtual void onCleanFinished(const String library) { XBMC_TRACE; } + + /** * onAbortRequested() -- onAbortRequested method.\n * \n * Will be called when XBMC requests Abort\n diff --git a/xbmc/interfaces/python/PythonSwig.cpp.template b/xbmc/interfaces/python/PythonSwig.cpp.template index 31866c88c2..bc14101314 100644 --- a/xbmc/interfaces/python/PythonSwig.cpp.template +++ b/xbmc/interfaces/python/PythonSwig.cpp.template @@ -824,7 +824,7 @@ namespace PythonBindings // constants PyModule_AddStringConstant(module, (char*)"__author__", (char*)"Team XBMC <http://xbmc.org>"); PyModule_AddStringConstant(module, (char*)"__date__", (char*)"${new Date().toString()}"); - PyModule_AddStringConstant(module, (char*)"__version__", (char*)"2.16.0"); + PyModule_AddStringConstant(module, (char*)"__version__", (char*)"2.17.0"); PyModule_AddStringConstant(module, (char*)"__credits__", (char*)"Team XBMC"); PyModule_AddStringConstant(module, (char*)"__platform__", (char*)"ALL"); diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp index 099c042bb3..cba242d6f1 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -94,6 +94,10 @@ void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *m OnScanFinished("video"); else if (strcmp(message, "OnScanStarted") == 0) OnScanStarted("video"); + else if (strcmp(message, "OnCleanStarted") == 0) + OnCleanStarted("video"); + else if (strcmp(message, "OnCleanFinished") == 0) + OnCleanFinished("video"); } else if (flag & AudioLibrary) { @@ -101,6 +105,10 @@ void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *m OnScanFinished("music"); else if (strcmp(message, "OnScanStarted") == 0) OnScanStarted("music"); + else if (strcmp(message, "OnCleanStarted") == 0) + OnCleanStarted("music"); + else if (strcmp(message, "OnCleanFinished") == 0) + OnCleanFinished("music"); } else if (flag & GUI) { @@ -350,6 +358,28 @@ void XBPython::OnScanFinished(const std::string &library) } } +void XBPython::OnCleanStarted(const std::string &library) +{ + XBMC_TRACE; + LOCK_AND_COPY(std::vector<XBMCAddon::xbmc::Monitor*>,tmp,m_vecMonitorCallbackList); + for (MonitorCallbackList::iterator it = tmp.begin(); (it != tmp.end()); ++it) + { + if (CHECK_FOR_ENTRY(m_vecMonitorCallbackList,(*it))) + (*it)->OnCleanStarted(library); + } +} + +void XBPython::OnCleanFinished(const std::string &library) +{ + XBMC_TRACE; + LOCK_AND_COPY(std::vector<XBMCAddon::xbmc::Monitor*>,tmp,m_vecMonitorCallbackList); + for (MonitorCallbackList::iterator it = tmp.begin(); (it != tmp.end()); ++it) + { + if (CHECK_FOR_ENTRY(m_vecMonitorCallbackList,(*it))) + (*it)->OnCleanFinished(library); + } +} + void XBPython::OnAbortRequested(const std::string &ID) { XBMC_TRACE; diff --git a/xbmc/interfaces/python/XBPython.h b/xbmc/interfaces/python/XBPython.h index 645015223c..819523355e 100644 --- a/xbmc/interfaces/python/XBPython.h +++ b/xbmc/interfaces/python/XBPython.h @@ -87,6 +87,8 @@ public: void OnDPMSDeactivated(); void OnScanStarted(const std::string &library); void OnScanFinished(const std::string &library); + void OnCleanStarted(const std::string &library); + void OnCleanFinished(const std::string &library); void OnAbortRequested(const std::string &ID=""); void OnNotification(const std::string &sender, const std::string &method, const std::string &data); |