mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
Merge branch 'master' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox
Origin commit data
------------------
Branch: ni/coolstream
Commit: 5e69fd2b22
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-06 (Mon, 06 Feb 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1150,12 +1150,12 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
|
|||||||
if (n < 0)
|
if (n < 0)
|
||||||
return menu_return::RETURN_NONE;
|
return menu_return::RETURN_NONE;
|
||||||
|
|
||||||
const char hdidle[] = "/sbin/hd-idle";
|
|
||||||
bool have_hdidle = !access(hdidle, X_OK);
|
|
||||||
|
|
||||||
if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60)
|
if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60)
|
||||||
g_settings.hdd_sleep = 60;
|
g_settings.hdd_sleep = 60;
|
||||||
|
|
||||||
|
const char hdidle[] = "/sbin/hd-idle";
|
||||||
|
bool have_hdidle = !access(hdidle, X_OK);
|
||||||
|
|
||||||
if (have_hdidle) {
|
if (have_hdidle) {
|
||||||
system("kill $(pidof hd-idle)");
|
system("kill $(pidof hd-idle)");
|
||||||
int sleep_seconds = g_settings.hdd_sleep;
|
int sleep_seconds = g_settings.hdd_sleep;
|
||||||
@@ -1171,12 +1171,22 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
|
|||||||
}
|
}
|
||||||
if (sleep_seconds)
|
if (sleep_seconds)
|
||||||
my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str());
|
my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str());
|
||||||
|
|
||||||
|
while (n--)
|
||||||
|
free(namelist[i]);
|
||||||
|
free(namelist);
|
||||||
|
return menu_return::RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char hdparm[] = "/sbin/hdparm";
|
const char hdparm[] = "/sbin/hdparm";
|
||||||
bool have_hdparm = !access(hdparm, X_OK);
|
bool have_hdparm = !access(hdparm, X_OK);
|
||||||
if (!have_hdparm)
|
if (!have_hdparm)
|
||||||
|
{
|
||||||
|
while (n--)
|
||||||
|
free(namelist[i]);
|
||||||
|
free(namelist);
|
||||||
return menu_return::RETURN_NONE;
|
return menu_return::RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode);
|
bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode);
|
||||||
@@ -1190,12 +1200,11 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
|
|||||||
snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise);
|
snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise);
|
||||||
snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name);
|
snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name);
|
||||||
|
|
||||||
if (have_hdidle)
|
if (have_nonbb_hdparm)
|
||||||
my_system(3, hdparm, M_opt, opt);
|
|
||||||
else if (have_nonbb_hdparm)
|
|
||||||
my_system(4, hdparm, M_opt, S_opt, opt);
|
my_system(4, hdparm, M_opt, S_opt, opt);
|
||||||
else // busybox hdparm doesn't support "-M"
|
else // busybox hdparm doesn't support "-M"
|
||||||
my_system(3, hdparm, S_opt, opt);
|
my_system(3, hdparm, S_opt, opt);
|
||||||
|
|
||||||
free(namelist[i]);
|
free(namelist[i]);
|
||||||
}
|
}
|
||||||
free(namelist);
|
free(namelist);
|
||||||
|
@@ -439,14 +439,16 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
}
|
}
|
||||||
else if ((strcmp(key, "send_remotetimer") == 0) && RemoteBoxChanExists(timerlist[selected].channel_id))
|
else if ((strcmp(key, "send_remotetimer") == 0) && RemoteBoxChanExists(timerlist[selected].channel_id))
|
||||||
{
|
{
|
||||||
|
int pre,post;
|
||||||
|
Timer->getRecordingSafety(pre,post);
|
||||||
CHTTPTool httpTool;
|
CHTTPTool httpTool;
|
||||||
std::string r_url;
|
std::string r_url;
|
||||||
r_url = "http://";
|
r_url = "http://";
|
||||||
r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name);
|
r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name);
|
||||||
r_url += "/control/timer?action=new";
|
r_url += "/control/timer?action=new";
|
||||||
r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + timerlist[selected].rem_pre);
|
r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + pre);
|
||||||
r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - timerlist[selected].rem_post);
|
r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - post);
|
||||||
r_url += "&announce=" + to_string((int)timerlist[selected].announceTime);
|
r_url += "&announce=" + to_string((int)timerlist[selected].announceTime + pre);
|
||||||
r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id);
|
r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id);
|
||||||
r_url += "&aj=on";
|
r_url += "&aj=on";
|
||||||
r_url += "&rs=on";
|
r_url += "&rs=on";
|
||||||
@@ -458,13 +460,11 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
}
|
}
|
||||||
else if ((strcmp(key, "fetch_remotetimer") == 0) && LocalBoxChanExists(timerlist[selected].channel_id))
|
else if ((strcmp(key, "fetch_remotetimer") == 0) && LocalBoxChanExists(timerlist[selected].channel_id))
|
||||||
{
|
{
|
||||||
int pre,post;
|
|
||||||
Timer->getRecordingSafety(pre,post);
|
|
||||||
std::string remotebox_name = timerlist[selected].remotebox_name;
|
std::string remotebox_name = timerlist[selected].remotebox_name;
|
||||||
std::string eventID = to_string((int)timerlist[selected].eventID);
|
std::string eventID = to_string((int)timerlist[selected].eventID);
|
||||||
|
|
||||||
int res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre,
|
int res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + timerlist[selected].rem_pre,
|
||||||
timerlist[selected].stopTime - post, 0, 0, timerlist[selected].announceTime,
|
timerlist[selected].stopTime - timerlist[selected].rem_post, 0, 0, timerlist[selected].announceTime + timerlist[selected].rem_pre,
|
||||||
TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",false);
|
TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",false);
|
||||||
|
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
@@ -473,8 +473,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
|
|
||||||
if (forceAdd)
|
if (forceAdd)
|
||||||
{
|
{
|
||||||
res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre,
|
res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + timerlist[selected].rem_pre,
|
||||||
timerlist[selected].stopTime - post, 0, 0, timerlist[selected].announceTime,
|
timerlist[selected].stopTime - timerlist[selected].rem_post, 0, 0, timerlist[selected].announceTime + timerlist[selected].rem_pre,
|
||||||
TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",true);
|
TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -703,16 +703,19 @@ void CTimerList::updateEvents(void)
|
|||||||
void CTimerList::RemoteBoxSelect()
|
void CTimerList::RemoteBoxSelect()
|
||||||
{
|
{
|
||||||
int select = 0;
|
int select = 0;
|
||||||
CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER);
|
|
||||||
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
|
||||||
|
|
||||||
for (std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it)
|
if (g_settings.timer_remotebox_ip.size() > 1) {
|
||||||
m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str()));
|
CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER);
|
||||||
|
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
||||||
|
|
||||||
m->enableSaveScreen(true);
|
for (std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it)
|
||||||
m->exec(NULL, "");
|
m->addItem(new CMenuForwarder(it->rbname, it->online, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str()));
|
||||||
|
|
||||||
delete selector;
|
m->enableSaveScreen(true);
|
||||||
|
m->exec(NULL, "");
|
||||||
|
|
||||||
|
delete selector;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin();
|
std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin();
|
||||||
std::advance(it,select);
|
std::advance(it,select);
|
||||||
@@ -801,7 +804,10 @@ void CTimerList::RemoteBoxTimerList(CTimerd::TimerList &rtimerlist)
|
|||||||
{
|
{
|
||||||
printf("Failed to parse JSON\n");
|
printf("Failed to parse JSON\n");
|
||||||
printf("%s\n", reader.getFormattedErrorMessages().c_str());
|
printf("%s\n", reader.getFormattedErrorMessages().c_str());
|
||||||
}
|
it->online = false;
|
||||||
|
} else
|
||||||
|
it->online = true;
|
||||||
|
|
||||||
Json::Value delays = root["data"]["timer"][0];
|
Json::Value delays = root["data"]["timer"][0];
|
||||||
|
|
||||||
rem_pre = atoi(delays["config"].get("pre_delay","0").asString());
|
rem_pre = atoi(delays["config"].get("pre_delay","0").asString());
|
||||||
|
@@ -168,6 +168,7 @@ struct timer_remotebox_item
|
|||||||
std::string pass;
|
std::string pass;
|
||||||
std::string rbname;
|
std::string rbname;
|
||||||
std::string rbaddress;
|
std::string rbaddress;
|
||||||
|
bool online;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SNeutrinoSettings
|
struct SNeutrinoSettings
|
||||||
|
Reference in New Issue
Block a user