mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
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:
parent
d4635bba4e
commit
3ac0781c1f
@ -213,8 +213,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/// The configuration of the Kodi connection used to enable and disable the frame-grabber. Contains the following fields:
|
/// The configuration of the Kodi connection used to enable and disable the frame-grabber. Contains the following fields:
|
||||||
/// * xbmcAddress : The IP address of the Kodi-host
|
/// * enable : enable/disable Kodi-Checker
|
||||||
/// * xbmcTcpPort : The TCP-port of the Kodi-server
|
/// * kodiAddress : The IP address of the Kodi-host
|
||||||
|
/// * kodiTcpPort : The TCP-port of the Kodi-server
|
||||||
/// * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback
|
/// * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback
|
||||||
/// * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show
|
/// * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show
|
||||||
/// * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback
|
/// * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback
|
||||||
@ -222,10 +223,11 @@
|
|||||||
/// * grabPause : Flag indicating that the frame-grabber is on(true) at player state "pause"
|
/// * grabPause : Flag indicating that the frame-grabber is on(true) at player state "pause"
|
||||||
/// * grabScreensaver : Flag indicating that the frame-grabber is on(true) when Kodi is on screensaver
|
/// * grabScreensaver : Flag indicating that the frame-grabber is on(true) when Kodi is on screensaver
|
||||||
/// * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing
|
/// * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing
|
||||||
"xbmcVideoChecker" :
|
"kodiVideoChecker" :
|
||||||
{
|
{
|
||||||
"xbmcAddress" : "127.0.0.1",
|
"enable" : true,
|
||||||
"xbmcTcpPort" : 9090,
|
"kodiAddress" : "127.0.0.1",
|
||||||
|
"kodiTcpPort" : 9090,
|
||||||
"grabVideo" : true,
|
"grabVideo" : true,
|
||||||
"grabPictures" : true,
|
"grabPictures" : true,
|
||||||
"grabAudio" : true,
|
"grabAudio" : true,
|
||||||
|
@ -126,10 +126,11 @@
|
|||||||
"mode" : "default"
|
"mode" : "default"
|
||||||
},
|
},
|
||||||
|
|
||||||
"xbmcVideoChecker" :
|
"kodiVideoChecker" :
|
||||||
{
|
{
|
||||||
"xbmcAddress" : "localhost",
|
"enable" : true,
|
||||||
"xbmcTcpPort" : 9090,
|
"kodiAddress" : "localhost",
|
||||||
|
"kodiTcpPort" : 9090,
|
||||||
"grabVideo" : true,
|
"grabVideo" : true,
|
||||||
"grabPictures" : true,
|
"grabPictures" : true,
|
||||||
"grabAudio" : true,
|
"grabAudio" : true,
|
||||||
|
@ -17,26 +17,36 @@
|
|||||||
// Utils includes
|
// Utils includes
|
||||||
#include <utils/GrabbingMode.h>
|
#include <utils/GrabbingMode.h>
|
||||||
#include <utils/VideoMode.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 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 XBMC menus.
|
/// 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
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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 KODIVideoChecker* 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* 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();
|
void start();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Stop polling KODI
|
||||||
|
///
|
||||||
|
void stop();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// Signal emitted when the grabbing mode changes
|
/// Signal emitted when the grabbing mode changes
|
||||||
void grabbingMode(GrabbingMode grabbingMode);
|
void grabbingMode(GrabbingMode grabbingMode);
|
||||||
@ -45,16 +55,16 @@ signals:
|
|||||||
void videoMode(VideoMode videoMode);
|
void videoMode(VideoMode videoMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/// Receive a reply from XBMC
|
/// Receive a reply from KODI
|
||||||
void receiveReply();
|
void receiveReply();
|
||||||
|
|
||||||
/// Called when connected to XBMC
|
/// Called when connected to KODI
|
||||||
void connected();
|
void connected();
|
||||||
|
|
||||||
/// Called when disconnected from XBMC
|
/// Called when disconnected from KODI
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
|
||||||
/// reconnect to XBMC
|
/// reconnect to KODI
|
||||||
void reconnect();
|
void reconnect();
|
||||||
|
|
||||||
/// Called when a connection error was encountered
|
/// Called when a connection error was encountered
|
||||||
@ -64,16 +74,16 @@ private:
|
|||||||
///
|
///
|
||||||
/// Constructor
|
/// Constructor
|
||||||
///
|
///
|
||||||
/// @param address Network address of the XBMC instance
|
/// @param address Network address of the KODI instance
|
||||||
/// @param port Port number to use (XBMC default = 9090)
|
/// @param port Port number to use (KODI default = 9090)
|
||||||
/// @param grabVideo Whether or not to grab when the XBMC video player is playing
|
/// @param grabVideo Whether or not to grab when the KODI video player is playing
|
||||||
/// @param grabPhoto Whether or not to grab when the XBMC photo 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 XBMC audio 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 XBMC menu)
|
/// @param grabMenu Whether or not to grab when nothing is playing (in KODI menu)
|
||||||
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
|
/// @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
|
/// @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
|
/// Set the grabbing mode
|
||||||
void setGrabbingMode(GrabbingMode grabbingMode);
|
void setGrabbingMode(GrabbingMode grabbingMode);
|
||||||
@ -84,11 +94,11 @@ private:
|
|||||||
void setVideoMode(VideoMode videoMode);
|
void setVideoMode(VideoMode videoMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The network address of the XBMC instance
|
/// The network address of the KODI instance
|
||||||
const QString _address;
|
QString _address;
|
||||||
|
|
||||||
/// The port number of XBMC
|
/// The port number of KODI
|
||||||
const uint16_t _port;
|
uint16_t _port;
|
||||||
|
|
||||||
/// The JSON-RPC message to check the active player
|
/// The JSON-RPC message to check the active player
|
||||||
const QString _activePlayerRequest;
|
const QString _activePlayerRequest;
|
||||||
@ -102,34 +112,34 @@ private:
|
|||||||
/// The JSON-RPC message to check the active stereoscopicmode
|
/// The JSON-RPC message to check the active stereoscopicmode
|
||||||
const QString _getStereoscopicMode;
|
const QString _getStereoscopicMode;
|
||||||
|
|
||||||
/// The JSON-RPC message to check the xbmc version
|
/// The JSON-RPC message to check the kodi version
|
||||||
const QString _getXbmcVersion;
|
QString _getKodiVersion;
|
||||||
|
|
||||||
/// The QT TCP Socket with connection to XBMC
|
/// The QT TCP Socket with connection to KODI
|
||||||
QTcpSocket _socket;
|
QTcpSocket _socket;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when the XBMC video player is playing
|
/// Flag indicating whether or not to grab when the KODI video player is playing
|
||||||
const bool _grabVideo;
|
bool _grabVideo;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when the XBMC photo player is playing
|
/// Flag indicating whether or not to grab when the KODI photo player is playing
|
||||||
const bool _grabPhoto;
|
bool _grabPhoto;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when the XBMC audio player is playing
|
/// Flag indicating whether or not to grab when the KODI audio player is playing
|
||||||
const bool _grabAudio;
|
bool _grabAudio;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
|
/// Flag indicating whether or not to grab when KODI is playing nothing (in menu)
|
||||||
const bool _grabMenu;
|
bool _grabMenu;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when the XBMC videoplayer is at pause state
|
/// Flag indicating whether or not to grab when the KODI videoplayer is at pause state
|
||||||
const bool _grabPause;
|
bool _grabPause;
|
||||||
|
|
||||||
/// Flag indicating whether or not to grab when the XBMC screensaver is activated
|
/// Flag indicating whether or not to grab when the KODI screensaver is activated
|
||||||
const bool _grabScreensaver;
|
bool _grabScreensaver;
|
||||||
|
|
||||||
/// Flag indicating wheter or not to enable the detection of 3D movies playing
|
/// 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;
|
bool _previousScreensaverMode;
|
||||||
|
|
||||||
/// Previous emitted grab mode
|
/// Previous emitted grab mode
|
||||||
@ -138,8 +148,14 @@ private:
|
|||||||
/// Previous emitted video mode
|
/// Previous emitted video mode
|
||||||
VideoMode _previousVideoMode;
|
VideoMode _previousVideoMode;
|
||||||
|
|
||||||
/// XBMC version number
|
/// KODI version number
|
||||||
int _xbmcVersion;
|
int _kodiVersion;
|
||||||
|
|
||||||
static XBMCVideoChecker* _kodichecker;
|
/// Logger Instance
|
||||||
|
Logger * _log;
|
||||||
|
|
||||||
|
/// flag indicating state
|
||||||
|
bool _active;
|
||||||
|
|
||||||
|
static KODIVideoChecker* _kodichecker;
|
||||||
};
|
};
|
@ -92,7 +92,7 @@ private slots:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
///
|
///
|
||||||
/// XBMC Video Checker Message
|
/// KODI Video Checker Message
|
||||||
///
|
///
|
||||||
void setGrabbingMode(const GrabbingMode mode);
|
void setGrabbingMode(const GrabbingMode mode);
|
||||||
void setVideoMode(const VideoMode videoMode);
|
void setVideoMode(const VideoMode videoMode);
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
///
|
///
|
||||||
/// Forwarding XBMC Video Checker Message
|
/// Forwarding KODI Video Checker Message
|
||||||
///
|
///
|
||||||
void setGrabbingMode(const GrabbingMode mode);
|
void setGrabbingMode(const GrabbingMode mode);
|
||||||
void setVideoMode(const VideoMode videoMode);
|
void setVideoMode(const VideoMode videoMode);
|
||||||
|
@ -54,7 +54,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
///
|
///
|
||||||
/// Forwarding XBMC Checker
|
/// Forwarding KODI Checker
|
||||||
///
|
///
|
||||||
void grabbingMode(const GrabbingMode mode);
|
void grabbingMode(const GrabbingMode mode);
|
||||||
void videoMode(const VideoMode VideoMode);
|
void videoMode(const VideoMode VideoMode);
|
||||||
|
@ -12,7 +12,7 @@ add_subdirectory(boblightserver)
|
|||||||
add_subdirectory(udplistener)
|
add_subdirectory(udplistener)
|
||||||
add_subdirectory(leddevice)
|
add_subdirectory(leddevice)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
add_subdirectory(xbmcvideochecker)
|
add_subdirectory(kodivideochecker)
|
||||||
add_subdirectory(effectengine)
|
add_subdirectory(effectengine)
|
||||||
add_subdirectory(grabber)
|
add_subdirectory(grabber)
|
||||||
add_subdirectory(webconfig)
|
add_subdirectory(webconfig)
|
||||||
|
@ -227,16 +227,16 @@
|
|||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
},
|
},
|
||||||
"xbmcVideoChecker" :
|
"kodiVideoChecker" :
|
||||||
{
|
{
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
"required" : false,
|
"required" : false,
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"xbmcAddress" : {
|
"kodiAddress" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"required" : true
|
"required" : true
|
||||||
},
|
},
|
||||||
"xbmcTcpPort" : {
|
"kodiTcpPort" : {
|
||||||
"type" : "integer",
|
"type" : "integer",
|
||||||
"required" : true
|
"required" : true
|
||||||
},
|
},
|
||||||
|
@ -259,16 +259,16 @@
|
|||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
},
|
},
|
||||||
"xbmcVideoChecker" :
|
"kodiVideoChecker" :
|
||||||
{
|
{
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
"required" : false,
|
"required" : false,
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"xbmcAddress" : {
|
"kodiAddress" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"required" : true
|
"required" : true
|
||||||
},
|
},
|
||||||
"xbmcTcpPort" : {
|
"kodiTcpPort" : {
|
||||||
"type" : "integer",
|
"type" : "integer",
|
||||||
"required" : true
|
"required" : true
|
||||||
},
|
},
|
||||||
|
29
libsrc/kodivideochecker/CMakeLists.txt
Normal file
29
libsrc/kodivideochecker/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
# Define the current source locations
|
||||||
|
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/kodivideochecker)
|
||||||
|
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/kodivideochecker)
|
||||||
|
|
||||||
|
# Group the headers that go through the MOC compiler
|
||||||
|
SET(KODIVideoChecker_QT_HEADERS
|
||||||
|
${CURRENT_HEADER_DIR}/KODIVideoChecker.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(KODIVideoChecker_HEADERS
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(KODIVideoChecker_SOURCES
|
||||||
|
${CURRENT_SOURCE_DIR}/KODIVideoChecker.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
QT5_WRAP_CPP(KODIVideoChecker_HEADERS_MOC ${KODIVideoChecker_QT_HEADERS})
|
||||||
|
|
||||||
|
add_library(kodivideochecker
|
||||||
|
${KODIVideoChecker_HEADERS}
|
||||||
|
${KODIVideoChecker_QT_HEADERS}
|
||||||
|
${KODIVideoChecker_HEADERS_MOC}
|
||||||
|
${KODIVideoChecker_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(kodivideochecker
|
||||||
|
hyperion
|
||||||
|
${QT_LIBRARIES})
|
@ -3,23 +3,23 @@
|
|||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QStringRef>
|
#include <QStringRef>
|
||||||
|
|
||||||
#include <xbmcvideochecker/XBMCVideoChecker.h>
|
#include <kodivideochecker/KODIVideoChecker.h>
|
||||||
|
|
||||||
|
|
||||||
XBMCVideoChecker* XBMCVideoChecker::_kodichecker = nullptr;
|
KODIVideoChecker* KODIVideoChecker::_kodichecker = nullptr;
|
||||||
|
|
||||||
XBMCVideoChecker* XBMCVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
|
KODIVideoChecker* KODIVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
|
||||||
{
|
{
|
||||||
if ( XBMCVideoChecker::_kodichecker != nullptr )
|
if ( KODIVideoChecker::_kodichecker != nullptr )
|
||||||
throw std::runtime_error("XBMCVideoChecker::initInstance can be called only one time");
|
throw std::runtime_error("KODIVideoChecker::initInstance can be called only one time");
|
||||||
XBMCVideoChecker::_kodichecker = new XBMCVideoChecker(address, port, grabVideo, grabPhoto, grabAudio, grabMenu, grabPause, grabScreensaver, enable3DDetection);
|
KODIVideoChecker::_kodichecker = new KODIVideoChecker(address, port, grabVideo, grabPhoto, grabAudio, grabMenu, grabPause, grabScreensaver, enable3DDetection);
|
||||||
|
|
||||||
return XBMCVideoChecker::_kodichecker;
|
return KODIVideoChecker::_kodichecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
XBMCVideoChecker* XBMCVideoChecker::getInstance()
|
KODIVideoChecker* KODIVideoChecker::getInstance()
|
||||||
{
|
{
|
||||||
return XBMCVideoChecker::_kodichecker;
|
return KODIVideoChecker::_kodichecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -39,27 +39,29 @@ XBMCVideoChecker* XBMCVideoChecker::getInstance()
|
|||||||
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
|
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
|
||||||
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
|
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
|
||||||
|
|
||||||
XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection) :
|
KODIVideoChecker::KODIVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
|
||||||
QObject(),
|
: QObject()
|
||||||
_address(QString::fromStdString(address)),
|
, _address(QString::fromStdString(address))
|
||||||
_port(port),
|
, _port(port)
|
||||||
_activePlayerRequest(R"({"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666})"),
|
, _activePlayerRequest(R"({"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666})")
|
||||||
_currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"),
|
, _currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})")
|
||||||
_checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"),
|
, _checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})")
|
||||||
_getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669})"),
|
, _getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669})")
|
||||||
_getXbmcVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})"),
|
, _getKodiVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})")
|
||||||
_socket(),
|
, _socket()
|
||||||
_grabVideo(grabVideo),
|
, _grabVideo(grabVideo)
|
||||||
_grabPhoto(grabPhoto),
|
, _grabPhoto(grabPhoto)
|
||||||
_grabAudio(grabAudio),
|
, _grabAudio(grabAudio)
|
||||||
_grabMenu(grabMenu),
|
, _grabMenu(grabMenu)
|
||||||
_grabPause(grabPause),
|
, _grabPause(grabPause)
|
||||||
_grabScreensaver(grabScreensaver),
|
, _grabScreensaver(grabScreensaver)
|
||||||
_enable3DDetection(enable3DDetection),
|
, _enable3DDetection(enable3DDetection)
|
||||||
_previousScreensaverMode(false),
|
, _previousScreensaverMode(false)
|
||||||
_previousGrabbingMode(GRABBINGMODE_INVALID),
|
, _previousGrabbingMode(GRABBINGMODE_INVALID)
|
||||||
_previousVideoMode(VIDEO_2D),
|
, _previousVideoMode(VIDEO_2D)
|
||||||
_xbmcVersion(0)
|
, _kodiVersion(0)
|
||||||
|
, _log(Logger::getInstance("KODI"))
|
||||||
|
, _active(false)
|
||||||
{
|
{
|
||||||
// setup socket
|
// setup socket
|
||||||
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
|
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
|
||||||
@ -68,17 +70,56 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
|
|||||||
connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));
|
connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::start()
|
KODIVideoChecker::~KODIVideoChecker()
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KODIVideoChecker::setConfig(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
|
||||||
|
{
|
||||||
|
_address = QString::fromStdString(address);
|
||||||
|
_port = port;
|
||||||
|
_grabVideo = grabVideo;
|
||||||
|
_grabPhoto = grabPhoto;
|
||||||
|
_grabAudio = grabAudio;
|
||||||
|
_grabMenu = grabMenu;
|
||||||
|
_grabPause = grabPause;
|
||||||
|
_grabScreensaver = grabScreensaver;
|
||||||
|
_enable3DDetection = enable3DDetection;
|
||||||
|
_previousScreensaverMode = false;
|
||||||
|
_previousGrabbingMode = GRABBINGMODE_INVALID;
|
||||||
|
_previousVideoMode = VIDEO_2D;
|
||||||
|
_kodiVersion = 0;
|
||||||
|
|
||||||
|
// restart if active
|
||||||
|
if (_active)
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
QTimer::singleShot(2000, this, SLOT(()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KODIVideoChecker::start()
|
||||||
|
{
|
||||||
|
Info(_log, "started");
|
||||||
|
_active = true;
|
||||||
reconnect();
|
reconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::receiveReply()
|
void KODIVideoChecker::stop()
|
||||||
|
{
|
||||||
|
Info(_log, "stopped");
|
||||||
|
_active = false;
|
||||||
|
_socket.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void KODIVideoChecker::receiveReply()
|
||||||
{
|
{
|
||||||
// expect that the reply is received as a single message. Probably oke considering the size of the expected reply
|
// expect that the reply is received as a single message. Probably oke considering the size of the expected reply
|
||||||
QString reply(_socket.readAll());
|
QString reply(_socket.readAll());
|
||||||
// silence - no "debug" code should be at the log
|
Debug(_log, "message: %s", reply.toStdString().c_str());
|
||||||
// std::cout << "KODICHECK INFO: Kodi Message: " << reply.toStdString() << std::endl;
|
|
||||||
|
|
||||||
if (reply.contains("\"method\":\"Player.OnPlay\""))
|
if (reply.contains("\"method\":\"Player.OnPlay\""))
|
||||||
{
|
{
|
||||||
@ -147,7 +188,7 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
}
|
}
|
||||||
else if (reply.contains("\"id\":667"))
|
else if (reply.contains("\"id\":667"))
|
||||||
{
|
{
|
||||||
if (_xbmcVersion >= 13)
|
if (_kodiVersion >= 13)
|
||||||
{
|
{
|
||||||
// check of active stereoscopicmode
|
// check of active stereoscopicmode
|
||||||
_socket.write(_getStereoscopicMode.toUtf8());
|
_socket.write(_getStereoscopicMode.toUtf8());
|
||||||
@ -182,12 +223,12 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
bool active = reply.contains("\"System.ScreenSaverActive\":true");
|
bool active = reply.contains("\"System.ScreenSaverActive\":true");
|
||||||
setScreensaverMode(!_grabScreensaver && active);
|
setScreensaverMode(!_grabScreensaver && active);
|
||||||
|
|
||||||
// check here xbmc version
|
// check here kodi version
|
||||||
if (_socket.state() == QTcpSocket::ConnectedState)
|
if (_socket.state() == QTcpSocket::ConnectedState)
|
||||||
{
|
{
|
||||||
if (_xbmcVersion == 0)
|
if (_kodiVersion == 0)
|
||||||
{
|
{
|
||||||
_socket.write(_getXbmcVersion.toUtf8());
|
_socket.write(_getKodiVersion.toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +255,7 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
int pos = regex.indexIn(reply);
|
int pos = regex.indexIn(reply);
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
_xbmcVersion = regex.cap(1).toInt();
|
_kodiVersion = regex.cap(1).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reply.contains("picture") && reply.contains("\"method\":\"Playlist.OnAdd\""))
|
else if (reply.contains("picture") && reply.contains("\"method\":\"Playlist.OnAdd\""))
|
||||||
@ -224,33 +265,34 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::connected()
|
void KODIVideoChecker::connected()
|
||||||
{
|
{
|
||||||
std::cout << "KODICHECK INFO: Kodi Connected" << std::endl;
|
Info(_log, "Connected");
|
||||||
|
|
||||||
// send a request for the current player state
|
// send a request for the current player state
|
||||||
_socket.write(_activePlayerRequest.toUtf8());
|
_socket.write(_activePlayerRequest.toUtf8());
|
||||||
_socket.write(_checkScreensaverRequest.toUtf8());
|
_socket.write(_checkScreensaverRequest.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::disconnected()
|
void KODIVideoChecker::disconnected()
|
||||||
{
|
{
|
||||||
std::cout << "KODICHECK INFO: Kodi Disconnected" << std::endl;
|
Info(_log, "Disconnected");
|
||||||
reconnect();
|
reconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::reconnect()
|
void KODIVideoChecker::reconnect()
|
||||||
{
|
{
|
||||||
if (_socket.state() == QTcpSocket::ConnectedState)
|
if (_socket.state() == QTcpSocket::ConnectedState || ! _active )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Debug(_log, "try reconnect");
|
||||||
|
|
||||||
// try to connect
|
// try to connect
|
||||||
switch (_socket.state())
|
switch (_socket.state())
|
||||||
{
|
{
|
||||||
case QTcpSocket::ConnectingState:
|
case QTcpSocket::ConnectingState:
|
||||||
// Somehow when XBMC restarts we get stuck in connecting state
|
// Somehow when KODI restarts we get stuck in connecting state
|
||||||
// If we get here we tried to connect already for 5 seconds. abort and try again in 1 second.
|
// If we get here we tried to connect already for 5 seconds. abort and try again in 1 second.
|
||||||
_socket.reset();
|
_socket.reset();
|
||||||
_socket.waitForDisconnected(50);
|
_socket.waitForDisconnected(50);
|
||||||
@ -266,15 +308,15 @@ void XBMCVideoChecker::reconnect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::connectionError(QAbstractSocket::SocketError error)
|
void KODIVideoChecker::connectionError(QAbstractSocket::SocketError error)
|
||||||
{
|
{
|
||||||
std::cout << "KODICHECK ERROR: Kodi Connection error (" << error << ")" << std::endl;
|
Error(_log,"Connection error (%s)", error);
|
||||||
|
|
||||||
// close the socket
|
// close the socket
|
||||||
_socket.close();
|
_socket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
|
void KODIVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
|
||||||
{
|
{
|
||||||
if (newGrabbingMode == _previousGrabbingMode)
|
if (newGrabbingMode == _previousGrabbingMode)
|
||||||
{
|
{
|
||||||
@ -285,25 +327,25 @@ void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
|
|||||||
switch (newGrabbingMode)
|
switch (newGrabbingMode)
|
||||||
{
|
{
|
||||||
case GRABBINGMODE_VIDEO:
|
case GRABBINGMODE_VIDEO:
|
||||||
std::cout << "KODICHECK INFO: switching to VIDEO mode" << std::endl;
|
Info(_log, "switching to VIDEO mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_PHOTO:
|
case GRABBINGMODE_PHOTO:
|
||||||
std::cout << "KODICHECK INFO: switching to PHOTO mode" << std::endl;
|
Info(_log, "switching to PHOTO mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_AUDIO:
|
case GRABBINGMODE_AUDIO:
|
||||||
std::cout << "KODICHECK INFO: switching to AUDIO mode" << std::endl;
|
Info(_log, "switching to AUDIO mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_MENU:
|
case GRABBINGMODE_MENU:
|
||||||
std::cout << "KODICHECK INFO: switching to MENU mode" << std::endl;
|
Info(_log, "switching to MENU mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_PAUSE:
|
case GRABBINGMODE_PAUSE:
|
||||||
std::cout << "KODICHECK INFO: switching to PAUSE mode" << std::endl;
|
Info(_log, "switching to PAUSE mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_OFF:
|
case GRABBINGMODE_OFF:
|
||||||
std::cout << "KODICHECK INFO: switching to OFF mode" << std::endl;
|
Info(_log, "switching to OFF mode");
|
||||||
break;
|
break;
|
||||||
case GRABBINGMODE_INVALID:
|
default:
|
||||||
std::cout << "KODICHECK INFO: switching to INVALID mode" << std::endl;
|
Warning(_log, "switching to INVALID mode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +357,7 @@ void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
|
|||||||
_previousGrabbingMode = newGrabbingMode;
|
_previousGrabbingMode = newGrabbingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::setScreensaverMode(bool isOnScreensaver)
|
void KODIVideoChecker::setScreensaverMode(bool isOnScreensaver)
|
||||||
{
|
{
|
||||||
if (isOnScreensaver == _previousScreensaverMode)
|
if (isOnScreensaver == _previousScreensaverMode)
|
||||||
{
|
{
|
||||||
@ -327,7 +369,7 @@ void XBMCVideoChecker::setScreensaverMode(bool isOnScreensaver)
|
|||||||
_previousScreensaverMode = isOnScreensaver;
|
_previousScreensaverMode = isOnScreensaver;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBMCVideoChecker::setVideoMode(VideoMode newVideoMode)
|
void KODIVideoChecker::setVideoMode(VideoMode newVideoMode)
|
||||||
{
|
{
|
||||||
if (newVideoMode == _previousVideoMode)
|
if (newVideoMode == _previousVideoMode)
|
||||||
{
|
{
|
||||||
@ -338,13 +380,13 @@ void XBMCVideoChecker::setVideoMode(VideoMode newVideoMode)
|
|||||||
switch (newVideoMode)
|
switch (newVideoMode)
|
||||||
{
|
{
|
||||||
case VIDEO_2D:
|
case VIDEO_2D:
|
||||||
std::cout << "KODICHECK INFO: switching to 2D mode" << std::endl;
|
Info(_log, "KODICHECK INFO: switching to 2D mode");
|
||||||
break;
|
break;
|
||||||
case VIDEO_3DSBS:
|
case VIDEO_3DSBS:
|
||||||
std::cout << "KODICHECK INFO: switching to 3D SBS mode" << std::endl;
|
Info(_log, "KODICHECK INFO: switching to 3D SBS mode");
|
||||||
break;
|
break;
|
||||||
case VIDEO_3DTAB:
|
case VIDEO_3DTAB:
|
||||||
std::cout << "KODICHECK INFO: switching to 3D TAB mode" << std::endl;
|
Info(_log, "KODICHECK INFO: switching to 3D TAB mode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
///
|
///
|
||||||
/// Send XBMC Video Checker message to connected client
|
/// Send KODI Video Checker message to connected client
|
||||||
///
|
///
|
||||||
void setGrabbingMode(const GrabbingMode mode);
|
void setGrabbingMode(const GrabbingMode mode);
|
||||||
void setVideoMode(const VideoMode videoMode);
|
void setVideoMode(const VideoMode videoMode);
|
||||||
|
@ -65,7 +65,7 @@ void ProtoServer::newConnection()
|
|||||||
connect(connection, SIGNAL(connectionClosed(ProtoClientConnection*)), this, SLOT(closedConnection(ProtoClientConnection*)));
|
connect(connection, SIGNAL(connectionClosed(ProtoClientConnection*)), this, SLOT(closedConnection(ProtoClientConnection*)));
|
||||||
connect(connection, SIGNAL(newMessage(const proto::HyperionRequest*)), this, SLOT(newMessage(const proto::HyperionRequest*)));
|
connect(connection, SIGNAL(newMessage(const proto::HyperionRequest*)), this, SLOT(newMessage(const proto::HyperionRequest*)));
|
||||||
|
|
||||||
// register forward signal for xbmc checker
|
// register forward signal for kodi checker
|
||||||
connect(this, SIGNAL(grabbingMode(GrabbingMode)), connection, SLOT(setGrabbingMode(GrabbingMode)));
|
connect(this, SIGNAL(grabbingMode(GrabbingMode)), connection, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
connect(this, SIGNAL(videoMode(VideoMode)), connection, SLOT(setVideoMode(VideoMode)));
|
connect(this, SIGNAL(videoMode(VideoMode)), connection, SLOT(setVideoMode(VideoMode)));
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ message HyperionReply {
|
|||||||
// string indicating the reason for failure (if applicable)
|
// string indicating the reason for failure (if applicable)
|
||||||
optional string error = 3;
|
optional string error = 3;
|
||||||
|
|
||||||
// XBMC Video Checker Proto Messages for Grabbing mode
|
// KODI Video Checker Proto Messages for Grabbing mode
|
||||||
optional int32 grabbing = 4;
|
optional int32 grabbing = 4;
|
||||||
|
|
||||||
// XBMC Video Checker Proto Messages for Video mode
|
// KODI Video Checker Proto Messages for Video mode
|
||||||
optional int32 video = 5;
|
optional int32 video = 5;
|
||||||
}
|
}
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
# Define the current source locations
|
|
||||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/xbmcvideochecker)
|
|
||||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/xbmcvideochecker)
|
|
||||||
|
|
||||||
# Group the headers that go through the MOC compiler
|
|
||||||
SET(XBMCVideoChecker_QT_HEADERS
|
|
||||||
${CURRENT_HEADER_DIR}/XBMCVideoChecker.h
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(XBMCVideoChecker_HEADERS
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(XBMCVideoChecker_SOURCES
|
|
||||||
${CURRENT_SOURCE_DIR}/XBMCVideoChecker.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
QT5_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS})
|
|
||||||
|
|
||||||
add_library(xbmcvideochecker
|
|
||||||
${XBMCVideoChecker_HEADERS}
|
|
||||||
${XBMCVideoChecker_QT_HEADERS}
|
|
||||||
${XBMCVideoChecker_HEADERS_MOC}
|
|
||||||
${XBMCVideoChecker_SOURCES}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(xbmcvideochecker
|
|
||||||
hyperion
|
|
||||||
${QT_LIBRARIES})
|
|
@ -104,7 +104,7 @@ int main(int argc, char ** argv)
|
|||||||
// Connect the screen capturing to the proto processing
|
// Connect the screen capturing to the proto processing
|
||||||
QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
|
QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
|
||||||
|
|
||||||
// Connect the XBMC Video Checker to the proto processing
|
// Connect the KODI Video Checker to the proto processing
|
||||||
QObject::connect(&protoWrapper, SIGNAL(setGrabbingMode(GrabbingMode)), &x11Wrapper, SLOT(setGrabbingMode(GrabbingMode)));
|
QObject::connect(&protoWrapper, SIGNAL(setGrabbingMode(GrabbingMode)), &x11Wrapper, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
QObject::connect(&protoWrapper, SIGNAL(setVideoMode(VideoMode)), &x11Wrapper, SLOT(setVideoMode(VideoMode)));
|
QObject::connect(&protoWrapper, SIGNAL(setVideoMode(VideoMode)), &x11Wrapper, SLOT(setVideoMode(VideoMode)));
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ add_executable(hyperiond
|
|||||||
target_link_libraries(hyperiond
|
target_link_libraries(hyperiond
|
||||||
getoptPlusPlus
|
getoptPlusPlus
|
||||||
hyperion
|
hyperion
|
||||||
xbmcvideochecker
|
kodivideochecker
|
||||||
effectengine
|
effectengine
|
||||||
jsonserver
|
jsonserver
|
||||||
boblightserver
|
boblightserver
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
HyperionDaemon::HyperionDaemon(std::string configFile, QObject *parent)
|
HyperionDaemon::HyperionDaemon(std::string configFile, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, _log(Logger::getInstance("MAIN"))
|
, _log(Logger::getInstance("MAIN"))
|
||||||
, _xbmcVideoChecker(nullptr)
|
, _kodiVideoChecker(nullptr)
|
||||||
, _jsonServer(nullptr)
|
, _jsonServer(nullptr)
|
||||||
, _protoServer(nullptr)
|
, _protoServer(nullptr)
|
||||||
, _boblightServer(nullptr)
|
, _boblightServer(nullptr)
|
||||||
@ -73,7 +73,7 @@ HyperionDaemon::~HyperionDaemon()
|
|||||||
delete _fbGrabber;
|
delete _fbGrabber;
|
||||||
delete _osxGrabber;
|
delete _osxGrabber;
|
||||||
delete _v4l2Grabber;
|
delete _v4l2Grabber;
|
||||||
delete _xbmcVideoChecker;
|
delete _kodiVideoChecker;
|
||||||
delete _jsonServer;
|
delete _jsonServer;
|
||||||
delete _protoServer;
|
delete _protoServer;
|
||||||
delete _boblightServer;
|
delete _boblightServer;
|
||||||
@ -85,7 +85,7 @@ HyperionDaemon::~HyperionDaemon()
|
|||||||
void HyperionDaemon::run()
|
void HyperionDaemon::run()
|
||||||
{
|
{
|
||||||
startInitialEffect();
|
startInitialEffect();
|
||||||
createXBMCVideoChecker();
|
createKODIVideoChecker();
|
||||||
|
|
||||||
// ---- network services -----
|
// ---- network services -----
|
||||||
startNetworkServices();
|
startNetworkServices();
|
||||||
@ -193,31 +193,33 @@ void HyperionDaemon::startInitialEffect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// create XBMC video checker if the _configuration is present
|
// create KODI video checker if the _configuration is present
|
||||||
void HyperionDaemon::createXBMCVideoChecker()
|
void HyperionDaemon::createKODIVideoChecker()
|
||||||
{
|
{
|
||||||
if (_config.isMember("xbmcVideoChecker"))
|
bool kodiCheckerConfigured = _config.isMember("kodiVideoChecker");
|
||||||
{
|
|
||||||
const Json::Value & videoCheckerConfig = _config["xbmcVideoChecker"];
|
|
||||||
_xbmcVideoChecker = XBMCVideoChecker::initInstance(
|
|
||||||
videoCheckerConfig["xbmcAddress"].asString(),
|
|
||||||
videoCheckerConfig["xbmcTcpPort"].asUInt(),
|
|
||||||
videoCheckerConfig["grabVideo"].asBool(),
|
|
||||||
videoCheckerConfig["grabPictures"].asBool(),
|
|
||||||
videoCheckerConfig["grabAudio"].asBool(),
|
|
||||||
videoCheckerConfig["grabMenu"].asBool(),
|
|
||||||
videoCheckerConfig.get("grabPause", true).asBool(),
|
|
||||||
videoCheckerConfig.get("grabScreensaver", true).asBool(),
|
|
||||||
videoCheckerConfig.get("enable3DDetection", true).asBool());
|
|
||||||
|
|
||||||
_xbmcVideoChecker->start();
|
const Json::Value & videoCheckerConfig = _config["kodiVideoChecker"];
|
||||||
Info(_log, "Kodi checker created and started");
|
_kodiVideoChecker = KODIVideoChecker::initInstance(
|
||||||
|
videoCheckerConfig.get("kodiAddress","127.0.0.1").asString(),
|
||||||
|
videoCheckerConfig.get("kodiTcpPort",9090).asUInt(),
|
||||||
|
videoCheckerConfig.get("grabVideo",true).asBool(),
|
||||||
|
videoCheckerConfig.get("grabPictures",true).asBool(),
|
||||||
|
videoCheckerConfig.get("grabAudio",true).asBool(),
|
||||||
|
videoCheckerConfig.get("grabMenu",false).asBool(),
|
||||||
|
videoCheckerConfig.get("grabPause", true).asBool(),
|
||||||
|
videoCheckerConfig.get("grabScreensaver", false).asBool(),
|
||||||
|
videoCheckerConfig.get("enable3DDetection", true).asBool());
|
||||||
|
Debug(_log, "KODI checker created ");
|
||||||
|
|
||||||
|
if( kodiCheckerConfigured && videoCheckerConfig.get("enable", true).asBool() )
|
||||||
|
{
|
||||||
|
_kodiVideoChecker->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HyperionDaemon::startNetworkServices()
|
void HyperionDaemon::startNetworkServices()
|
||||||
{
|
{
|
||||||
XBMCVideoChecker* xbmcVideoChecker = XBMCVideoChecker::getInstance();
|
KODIVideoChecker* kodiVideoChecker = KODIVideoChecker::getInstance();
|
||||||
|
|
||||||
// Create Json server if configuration is present
|
// Create Json server if configuration is present
|
||||||
unsigned int jsonPort = 19444;
|
unsigned int jsonPort = 19444;
|
||||||
@ -241,10 +243,10 @@ void HyperionDaemon::startNetworkServices()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_protoServer = new ProtoServer(protoPort );
|
_protoServer = new ProtoServer(protoPort );
|
||||||
if (xbmcVideoChecker != nullptr)
|
if (kodiVideoChecker != nullptr)
|
||||||
{
|
{
|
||||||
QObject::connect(xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _protoServer, SIGNAL(grabbingMode(GrabbingMode)));
|
QObject::connect(kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _protoServer, SIGNAL(grabbingMode(GrabbingMode)));
|
||||||
QObject::connect(xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _protoServer, SIGNAL(videoMode(VideoMode)));
|
QObject::connect(kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _protoServer, SIGNAL(videoMode(VideoMode)));
|
||||||
}
|
}
|
||||||
Info(_log, "Proto server created and started on port %d", _protoServer->getPort());
|
Info(_log, "Proto server created and started on port %d", _protoServer->getPort());
|
||||||
|
|
||||||
@ -335,12 +337,8 @@ void HyperionDaemon::createGrabberDispmanx()
|
|||||||
frameGrabberConfig.get("cropTop", 0).asInt(),
|
frameGrabberConfig.get("cropTop", 0).asInt(),
|
||||||
frameGrabberConfig.get("cropBottom", 0).asInt());
|
frameGrabberConfig.get("cropBottom", 0).asInt());
|
||||||
|
|
||||||
if (_xbmcVideoChecker != nullptr)
|
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
{
|
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
|
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||||
|
|
||||||
_dispmanx->start();
|
_dispmanx->start();
|
||||||
@ -405,12 +403,8 @@ void HyperionDaemon::createGrabberAmlogic()
|
|||||||
grabberConfig["frequency_Hz"].asUInt(),
|
grabberConfig["frequency_Hz"].asUInt(),
|
||||||
grabberConfig.get("priority",900).asInt());
|
grabberConfig.get("priority",900).asInt());
|
||||||
|
|
||||||
if (_xbmcVideoChecker != nullptr)
|
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
{
|
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||||
|
|
||||||
_amlGrabber->start();
|
_amlGrabber->start();
|
||||||
@ -436,12 +430,8 @@ void HyperionDaemon::createGrabberFramebuffer()
|
|||||||
grabberConfig["frequency_Hz"].asUInt(),
|
grabberConfig["frequency_Hz"].asUInt(),
|
||||||
grabberConfig.get("priority",900).asInt());
|
grabberConfig.get("priority",900).asInt());
|
||||||
|
|
||||||
if (_xbmcVideoChecker != nullptr)
|
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
{
|
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||||
|
|
||||||
_fbGrabber->start();
|
_fbGrabber->start();
|
||||||
@ -467,12 +457,8 @@ void HyperionDaemon::createGrabberOsx()
|
|||||||
grabberConfig["frequency_Hz"].asUInt(),
|
grabberConfig["frequency_Hz"].asUInt(),
|
||||||
grabberConfig.get("priority",900).asInt());
|
grabberConfig.get("priority",900).asInt());
|
||||||
|
|
||||||
if (_xbmcVideoChecker != nullptr)
|
QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
||||||
{
|
QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
|
|
||||||
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||||
|
|
||||||
_osxGrabber->start();
|
_osxGrabber->start();
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
|
|
||||||
#include <xbmcvideochecker/XBMCVideoChecker.h>
|
#include <kodivideochecker/KODIVideoChecker.h>
|
||||||
#include <jsonserver/JsonServer.h>
|
#include <jsonserver/JsonServer.h>
|
||||||
#include <protoserver/ProtoServer.h>
|
#include <protoserver/ProtoServer.h>
|
||||||
#include <boblightserver/BoblightServer.h>
|
#include <boblightserver/BoblightServer.h>
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
void run();
|
void run();
|
||||||
|
|
||||||
void startInitialEffect();
|
void startInitialEffect();
|
||||||
void createXBMCVideoChecker();
|
void createKODIVideoChecker();
|
||||||
void startNetworkServices();
|
void startNetworkServices();
|
||||||
|
|
||||||
// grabber creators
|
// grabber creators
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Logger* _log;
|
Logger* _log;
|
||||||
Json::Value _config;
|
Json::Value _config;
|
||||||
XBMCVideoChecker* _xbmcVideoChecker;
|
KODIVideoChecker* _kodiVideoChecker;
|
||||||
JsonServer* _jsonServer;
|
JsonServer* _jsonServer;
|
||||||
ProtoServer* _protoServer;
|
ProtoServer* _protoServer;
|
||||||
BoblightServer* _boblightServer;
|
BoblightServer* _boblightServer;
|
||||||
|
Loading…
Reference in New Issue
Block a user