Kodi checker rework (+enable option) (#96)

* big kodichecker rework

- use new logger
- 'enable' flag in config
- startable on runtime (atm not stoppable and no reconfigure)
- rename xbmc to kodi

* remove unnecceasry checks for kodi

* make kodichecker stoppable and add reconfigure

* tune config
This commit is contained in:
redPanther
2016-07-10 22:04:31 +02:00
committed by brindosch
parent d4635bba4e
commit 3ac0781c1f
19 changed files with 385 additions and 338 deletions

View File

@@ -17,26 +17,36 @@
// Utils includes
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
#include <utils/Logger.h>
///
/// This class will check if XBMC is playing something. When it does not, this class will send all black data to Hyperion.
/// This allows grabbed screen data to be overriden while in the XBMC menus.
/// This class will check if KODI is playing something. When it does not, this class will send all black data to Hyperion.
/// This allows grabbed screen data to be overriden while in the KODI menus.
///
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services
/// Note: The json TCP server needs to be enabled manually in KODI in System/Settings/Network/Services
///
class XBMCVideoChecker : public QObject
class KODIVideoChecker : public QObject
{
Q_OBJECT
public:
static XBMCVideoChecker* initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
static XBMCVideoChecker* getInstance();
static KODIVideoChecker* initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
static KODIVideoChecker* getInstance();
~KODIVideoChecker();
void setConfig(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
public slots:
///
/// Start polling XBMC
/// Start polling KODI
///
void start();
///
/// Stop polling KODI
///
void stop();
signals:
/// Signal emitted when the grabbing mode changes
void grabbingMode(GrabbingMode grabbingMode);
@@ -45,16 +55,16 @@ signals:
void videoMode(VideoMode videoMode);
private slots:
/// Receive a reply from XBMC
/// Receive a reply from KODI
void receiveReply();
/// Called when connected to XBMC
/// Called when connected to KODI
void connected();
/// Called when disconnected from XBMC
/// Called when disconnected from KODI
void disconnected();
/// reconnect to XBMC
/// reconnect to KODI
void reconnect();
/// Called when a connection error was encountered
@@ -64,16 +74,16 @@ private:
///
/// Constructor
///
/// @param address Network address of the XBMC instance
/// @param port Port number to use (XBMC default = 9090)
/// @param grabVideo Whether or not to grab when the XBMC video player is playing
/// @param grabPhoto Whether or not to grab when the XBMC photo player is playing
/// @param grabAudio Whether or not to grab when the XBMC audio player is playing
/// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu)
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
/// @param address Network address of the KODI instance
/// @param port Port number to use (KODI default = 9090)
/// @param grabVideo Whether or not to grab when the KODI video player is playing
/// @param grabPhoto Whether or not to grab when the KODI photo player is playing
/// @param grabAudio Whether or not to grab when the KODI audio player is playing
/// @param grabMenu Whether or not to grab when nothing is playing (in KODI menu)
/// @param grabScreensaver Whether or not to grab when the KODI screensaver is activated
/// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing
///
XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
KODIVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
/// Set the grabbing mode
void setGrabbingMode(GrabbingMode grabbingMode);
@@ -84,11 +94,11 @@ private:
void setVideoMode(VideoMode videoMode);
private:
/// The network address of the XBMC instance
const QString _address;
/// The network address of the KODI instance
QString _address;
/// The port number of XBMC
const uint16_t _port;
/// The port number of KODI
uint16_t _port;
/// The JSON-RPC message to check the active player
const QString _activePlayerRequest;
@@ -102,34 +112,34 @@ private:
/// The JSON-RPC message to check the active stereoscopicmode
const QString _getStereoscopicMode;
/// The JSON-RPC message to check the xbmc version
const QString _getXbmcVersion;
/// The JSON-RPC message to check the kodi version
QString _getKodiVersion;
/// The QT TCP Socket with connection to XBMC
/// The QT TCP Socket with connection to KODI
QTcpSocket _socket;
/// Flag indicating whether or not to grab when the XBMC video player is playing
const bool _grabVideo;
/// Flag indicating whether or not to grab when the KODI video player is playing
bool _grabVideo;
/// Flag indicating whether or not to grab when the XBMC photo player is playing
const bool _grabPhoto;
/// Flag indicating whether or not to grab when the KODI photo player is playing
bool _grabPhoto;
/// Flag indicating whether or not to grab when the XBMC audio player is playing
const bool _grabAudio;
/// Flag indicating whether or not to grab when the KODI audio player is playing
bool _grabAudio;
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
const bool _grabMenu;
/// Flag indicating whether or not to grab when KODI is playing nothing (in menu)
bool _grabMenu;
/// Flag indicating whether or not to grab when the XBMC videoplayer is at pause state
const bool _grabPause;
/// Flag indicating whether or not to grab when the KODI videoplayer is at pause state
bool _grabPause;
/// Flag indicating whether or not to grab when the XBMC screensaver is activated
const bool _grabScreensaver;
/// Flag indicating whether or not to grab when the KODI screensaver is activated
bool _grabScreensaver;
/// Flag indicating wheter or not to enable the detection of 3D movies playing
const bool _enable3DDetection;
bool _enable3DDetection;
/// Flag indicating if XBMC is on screensaver
/// Flag indicating if KODI is on screensaver
bool _previousScreensaverMode;
/// Previous emitted grab mode
@@ -138,8 +148,14 @@ private:
/// Previous emitted video mode
VideoMode _previousVideoMode;
/// XBMC version number
int _xbmcVersion;
/// KODI version number
int _kodiVersion;
/// Logger Instance
Logger * _log;
static XBMCVideoChecker* _kodichecker;
/// flag indicating state
bool _active;
static KODIVideoChecker* _kodichecker;
};

View File

@@ -92,7 +92,7 @@ private slots:
signals:
///
/// XBMC Video Checker Message
/// KODI Video Checker Message
///
void setGrabbingMode(const GrabbingMode mode);
void setVideoMode(const VideoMode videoMode);

View File

@@ -21,7 +21,7 @@ public:
signals:
///
/// Forwarding XBMC Video Checker Message
/// Forwarding KODI Video Checker Message
///
void setGrabbingMode(const GrabbingMode mode);
void setVideoMode(const VideoMode videoMode);

View File

@@ -54,7 +54,7 @@ public slots:
signals:
///
/// Forwarding XBMC Checker
/// Forwarding KODI Checker
///
void grabbingMode(const GrabbingMode mode);
void videoMode(const VideoMode VideoMode);