kumquat-buildroot/package/kodi-pvr-mediaportal-tvserver/0003-Use-kodi-StringUtils.patch

125 lines
5.0 KiB
Diff
Raw Normal View History

From 621a98436875f8b4ceea18218a23025e0b59aeb3 Mon Sep 17 00:00:00 2001
From: phunkyfish <phunkyfish@gmail.com>
Date: Wed, 7 Oct 2020 17:46:14 +0100
Subject: [PATCH] Use kodi StringUtils
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
src/GUIDialogRecordSettings.cpp | 6 +++---
src/lib/tsreader/TSReader.cpp | 10 +++++-----
src/pvrclient-mediaportal.cpp | 3 ++-
src/utils.cpp | 3 ++-
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/GUIDialogRecordSettings.cpp b/src/GUIDialogRecordSettings.cpp
index cf36d82..8e942d2 100644
--- a/src/GUIDialogRecordSettings.cpp
+++ b/src/GUIDialogRecordSettings.cpp
@@ -9,9 +9,9 @@
#include "timers.h"
#include "utils.h"
#include "DateTime.h"
-#include "p8-platform/util/StringUtils.h"
#include <kodi/General.h>
+#include <kodi/tools/StringUtils.h>
/* Dialog item identifiers */
#define BUTTON_OK 1
@@ -106,7 +106,7 @@ bool CGUIDialogRecordSettings::OnInit()
// Populate PreRecord spin control
std::string marginStart;
- marginStart = StringUtils::Format("%d (%s)", m_timerinfo.GetMarginStart(), kodi::GetLocalizedString(30136).c_str());
+ marginStart = kodi::tools::StringUtils::Format("%d (%s)", m_timerinfo.GetMarginStart(), kodi::GetLocalizedString(30136).c_str());
m_spinPreRecord->SetType(kodi::gui::controls::ADDON_SPIN_CONTROL_TYPE_TEXT);
m_spinPreRecord->AddLabel(kodi::GetLocalizedString(30135), -1);
m_spinPreRecord->AddLabel(marginStart, m_timerinfo.GetMarginStart()); //value from XBMC
@@ -120,7 +120,7 @@ bool CGUIDialogRecordSettings::OnInit()
// Populate PostRecord spin control
std::string marginEnd;
- marginEnd = StringUtils::Format("%d (%s)", m_timerinfo.GetMarginEnd(), kodi::GetLocalizedString(30136).c_str());
+ marginEnd = kodi::tools::StringUtils::Format("%d (%s)", m_timerinfo.GetMarginEnd(), kodi::GetLocalizedString(30136).c_str());
m_spinPostRecord->SetType(kodi::gui::controls::ADDON_SPIN_CONTROL_TYPE_TEXT);
m_spinPostRecord->AddLabel(kodi::GetLocalizedString(30135), -1);
m_spinPostRecord->AddLabel(marginEnd, m_timerinfo.GetMarginEnd()); //value from XBMC
diff --git a/src/lib/tsreader/TSReader.cpp b/src/lib/tsreader/TSReader.cpp
index 1129c8e..3f9725b 100644
--- a/src/lib/tsreader/TSReader.cpp
+++ b/src/lib/tsreader/TSReader.cpp
@@ -34,7 +34,7 @@
#include "utils.h"
#include "TSDebug.h"
#include "p8-platform/util/timeutils.h"
-#include "p8-platform/util/StringUtils.h"
+#include <kodi/tools/StringUtils.h>
#ifdef LIVE555
#include "MemoryReader.h"
#include "MepoRTSPClient.h"
@@ -104,7 +104,7 @@ namespace MPTV
{
if (!tscard.TimeshiftFolderUNC.empty())
{
- StringUtils::Replace(sFileName, tscard.TimeshiftFolder.c_str(), tscard.TimeshiftFolderUNC.c_str());
+ kodi::tools::StringUtils::Replace(sFileName, tscard.TimeshiftFolder.c_str(), tscard.TimeshiftFolderUNC.c_str());
bFound = true;
}
else
@@ -129,7 +129,7 @@ namespace MPTV
if (!it->RecordingFolderUNC.empty())
{
// Remove the original base path and replace it with the given path
- StringUtils::Replace(sFileName, it->RecordingFolder.c_str(), it->RecordingFolderUNC.c_str());
+ kodi::tools::StringUtils::Replace(sFileName, it->RecordingFolder.c_str(), it->RecordingFolderUNC.c_str());
bFound = true;
break;
}
@@ -412,8 +412,8 @@ namespace MPTV
if (tmp.find("smb://") != string::npos)
{
// Convert XBMC smb share name back to a real windows network share...
- StringUtils::Replace(tmp, "smb://", "\\\\");
- StringUtils::Replace(tmp, "/", "\\");
+ kodi::tools::StringUtils::Replace(tmp, "smb://", "\\\\");
+ kodi::tools::StringUtils::Replace(tmp, "/", "\\");
}
#else
//TODO: do something useful...
diff --git a/src/pvrclient-mediaportal.cpp b/src/pvrclient-mediaportal.cpp
index 93ca1bc..fdb31e7 100644
--- a/src/pvrclient-mediaportal.cpp
+++ b/src/pvrclient-mediaportal.cpp
@@ -11,7 +11,7 @@
#include <clocale>
#include "p8-platform/util/timeutils.h"
-#include "p8-platform/util/StringUtils.h"
+#include <kodi/tools/StringUtils.h>
#include "timers.h"
#include "channels.h"
@@ -29,6 +29,7 @@
#include <kodi/General.h>
#include <kodi/Filesystem.h>
+using namespace kodi::tools;
using namespace std;
using namespace MPTV;
diff --git a/src/utils.cpp b/src/utils.cpp
index 63c823a..9b8def8 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -13,8 +13,9 @@
#include "settings.h"
#include <string>
#include <stdio.h>
-#include "p8-platform/util/StringUtils.h"
+#include <kodi/tools/StringUtils.h>
+using namespace kodi::tools;
using namespace std;
void Tokenize(const string& str, vector<string>& tokens, const string& delimiters = " ")