[mythtv-commits] Ticket #6529: Mythshutdown return codes not consistent
MythTV
mythtv at cvs.mythtv.org
Thu May 7 19:14:48 UTC 2009
#6529: Mythshutdown return codes not consistent
-------------------------------------------------+--------------------------
Reporter: jens_eltze at yahoo.de | Owner: ijr
Type: defect | Status: new
Priority: minor | Milestone: unknown
Component: MythTV - Mythwelcome & Mythshutdown | Version: unknown
Severity: low | Mlocked: 0
-------------------------------------------------+--------------------------
Hi,
I am using mythwelcome and mythshutdown including the periodic daily wake-
up times for my MythTV server. I tried to implement that by using
mythshutdown -t for setting the next scheduled startup time and then
mythshutdown --shutdown to call a script that writes the next startup time
to the ACPI.
Unfortunately this does NOT work without a tweak, as the return code for
int setScheduledWakeupTime() is not consistent with the return code of int
setWakeupTime(QString sWakeupTime). Instead of returning an integer value
it returns a boolean, and the boolean is oppposite to what is expected by
the main program to shutdown properly.
Explanation:
int setWakeupTime(QString sWakeupTime) returns a 1 if an error occurs or a
0 if the function was able to set the time.
int setScheduledWakeupTime() returns a true (!=0) if it was able to set a
new wakeup time or a false (==0) if not setup time was set.
This is conflicting and causing problems with the integration.
Recommended Change:
int setScheduledWakeupTime():
-> remove true/false for return codes
-> return 0 if it was able to set a new wakeup time
-> return 1 if no scheduled wakeup time was found
So basically:
// set the wakeup time for the next scheduled recording
if (!m_nextRecordingStart.isNull())
{
int m_preRollSeconds = gContext->GetNumSetting("RecordPreRoll");
QDateTime restarttime = m_nextRecordingStart.addSecs((-1) *
m_preRollSeconds);
int add = gContext->GetNumSetting("StartupSecsBeforeRecording", 240);
if (add) restarttime = restarttime.addSecs((-1) * add);
QString wakeup_timeformat = Context->GetSetting("WakeupTimeFormat",
"yyyy-MM-ddThh:mm");
return setWakeupTime(restarttime.toString(wakeup_timeformat));
}
return 1;
}
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/6529>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list