From fd36166d42dcd2f5487ade2462738273caa3c11f Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Sun, 12 Jan 2020 17:32:57 +0200 Subject: [PATCH 01/10] fix: add NotifyStatus request xibosignage#151 --- player/cms/CollectionInterval.cpp | 3 ++ player/cms/CollectionInterval.hpp | 2 +- player/cms/xmds/NotifyStatus.cpp | 27 ++++++++++++++++++ player/cms/xmds/NotifyStatus.hpp | 40 +++++++++++++++++++++++++++ player/cms/xmds/Resources.hpp | 6 ++++ player/cms/xmds/XmdsRequestSender.cpp | 10 +++++++ player/cms/xmds/XmdsRequestSender.hpp | 4 ++- 7 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 player/cms/xmds/NotifyStatus.cpp create mode 100644 player/cms/xmds/NotifyStatus.hpp diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index e7377b302..a0bfc84f1 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -100,6 +100,9 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult& requiredFiles); void updateMediaInventory(const RequiredFiles::Result& requiredFilesResult); void onSchedule(const ResponseResult& schedule); - void onSubmitted(const ResponseResult& logResult); void onSubmitStats(const ResponseResult& statsResult); template void onSubmitted(std::string_view requestName, const ResponseResult& submitResult); diff --git a/player/cms/xmds/NotifyStatus.cpp b/player/cms/xmds/NotifyStatus.cpp new file mode 100644 index 000000000..5f228bd18 --- /dev/null +++ b/player/cms/xmds/NotifyStatus.cpp @@ -0,0 +1,27 @@ +#include "NotifyStatus.hpp" + +#include "cms/xmds/Resources.hpp" + +namespace Resources = XmdsResources::NotifyStatus; + +Soap::RequestSerializer::RequestSerializer(const NotifyStatus::Request& request) : + BaseRequestSerializer(request) +{ +} + +std::string Soap::RequestSerializer::string() +{ + return createRequest(Resources::Name, request().serverKey, request().hardwareKey, request().status); +} + +Soap::ResponseParser::ResponseParser(const std::string& soapResponse) : + BaseResponseParser(soapResponse) +{ +} + +NotifyStatus::Result Soap::ResponseParser::parseBody(const XmlNode& node) +{ + NotifyStatus::Result result; + result.success = node.get(Resources::Success); + return result; +} diff --git a/player/cms/xmds/NotifyStatus.hpp b/player/cms/xmds/NotifyStatus.hpp new file mode 100644 index 000000000..7a916de65 --- /dev/null +++ b/player/cms/xmds/NotifyStatus.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include "cms/xmds/BaseRequestSerializer.hpp" +#include "cms/xmds/BaseResponseParser.hpp" +#include "cms/xmds/Soap.hpp" + +#include "common/SoapField.hpp" + +namespace NotifyStatus +{ + struct Result + { + bool success; + }; + + struct Request + { + SoapField serverKey{"serverKey"}; + SoapField hardwareKey{"hardwareKey"}; + SoapField status{"status"}; + }; +} + +template <> +class Soap::RequestSerializer : public BaseRequestSerializer +{ +public: + RequestSerializer(const NotifyStatus::Request& request); + std::string string(); +}; + +template <> +class Soap::ResponseParser : public BaseResponseParser +{ +public: + ResponseParser(const std::string& soapResponse); + +protected: + NotifyStatus::Result parseBody(const XmlNode& node) override; +}; diff --git a/player/cms/xmds/Resources.hpp b/player/cms/xmds/Resources.hpp index 8a2d539e8..0ce8a203d 100644 --- a/player/cms/xmds/Resources.hpp +++ b/player/cms/xmds/Resources.hpp @@ -131,6 +131,12 @@ namespace XmdsResources const std::string Success = "success"; } + namespace NotifyStatus + { + const std::string_view Name = "NotifyStatus"; + const std::string Success = "success"; + } + namespace SubmitScreenShot { const std::string_view Name = "SubmitScreenShot"; diff --git a/player/cms/xmds/XmdsRequestSender.cpp b/player/cms/xmds/XmdsRequestSender.cpp index d56b68cd5..bc57e4f60 100644 --- a/player/cms/xmds/XmdsRequestSender.cpp +++ b/player/cms/xmds/XmdsRequestSender.cpp @@ -123,3 +123,13 @@ FutureResponseResult XmdsRequestSender::submitScreenSh return SoapRequestHelper::sendRequest(uri_, request); } + +FutureResponseResult XmdsRequestSender::notifyStatus(const std::string& status) +{ + NotifyStatus::Request request; + request.serverKey = serverKey_; + request.hardwareKey = hardwareKey_; + request.status = status; + + return SoapRequestHelper::sendRequest(uri_, request); +} diff --git a/player/cms/xmds/XmdsRequestSender.hpp b/player/cms/xmds/XmdsRequestSender.hpp index a7b729cef..1ea3d5b86 100644 --- a/player/cms/xmds/XmdsRequestSender.hpp +++ b/player/cms/xmds/XmdsRequestSender.hpp @@ -5,6 +5,7 @@ #include "cms/xmds/GetFile.hpp" #include "cms/xmds/GetResource.hpp" #include "cms/xmds/MediaInventory.hpp" +#include "cms/xmds/NotifyStatus.hpp" #include "cms/xmds/RegisterDisplay.hpp" #include "cms/xmds/RequiredFiles.hpp" #include "cms/xmds/Schedule.hpp" @@ -36,7 +37,8 @@ class XmdsRequestSender FutureResponseResult mediaInventory(MediaInventoryItems&& items); FutureResponseResult submitLogs(const std::string& logXml); FutureResponseResult submitStats(const std::string& statXml); - FutureResponseResult submitScreenShot(const std::string& screenShot); + FutureResponseResult submitScreenShot(const std::string& screenshot); + FutureResponseResult notifyStatus(const std::string& status); private: Uri uri_; From c87e7885b6ee0a4be3a67e16899d5c0432e9196f Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Sun, 12 Jan 2020 17:34:17 +0200 Subject: [PATCH 02/10] fix: add disk usage with total and available info xibosignage#151 --- player/common/system/System.cpp | 6 ++++++ player/common/system/System.hpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/player/common/system/System.cpp b/player/common/system/System.cpp index 805a05cb6..834e3df19 100644 --- a/player/common/system/System.cpp +++ b/player/common/system/System.cpp @@ -33,3 +33,9 @@ int System::parentProcessId() { return getppid(); } + +System::DiskInfo System::diskInfo() +{ + auto spaceInfo = boost::filesystem::space("/"); + return DiskInfo{spaceInfo.capacity, spaceInfo.available}; +} diff --git a/player/common/system/System.hpp b/player/common/system/System.hpp index 2e3e1b8d1..c45966efe 100644 --- a/player/common/system/System.hpp +++ b/player/common/system/System.hpp @@ -5,9 +5,16 @@ namespace System { + struct DiskInfo + { + std::uintmax_t total; + std::uintmax_t available; + }; + MacAddress macAddress(); HardwareKey hardwareKey(); void preventSleep(); void terminateProccess(int processId); int parentProcessId(); + DiskInfo diskInfo(); } From feb697a3132dfe278d23e5e2585471f7c2ce99b4 Mon Sep 17 00:00:00 2001 From: stivius Date: Mon, 28 Dec 2020 13:54:38 +0200 Subject: [PATCH 03/10] refactor: encapsulate stats formatting --- player/cms/CollectionInterval.cpp | 3 +- player/stat/StatsRecorder.cpp | 46 +++++++++++++++++++++++++++++-- player/stat/StatsRecorder.hpp | 20 +++++++++++++- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index a0bfc84f1..cb269f233 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -95,8 +95,7 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult; + class Records + { + public: + using iterator = std::vector::iterator; + using const_iterator = std::vector::const_iterator; + + void add(Record&& record); + void clear(); + bool empty() const; + std::string string() const; + + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + + private: + std::vector records_; + }; void addLayoutStat(int layoutId, int scheduleId, const PlayingStat& interval); void addMediaStat(int scheduleId, int layoutId, int mediaId, const PlayingStat& interval); From 0f7126627e7673fc788354c1d72c3b379c5bdf23 Mon Sep 17 00:00:00 2001 From: stivius Date: Sun, 3 Jan 2021 22:01:13 +0200 Subject: [PATCH 04/10] feat: storage usage info and notify status info --- player/cms/CMakeLists.txt | 2 ++ player/cms/CollectionInterval.cpp | 10 ++++++++++ player/cms/NotifyStatusInfo.cpp | 15 +++++++++++++++ player/cms/NotifyStatusInfo.hpp | 14 ++++++++++++++ player/common/Parsing.cpp | 7 +++++++ player/common/Parsing.hpp | 1 + player/common/fs/CMakeLists.txt | 1 + player/common/fs/FileSystem.cpp | 7 +++++++ player/common/fs/FileSystem.hpp | 2 ++ player/common/fs/StorageUsageInfo.hpp | 11 +++++++++++ player/common/storage/StorageUsageInfo.cpp | 3 +++ player/common/system/System.cpp | 6 ------ player/common/system/System.hpp | 7 ------- 13 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 player/cms/NotifyStatusInfo.cpp create mode 100644 player/cms/NotifyStatusInfo.hpp create mode 100644 player/common/fs/StorageUsageInfo.hpp create mode 100644 player/common/storage/StorageUsageInfo.cpp diff --git a/player/cms/CMakeLists.txt b/player/cms/CMakeLists.txt index 4303abb2c..38eb303b4 100644 --- a/player/cms/CMakeLists.txt +++ b/player/cms/CMakeLists.txt @@ -10,6 +10,8 @@ add_library(${PROJECT_NAME} RequiredFilesDownloader.cpp RequiredFilesDownloader.hpp CmsStatus.hpp + NotifyStatusInfo.cpp + NotifyStatusInfo.hpp ${XMDS_SOURCES} ) diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index cb269f233..daf8c7f98 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -2,8 +2,11 @@ #include "MainLoop.hpp" +#include "NotifyStatusInfo.hpp" #include "common/dt/DateTime.hpp" #include "common/dt/Timer.hpp" +#include "common/fs/FileSystem.hpp" +#include "common/fs/StorageUsageInfo.hpp" #include "common/logger/Logging.hpp" #include "common/logger/XmlLogsRetriever.hpp" #include "common/storage/FileCache.hpp" @@ -100,6 +103,13 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult #include @@ -78,3 +79,9 @@ void FileSystem::writeToFile(const FilePath& path, const std::string& content) out << content; } + +StorageUsageInfo FileSystem::storageUsageFor(const FilePath& path) +{ + auto spaceInfo = fs::space(path); + return StorageUsageInfo{spaceInfo.capacity, spaceInfo.available}; +} diff --git a/player/common/fs/FileSystem.hpp b/player/common/fs/FileSystem.hpp index b5ffe15b7..5f0cfaded 100644 --- a/player/common/fs/FileSystem.hpp +++ b/player/common/fs/FileSystem.hpp @@ -3,6 +3,7 @@ #include #include +struct StorageUsageInfo; class FilePath; class FileSystem @@ -20,4 +21,5 @@ class FileSystem static FilePath currentPath(); static std::string readFromFile(const FilePath& path); static void writeToFile(const FilePath& path, const std::string& content); + static StorageUsageInfo storageUsageFor(const FilePath& path); }; diff --git a/player/common/fs/StorageUsageInfo.hpp b/player/common/fs/StorageUsageInfo.hpp new file mode 100644 index 000000000..519686bb2 --- /dev/null +++ b/player/common/fs/StorageUsageInfo.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "common/fs/FilePath.hpp" + +struct StorageUsageInfo +{ + StorageUsageInfo getFor(const FilePath& path); + + std::uintmax_t total; + std::uintmax_t available; +}; diff --git a/player/common/storage/StorageUsageInfo.cpp b/player/common/storage/StorageUsageInfo.cpp new file mode 100644 index 000000000..c56ad0e7e --- /dev/null +++ b/player/common/storage/StorageUsageInfo.cpp @@ -0,0 +1,3 @@ +#include "StorageUsageInfo.hpp" + +#include diff --git a/player/common/system/System.cpp b/player/common/system/System.cpp index 834e3df19..805a05cb6 100644 --- a/player/common/system/System.cpp +++ b/player/common/system/System.cpp @@ -33,9 +33,3 @@ int System::parentProcessId() { return getppid(); } - -System::DiskInfo System::diskInfo() -{ - auto spaceInfo = boost::filesystem::space("/"); - return DiskInfo{spaceInfo.capacity, spaceInfo.available}; -} diff --git a/player/common/system/System.hpp b/player/common/system/System.hpp index c45966efe..2e3e1b8d1 100644 --- a/player/common/system/System.hpp +++ b/player/common/system/System.hpp @@ -5,16 +5,9 @@ namespace System { - struct DiskInfo - { - std::uintmax_t total; - std::uintmax_t available; - }; - MacAddress macAddress(); HardwareKey hardwareKey(); void preventSleep(); void terminateProccess(int processId); int parentProcessId(); - DiskInfo diskInfo(); } From 877a25f6c90d2191aecc3e8b5a306e244a1f5621 Mon Sep 17 00:00:00 2001 From: stivius Date: Sun, 31 Jan 2021 14:50:01 +0200 Subject: [PATCH 05/10] feat: xibosignage#151 add current layout ID and device name to notify status --- player/XiboApp.cpp | 3 +++ player/cms/CollectionInterval.cpp | 17 ++++++++++++----- player/cms/CollectionInterval.hpp | 3 +++ player/cms/NotifyStatusInfo.cpp | 4 ++-- player/cms/NotifyStatusInfo.hpp | 3 ++- player/common/system/CMakeLists.txt | 1 + player/common/system/Hostname.hpp | 10 ++++++++++ player/common/system/System.cpp | 8 ++++++++ player/common/system/System.hpp | 2 ++ 9 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 player/common/system/Hostname.hpp diff --git a/player/XiboApp.cpp b/player/XiboApp.cpp index 6ecbcba15..21c4e580b 100644 --- a/player/XiboApp.cpp +++ b/player/XiboApp.cpp @@ -121,6 +121,9 @@ int XiboApp::run() screenShotInterval_ = createScreenshotInterval(*xmdsManager_, *mainWindow_); collectionInterval_ = createCollectionInterval(*xmdsManager_); + scheduler_->layoutUpdated().connect( + [this]() { collectionInterval_->setCurrentLayoutId(scheduler_->currentLayoutId()); }); + scheduler_->reloadSchedule(LayoutSchedule::fromFile(AppConfig::schedulePath())); scheduler_->scheduleUpdated().connect( [](const LayoutSchedule& schedule) { schedule.toFile(AppConfig::schedulePath()); }); diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index 69420240b..4d4bccf9f 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -10,6 +10,7 @@ #include "common/logger/Logging.hpp" #include "common/logger/XmlLogsRetriever.hpp" #include "common/storage/FileCache.hpp" +#include "common/system/System.hpp" #include "config/AppConfig.hpp" #include "cms/xmds/XmdsRequestSender.hpp" @@ -27,7 +28,8 @@ CollectionInterval::CollectionInterval(XmdsRequestSender& xmdsSender, intervalTimer_{std::make_unique()}, collectInterval_{DefaultInterval}, running_{false}, - status_{} + status_{}, + currentLayoutId_{EmptyLayoutId} { assert(intervalTimer_); } @@ -104,13 +106,13 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult(deviceName)); tree.put("timeZone", timezone); return Parsing::jsonToString(tree); } diff --git a/player/cms/NotifyStatusInfo.hpp b/player/cms/NotifyStatusInfo.hpp index 421e2f6c9..28500ea9a 100644 --- a/player/cms/NotifyStatusInfo.hpp +++ b/player/cms/NotifyStatusInfo.hpp @@ -1,6 +1,7 @@ #pragma once #include "common/fs/StorageUsageInfo.hpp" +#include "common/system/Hostname.hpp" #include "schedule/ScheduleItem.hpp" struct NotifyStatusInfo @@ -9,6 +10,6 @@ struct NotifyStatusInfo LayoutId currentLayoutId; StorageUsageInfo spaceUsageInfo; - std::string deviceName; + Hostname deviceName; std::string timezone; }; diff --git a/player/common/system/CMakeLists.txt b/player/common/system/CMakeLists.txt index c831eaa42..ea3e3c63e 100644 --- a/player/common/system/CMakeLists.txt +++ b/player/common/system/CMakeLists.txt @@ -11,6 +11,7 @@ add_library(${PROJECT_NAME} MacAddress.hpp MacAddressFetcher.cpp MacAddressFetcher.hpp + Hostname.hpp System.cpp System.hpp ) diff --git a/player/common/system/Hostname.hpp b/player/common/system/Hostname.hpp new file mode 100644 index 000000000..a1e0c6490 --- /dev/null +++ b/player/common/system/Hostname.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "common/types/internal/StrongType.hpp" + +#include + +struct Hostname : public StrongType +{ + using StrongType::StrongType; +}; diff --git a/player/common/system/System.cpp b/player/common/system/System.cpp index 805a05cb6..fbce1842b 100644 --- a/player/common/system/System.cpp +++ b/player/common/system/System.cpp @@ -4,6 +4,7 @@ #include "common/system/HardwareKeyGenerator.hpp" #include "common/system/MacAddressFetcher.hpp" +#include #include MacAddress System::macAddress() @@ -33,3 +34,10 @@ int System::parentProcessId() { return getppid(); } + +Hostname System::hostname() +{ + char buffer[HOST_NAME_MAX]; + gethostname(buffer, sizeof(buffer)); + return Hostname{buffer}; +} diff --git a/player/common/system/System.hpp b/player/common/system/System.hpp index 2e3e1b8d1..53387d09a 100644 --- a/player/common/system/System.hpp +++ b/player/common/system/System.hpp @@ -1,12 +1,14 @@ #pragma once #include "common/system/HardwareKey.hpp" +#include "common/system/Hostname.hpp" #include "common/system/MacAddress.hpp" namespace System { MacAddress macAddress(); HardwareKey hardwareKey(); + Hostname hostname(); void preventSleep(); void terminateProccess(int processId); int parentProcessId(); From d2365842e4dc39c410f1a37c1a831f507996b101 Mon Sep 17 00:00:00 2001 From: stivius Date: Sun, 31 Jan 2021 16:27:08 +0200 Subject: [PATCH 06/10] feat: xibosignage#151 add timezone for notify status --- .github/workflows/appimage.yml | 13 +++++++++---- player/cms/CollectionInterval.cpp | 2 +- player/common/dt/CMakeLists.txt | 8 ++++++++ player/common/dt/DateTime.cpp | 7 +++++++ player/common/dt/DateTime.hpp | 2 ++ snap/snapcraft.yaml | 13 ++++++++++++- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 281a740d4..041ca654f 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -17,8 +17,7 @@ jobs: run: | sudo apt-get update sudo apt-get -y install software-properties-common apt-transport-https ca-certificates libglibmm-2.4-dev libssl-dev - sudo apt-get -y install gnupg curl wget unzip libgtkmm-3.0-dev libwebkitgtk-3.0-dev libxss-dev - sudo apt-get -y install gnupg curl wget unzip libgtkmm-3.0-dev libwebkitgtk-3.0-dev libxss-dev + sudo apt-get -y install gnupg curl libcurl4-gnutls-devg wget unzip libgtkmm-3.0-dev libwebkitgtk-3.0-dev libxss-dev - name: Installing newer boost run: | sudo add-apt-repository ppa:mhier/libboost-latest @@ -105,11 +104,17 @@ jobs: ./autogen.sh --disable-gtk-doc make -j4 sudo make install + - name: Installing date-tz + run: | + curl -o date-tz.tar.gz -SL https://github.com/HowardHinnant/date/archive/v3.0.0.zip + tar -zxvf date-tz.tar.gz + cd date-3.0.0 + cmake . -DBUILD_TZ_LIB=ON -DBUILD_SHARED_LIBS=ON + make -j4 + sudo make install - name: Update ldconfig cache run: | - ldd /usr/local/lib/gstreamer-1.0/libgstopengl.so sudo ldconfig - ldd /usr/local/lib/gstreamer-1.0/libgstopengl.so - name: Building player run: | CXX=g++-8 CC=gcc-8 cmake player -Bbuild -DAPP_ENV=AppImage -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index 4d4bccf9f..d5568c9d9 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -110,7 +110,7 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult #include +#include "date/tz.h" + DateTime::DateTime(const DateTime::Date& date, const DateTime::Time& td) : ptime_{date, td} {} DateTime::DateTime(const boost::posix_time::ptime& ptime) : ptime_(ptime) {} @@ -71,6 +73,11 @@ DateTime DateTime::fromIsoExtendedString(const std::string& str) return DateTime{dt}; } +std::string DateTime::currentTimezone() +{ + return date::current_zone()->name(); +} + bool DateTime::valid() const { return !ptime_.is_not_a_date_time(); diff --git a/player/common/dt/DateTime.hpp b/player/common/dt/DateTime.hpp index 515304adc..86384fa0a 100644 --- a/player/common/dt/DateTime.hpp +++ b/player/common/dt/DateTime.hpp @@ -22,6 +22,8 @@ class DateTime static DateTime fromString(const std::string& str); static DateTime fromIsoExtendedString(const std::string& str); + static std::string currentTimezone(); + std::string string(const char* format) const; std::string string() const; std::time_t timestamp() const; diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1838fefe6..376a1e9a0 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -198,6 +198,17 @@ parts: - libpulse0 after: [gst-libav] + date-tz: + source: https://github.com/HowardHinnant/date/archive/v3.0.0.zip + source-subdir: date-3.0.0 + plugin: cmake + build-packages: + - libcurl4-gnutls-dev + configflags: + - -DBUILD_TZ_LIB=ON + - -DBUILD_SHARED_LIBS=ON + after: [cmake] + player: source: player plugin: cmake @@ -214,4 +225,4 @@ parts: - libwebkitgtk-3.0-0 - libgpm2 # gstreamer warning - libslang2 # gstreamer warning - after: [zmq, boost, spdlog, gtest, gstreamer] + after: [zmq, boost, spdlog, gtest, gstreamer, date-tz] From 8dfbe8e07886a07d4f3c25378e776119d9589add Mon Sep 17 00:00:00 2001 From: stivius Date: Mon, 1 Feb 2021 14:49:51 +0200 Subject: [PATCH 07/10] build: xibosignage#151 fix builds for snapcraft and AppImage --- .github/workflows/appimage.yml | 4 ++-- snap/snapcraft.yaml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 041ca654f..62a4f3298 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -17,7 +17,7 @@ jobs: run: | sudo apt-get update sudo apt-get -y install software-properties-common apt-transport-https ca-certificates libglibmm-2.4-dev libssl-dev - sudo apt-get -y install gnupg curl libcurl4-gnutls-devg wget unzip libgtkmm-3.0-dev libwebkitgtk-3.0-dev libxss-dev + sudo apt-get -y install gnupg curl libcurl4-gnutls-dev wget unzip libgtkmm-3.0-dev libwebkitgtk-3.0-dev libxss-dev - name: Installing newer boost run: | sudo add-apt-repository ppa:mhier/libboost-latest @@ -106,7 +106,7 @@ jobs: sudo make install - name: Installing date-tz run: | - curl -o date-tz.tar.gz -SL https://github.com/HowardHinnant/date/archive/v3.0.0.zip + curl -o date-tz.tar.gz -SL https://github.com/HowardHinnant/date/archive/v3.0.0.tar.gz tar -zxvf date-tz.tar.gz cd date-3.0.0 cmake . -DBUILD_TZ_LIB=ON -DBUILD_SHARED_LIBS=ON diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 376a1e9a0..ff12fc30b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -199,8 +199,7 @@ parts: after: [gst-libav] date-tz: - source: https://github.com/HowardHinnant/date/archive/v3.0.0.zip - source-subdir: date-3.0.0 + source: https://github.com/HowardHinnant/date/archive/v3.0.0.tar.gz plugin: cmake build-packages: - libcurl4-gnutls-dev From f7b7956c61ce2c1c245f8b6c26311f2e1c390da8 Mon Sep 17 00:00:00 2001 From: stivius Date: Mon, 1 Feb 2021 14:50:47 +0200 Subject: [PATCH 08/10] fix: xibosignage#151 use resource directory for disk space calculations --- player/XiboApp.cpp | 5 ++++- player/cms/CollectionInterval.cpp | 8 +++++--- player/cms/CollectionInterval.hpp | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/player/XiboApp.cpp b/player/XiboApp.cpp index 21c4e580b..a2408d81e 100644 --- a/player/XiboApp.cpp +++ b/player/XiboApp.cpp @@ -121,6 +121,8 @@ int XiboApp::run() screenShotInterval_ = createScreenshotInterval(*xmdsManager_, *mainWindow_); collectionInterval_ = createCollectionInterval(*xmdsManager_); + collectionInterval_->setCurrentLayoutId(scheduler_->currentLayoutId()); + scheduler_->layoutUpdated().connect( [this]() { collectionInterval_->setCurrentLayoutId(scheduler_->currentLayoutId()); }); @@ -229,7 +231,8 @@ void XiboApp::checkResourceDirectory() std::unique_ptr XiboApp::createCollectionInterval(XmdsRequestSender& xmdsManager) { - auto interval = std::make_unique(xmdsManager, *statsRecorder_, *fileCache_); + auto interval = + std::make_unique(xmdsManager, *statsRecorder_, *fileCache_, cmsSettings_.resourcesPath()); interval->updateInterval(playerSettings_.collectInterval()); playerSettings_.collectInterval().valueChanged().connect( diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index d5568c9d9..3cb246251 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -21,7 +21,8 @@ namespace ph = std::placeholders; CollectionInterval::CollectionInterval(XmdsRequestSender& xmdsSender, StatsRecorder& statsRecorder, - FileCache& fileCache) : + FileCache& fileCache, + const FilePath& resourceDirectory) : xmdsSender_{xmdsSender}, statsRecorder_{statsRecorder}, fileCache_{fileCache}, @@ -29,7 +30,8 @@ CollectionInterval::CollectionInterval(XmdsRequestSender& xmdsSender, collectInterval_{DefaultInterval}, running_{false}, status_{}, - currentLayoutId_{EmptyLayoutId} + currentLayoutId_{EmptyLayoutId}, + resourceDirectory_{resourceDirectory} { assert(intervalTimer_); } @@ -109,7 +111,7 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult @@ -32,7 +33,10 @@ class CollectionInterval static constexpr const uint DefaultInterval = 900; public: - CollectionInterval(XmdsRequestSender& xmdsSender, StatsRecorder& statsRecorder, FileCache& fileCache); + CollectionInterval(XmdsRequestSender& xmdsSender, + StatsRecorder& statsRecorder, + FileCache& fileCache, + const FilePath& resourceDirectory); bool running() const; void stop(); @@ -70,6 +74,7 @@ class CollectionInterval std::atomic_bool running_; CmsStatus status_; LayoutId currentLayoutId_; + FilePath resourceDirectory_; SignalSettingsUpdated settingsUpdated_; SignalScheduleAvailable scheduleAvailable_; SignalCollectionFinished collectionFinished_; From 83065cbeb3dd667b4035de1e524f7c60be8a077f Mon Sep 17 00:00:00 2001 From: stivius Date: Mon, 1 Feb 2021 16:26:36 +0200 Subject: [PATCH 09/10] build: xibosignage#151 use system timezone database --- .github/workflows/appimage.yml | 2 +- snap/snapcraft.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 62a4f3298..9f321d7ac 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -109,7 +109,7 @@ jobs: curl -o date-tz.tar.gz -SL https://github.com/HowardHinnant/date/archive/v3.0.0.tar.gz tar -zxvf date-tz.tar.gz cd date-3.0.0 - cmake . -DBUILD_TZ_LIB=ON -DBUILD_SHARED_LIBS=ON + cmake . -DBUILD_TZ_LIB=ON -DBUILD_SHARED_LIBS=ON -DUSE_SYSTEM_TZ_DB=ON make -j4 sudo make install - name: Update ldconfig cache diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ff12fc30b..55efe2032 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -206,6 +206,7 @@ parts: configflags: - -DBUILD_TZ_LIB=ON - -DBUILD_SHARED_LIBS=ON + - -DUSE_SYSTEM_TZ_DB=ON after: [cmake] player: From 8e2efdfcd0b2069e0136160c1375a79b564ab49a Mon Sep 17 00:00:00 2001 From: stivius Date: Mon, 1 Feb 2021 16:37:54 +0200 Subject: [PATCH 10/10] refactor: remove debug log --- player/cms/CollectionInterval.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/player/cms/CollectionInterval.cpp b/player/cms/CollectionInterval.cpp index 3cb246251..6ec38831a 100644 --- a/player/cms/CollectionInterval.cpp +++ b/player/cms/CollectionInterval.cpp @@ -113,7 +113,6 @@ void CollectionInterval::onDisplayRegistered(const ResponseResult