mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
movieplayer: more readability in code to search for livestream script
Origin commit data
------------------
Commit: 9855748197
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-09-27 (Thu, 27 Sep 2018)
Origin message was:
------------------
- movieplayer: more readability in code to search for livestream script
This commit is contained in:
@@ -1113,22 +1113,42 @@ bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &scri
|
||||
|
||||
if (_script.find("/") == std::string::npos)
|
||||
{
|
||||
bool webradio = (m_ThisMode == NeutrinoModes::mode_webradio);
|
||||
|
||||
std::string _s = g_settings.livestreamScriptPath + "/" + _script;
|
||||
printf("[%s:%s:%d] script: %s\n", __file__, __func__, __LINE__, _s.c_str());
|
||||
std::list<std::string> paths;
|
||||
// try livestreamScript from user's livestreamScriptPath
|
||||
paths.push_back(g_settings.livestreamScriptPath);
|
||||
// try livestreamScripts from webradio/webtv autoload directories
|
||||
if (!file_exists(_s.c_str()))
|
||||
if (m_ThisMode == NeutrinoModes::mode_webradio)
|
||||
{
|
||||
_s = std::string(webradio ? WEBRADIODIR_VAR : WEBTVDIR_VAR) + "/" + _script;
|
||||
printf("[%s:%s:%d] script: %s\n", __file__, __func__, __LINE__, _s.c_str());
|
||||
paths.push_back(WEBRADIODIR_VAR);
|
||||
paths.push_back(WEBRADIODIR);
|
||||
}
|
||||
if (!file_exists(_s.c_str()))
|
||||
else
|
||||
{
|
||||
_s = std::string(webradio ? WEBRADIODIR : WEBTVDIR) + "/" + _script;
|
||||
printf("[%s:%s:%d] script: %s\n", __file__, __func__, __LINE__, _s.c_str());
|
||||
paths.push_back(WEBTVDIR_VAR);
|
||||
paths.push_back(WEBTVDIR);
|
||||
}
|
||||
|
||||
std::string _s;
|
||||
_s.clear();
|
||||
|
||||
for (std::list<std::string>::iterator it = paths.begin(); it != paths.end(); ++it)
|
||||
{
|
||||
_s = *it + "/" + _script;
|
||||
if (file_exists(_s.c_str()))
|
||||
break;
|
||||
_s.clear();
|
||||
}
|
||||
|
||||
if (!_s.empty())
|
||||
{
|
||||
_script = _s;
|
||||
printf("[%s:%s:%d] script: %s\n", __file__, __func__, __LINE__, _script.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(">>>>> [%s:%s:%d] script not found: %s\n", __file__, __func__, __LINE__, _script.c_str());
|
||||
return false;
|
||||
}
|
||||
_script = _s;
|
||||
}
|
||||
size_t pos = _script.find(".lua");
|
||||
if (!file_exists(_script.c_str()) || (pos == std::string::npos) || (_script.length()-pos != 4)) {
|
||||
|
Reference in New Issue
Block a user