Skip to content

Commit 5c003c1

Browse files
authored
Merge pull request #1859 from CastagnaIT/err_msg
[Cleanup] Make GUI error messages less technical
2 parents 647c08d + b7abe55 commit 5c003c1

File tree

6 files changed

+57
-13
lines changed

6 files changed

+57
-13
lines changed

inputstream.adaptive/resources/language/resource.language.en_gb/strings.po

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,35 @@ msgstr ""
366366
msgctxt "#30301"
367367
msgid "Unable to play the stream.{[CR]Error: {error-details}}"
368368
msgstr ""
369+
370+
msgctxt "#30302"
371+
msgid "The decryptor path is not set in the add-on settings."
372+
msgstr ""
373+
374+
msgctxt "#30303"
375+
msgid "A problem occurred with the DRM decryptor."
376+
msgstr ""
377+
378+
msgctxt "#30304"
379+
msgid "Cannot load Widevine CDM library."
380+
msgstr ""
381+
382+
msgctxt "#30305"
383+
msgid "Cannot initialize Widevine CDM library."
384+
msgstr ""
385+
386+
msgctxt "#30306"
387+
msgid "The configuration to play the stream is incomplete or missing."
388+
msgstr ""
389+
390+
msgctxt "#30307"
391+
msgid "Cannot download the stream manifest file."
392+
msgstr ""
393+
394+
msgctxt "#30308"
395+
msgid "A problem occurred in the stream initialization."
396+
msgstr ""
397+
398+
msgctxt "#30309"
399+
msgid "No audio/video stream can be played."
400+
msgstr ""

src/Session.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ SResult SESSION::CSession::Initialize(std::string manifestUrl)
100100

101101
CURL::HTTPResponse manifestResp;
102102
if (!CURL::DownloadFile(manifestUrl, manifestHeaders, {"etag", "last-modified"}, manifestResp))
103-
return SResult::Error("Cannot download the manifest file.");
103+
return SResult::Error(GUI::GetLocalizedString(30307));
104104

105105
// The download speed with small file sizes is not accurate, we should download at least 512Kb
106106
// to have a sufficient acceptable value to calculate the bandwidth,
@@ -115,12 +115,18 @@ SResult SESSION::CSession::Initialize(std::string manifestUrl)
115115

116116
m_adaptiveTree = PLAYLIST_FACTORY::CreateAdaptiveTree(manifestResp);
117117
if (!m_adaptiveTree)
118-
return SResult::Error("Unable to determine type of manifest file.");
118+
{
119+
LOG::LogF(LOGERROR, "Unable to determine type of manifest file.");
120+
return SResult::Error(GUI::GetLocalizedString(30308));
121+
}
119122

120123
m_adaptiveTree->Configure(m_reprChooser, kodiProps.GetManifestUpdParams());
121124

122125
if (!m_adaptiveTree->Open(manifestResp.effectiveUrl, manifestResp.headers, manifestResp.data))
123-
return SResult::Error("Cannot parse the manifest file.");
126+
{
127+
LOG::LogF(LOGERROR, "Cannot parse the manifest file.");
128+
return SResult::Error(GUI::GetLocalizedString(30308));
129+
}
124130

125131
m_adaptiveTree->PostOpen();
126132
m_reprChooser->PostInit();
@@ -349,7 +355,7 @@ void SESSION::CSession::InitializePeriod()
349355
{
350356
LOG::LogF(LOGERROR,
351357
"No stream can be played, common causes: resolution limits or HDCP problem");
352-
GUI::ErrorDialog("No stream can be played");
358+
GUI::ErrorDialog(GUI::GetLocalizedString(30309));
353359
}
354360
}
355361

src/decrypters/DrmEngine.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,25 @@ SResult CreateDRM(std::string_view keySystem, std::shared_ptr<DRM::IDecrypter>&
5151
std::string decrypterPath = CSrvBroker::GetSettings().GetDecrypterPath();
5252
if (decrypterPath.empty())
5353
{
54-
return SResult::Error("Decrypter path not set in the add-on settings.");
54+
LOG::LogF(LOGERROR, "No decrypter path set in the add-on settings");
55+
return SResult::Error(GUI::GetLocalizedString(30302));
5556
}
5657

5758
drm = DRM::FACTORY::GetDecrypter(KSToCryptoKeySystem(keySystem));
5859

5960
if (!drm)
6061
{
61-
return SResult::Error("Unable to create the DRM decrypter.");
62+
LOG::LogF(LOGERROR, "Unable to create the DRM decrypter");
63+
return SResult::Error(GUI::GetLocalizedString(30303));
6264
}
6365

6466
drm->SetLibraryPath(decrypterPath);
6567

6668
if (!drm->Initialize())
6769
{
6870
drm = nullptr;
69-
return SResult::Error("Unable to initialize the DRM decrypter.");
71+
LOG::LogF(LOGERROR, "Unable to initialize the DRM decrypter");
72+
return SResult::Error(GUI::GetLocalizedString(30303));
7073
}
7174

7275
return SResultCode::OK;

src/decrypters/widevine/WVCdmAdapter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "cdm/debug.h"
1515
#include "decrypters/Helpers.h"
1616
#include "utils/FileUtils.h"
17+
#include "utils/GUIUtils.h"
1718
#include "utils/log.h"
1819

1920
using namespace UTILS;
@@ -101,11 +102,11 @@ SResult CWVCdmAdapter::Initialize(const DRM::Config& config, CWVDecrypter* host)
101102
if (!cdmAdapter->LoadCDM())
102103
{
103104
LOG::Log(LOGERROR, "Unable to load widevine shared library (%s)", cdmPath.c_str());
104-
return SResult::Error("Cannot load Widevine CDM.");
105+
return SResult::Error(GUI::GetLocalizedString(30304));
105106
}
106107

107108
if (!cdmAdapter->Initialize())
108-
return SResult::Error("Cannot initialize Widevine CDM.");
109+
return SResult::Error(GUI::GetLocalizedString(30305));
109110

110111
const std::vector<uint8_t>& cert = m_config.license.serverCert;
111112
if (!cert.empty())

src/decrypters/widevine/WVDecrypter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "WVCencSingleSampleDecrypter.h"
1414
#include "utils/Base64Utils.h"
1515
#include "utils/FileUtils.h"
16+
#include "utils/GUIUtils.h"
1617
#include "utils/StringUtils.h"
1718
#include "utils/log.h"
1819

@@ -63,8 +64,8 @@ SResult CWVDecrypter::OpenDRMSystem(const DRM::Config& config)
6364
{
6465
if (config.license.serverUri.empty())
6566
{
66-
LOG::LogF(LOGERROR, "The DRM license server url has not been specified");
67-
return SResult::Error("Missing DRM license server URL.");
67+
LOG::LogF(LOGERROR, "The DRM license server url has not been configured");
68+
return SResult::Error(GUI::GetLocalizedString(30306));
6869
}
6970

7071
auto cdmAdapter = std::make_shared<CWVCdmAdapter>();

src/decrypters/widevineandroid/WVDecrypter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "common/AdaptiveDecrypter.h"
1414
#include "decrypters/Helpers.h"
1515
#include "utils/Base64Utils.h"
16+
#include "utils/GUIUtils.h"
1617
#include "utils/log.h"
1718

1819
#include <jni/src/ClassLoader.h>
@@ -56,8 +57,8 @@ SResult CWVDecrypterA::OpenDRMSystem(const DRM::Config& config)
5657
{
5758
if (config.license.serverUri.empty())
5859
{
59-
LOG::LogF(LOGERROR, "The DRM license server url has not been specified");
60-
return SResult::Error("Missing DRM license server URL.");
60+
LOG::LogF(LOGERROR, "The DRM license server url has not been configured");
61+
return SResult::Error(GUI::GetLocalizedString(30306));
6162
}
6263

6364
m_WVCdmAdapter = std::make_shared<CWVCdmAdapterA>(config.keySystem, config, m_classLoader, this);

0 commit comments

Comments
 (0)