Skip to content

Commit

Permalink
Merge pull request #4088 from xhaggi/fix-schedule-recording
Browse files Browse the repository at this point in the history
[pvr] fix: schedule recording with ending after midnight (Ticket #14165)
  • Loading branch information
jmarshallnz committed Mar 23, 2014
2 parents fd16d0b + e023778 commit 54daf75
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ void CGUIDialogPVRTimerSettings::OnSettingChanged(SettingInfo &setting)
m_tmp_diff = 365; m_tmp_diff = 365;


CDateTime newStart = timestart + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0); CDateTime newStart = timestart + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);
CDateTime newEnd = timestop + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0); CDateTime newEnd = timestop + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);

/* add a day to end time if end time is before start time */
// TODO this should be removed after separate end date control was added
if (newEnd < newStart)
newEnd += CDateTimeSpan(1, 0, 0, 0);

tag->SetStartFromLocalTime(newStart); tag->SetStartFromLocalTime(newStart);
tag->SetEndFromLocalTime(newEnd); tag->SetEndFromLocalTime(newEnd);


Expand Down Expand Up @@ -351,12 +357,19 @@ void CGUIDialogPVRTimerSettings::OnSettingChanged(SettingInfo &setting)
if (CGUIDialogNumeric::ShowAndGetTime(timerEndTime, g_localizeStrings.Get(14066))) if (CGUIDialogNumeric::ShowAndGetTime(timerEndTime, g_localizeStrings.Get(14066)))
{ {
CDateTime timestop = timerEndTime; CDateTime timestop = timerEndTime;
int start_day = tag->EndAsLocalTime().GetDay(); // TODO add separate end date control to schedule a show with more then 24 hours
int start_month = tag->EndAsLocalTime().GetMonth(); int start_day = tag->StartAsLocalTime().GetDay();
int start_year = tag->EndAsLocalTime().GetYear(); int start_month = tag->StartAsLocalTime().GetMonth();
int start_year = tag->StartAsLocalTime().GetYear();
int start_hour = timestop.GetHour(); int start_hour = timestop.GetHour();
int start_minute = timestop.GetMinute(); int start_minute = timestop.GetMinute();
CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0); CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0);

/* add a day to end time if end time is before start time */
// TODO this should be removed after separate end date control was added
if (newEnd < tag->StartAsLocalTime())
newEnd += CDateTimeSpan(1, 0, 0, 0);

tag->SetEndFromLocalTime(newEnd); tag->SetEndFromLocalTime(newEnd);


timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false); timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false);
Expand Down

0 comments on commit 54daf75

Please sign in to comment.