←  [EN] Enduser support

Forums

»

Auto correction time when conflict timers

Dimitrij's Photo Dimitrij 26 Dec 2013

--- a/lib/python/Screens/EpgSelection.py
+++ b/lib/python/Screens/EpgSelection.py
@@ -264,7 +264,20 @@
 						self.session.nav.RecordTimer.timeChanged(x)
 				simulTimerList = self.session.nav.RecordTimer.record(entry)
 				if simulTimerList is not None:
-					self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
+					if not entry.repeated and not config.recording.margin_before.value and not config.recording.margin_after.value and len(simulTimerList) > 1:
+						change_time = False
+						conflict_begin = simulTimerList[1].begin
+						conflict_end = simulTimerList[1].end
+						if conflict_begin == entry.end:
+							entry.end -= 30
+							change_time = True
+						elif entry.begin == conflict_end:
+							entry.begin += 30
+							change_time = True
+						if change_time:
+							simulTimerList = self.session.nav.RecordTimer.record(entry)
+					if simulTimerList is not None:
+						self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
 			self["key_green"].setText(_("Remove timer"))
 			self.key_green_choice = self.REMOVE_TIMER
 		else:
--- a/lib/python/Screens/EventView.py
+++ b/lib/python/Screens/EventView.py
@@ -145,7 +145,20 @@
 						self.session.nav.RecordTimer.timeChanged(x)
 				simulTimerList = self.session.nav.RecordTimer.record(entry)
 				if simulTimerList is not None:
-					self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
+					if not entry.repeated and not config.recording.margin_before.value and not config.recording.margin_after.value and len(simulTimerList) > 1:
+						change_time = False
+						conflict_begin = simulTimerList[1].begin
+						conflict_end = simulTimerList[1].end
+						if conflict_begin == entry.end:
+							entry.end -= 30
+							change_time = True
+						elif entry.begin == conflict_end:
+							entry.begin += 30
+							change_time = True
+						if change_time:
+							simulTimerList = self.session.nav.RecordTimer.record(entry)
+					if simulTimerList is not None:
+						self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
 			self["key_green"].setText(_("Remove timer"))
 			self.key_green_choice = self.REMOVE_TIMER
 		else:
--- a/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
+++ b/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
@@ -1050,7 +1050,20 @@
 						self.session.nav.RecordTimer.timeChanged(x)
 				simulTimerList = self.session.nav.RecordTimer.record(entry)
 				if simulTimerList is not None:
-					self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
+					if not entry.repeated and not config.recording.margin_before.value and not config.recording.margin_after.value and len(simulTimerList) > 1:
+						change_time = False
+						conflict_begin = simulTimerList[1].begin
+						conflict_end = simulTimerList[1].end
+						if conflict_begin == entry.end:
+							entry.end -= 30
+							change_time = True
+						elif entry.begin == conflict_end:
+							entry.begin += 30
+							change_time = True
+						if change_time:
+							simulTimerList = self.session.nav.RecordTimer.record(entry)
+					if simulTimerList is not None:
+						self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
 			self["key_green"].setText(_("Remove timer"))
 			self.key_green_choice = self.REMOVE_TIMER
 		else:
--- a/RecordTimer.py
+++ b/RecordTimer.py
@@ -793,6 +793,7 @@
 		type = 0
 		time_match = 0
 		bt = None
+		check_offset_time = not config.recording.margin_before.value and not config.recording.margin_after.value
 		end = begin + duration
 		refstr = str(service)
 		for x in self.timer_list:
@@ -825,7 +826,13 @@
 							break
 			if check:
 				timer_end = x.end
+				timer_begin = x.begin
 				type_offset = 0
+				if not x.repeated and check_offset_time:
+					if 0 < end - timer_end <= 59:
+						timer_end = end
+					elif 0 < timer_begin - begin <= 59:
+						timer_begin = begin
 				if x.justplay:
 					type_offset = 5
 					if (timer_end - x.begin) <= 1:
@@ -878,14 +885,14 @@
 									time_match = (end2 - begin2) * 60
 									type = type_offset + 2
 				else:
-					if begin < x.begin <= end:
+					if begin < timer_begin <= end:
 						if timer_end < end: # recording within event
-							time_match = timer_end - x.begin
+							time_match = timer_end - timer_begin
 							type = type_offset + 3
 						else:           # recording last part of event
-							time_match = end - x.begin
+							time_match = end - timer_begin
 							type = type_offset + 1
-					elif x.begin <= begin <= timer_end:
+					elif timer_begin <= begin <= timer_end:
 						if timer_end < end: # recording first part of event
 							time_match = timer_end - begin
 							type = type_offset + 4

 

Quote

littlesat's Photo littlesat 26 Dec 2013

Can you please explain what you meant with autocorrection...
So everyone understands...
Edited by littlesat, 26 December 2013 - 09:29.
Quote

Dimitrij's Photo Dimitrij 26 Dec 2013

Can you please explain what you meant with autocorrection...
So everything understands...

 

This topic:

http://openpli.org/f...ndpost&p=392546

Quote

littlesat's Photo littlesat 26 Dec 2013

I meant the mechanism behind the fix...
Quote

Dimitrij's Photo Dimitrij 26 Dec 2013

I meant the mechanism behind the fix...

I can not explain it in English.

Something like this:
add / remove 30 seconds for the new timer depending on the situation.

Quote

littlesat's Photo littlesat 26 Dec 2013

And the patch file is not usable for us... Please learn how to make usable patch files....

 

Now I need new fixes for the wakeup (deep)standby zaptimer stuff...


Edited by littlesat, 26 December 2013 - 10:01.
Quote

littlesat's Photo littlesat 26 Dec 2013

I did commit it...

But I see some repetitive code on 3 seperate places. It might be considered to find a way to improve this (later).


Edited by littlesat, 26 December 2013 - 10:17.
Quote

Dimitrij's Photo Dimitrij 26 Dec 2013

Now I need new fixes for the wakeup (deep)standby zaptimer stuff...

Ok.

Quote

Dimitrij's Photo Dimitrij 26 Dec 2013

Thank you.

Quote

ims's Photo ims 26 Dec 2013

My question is - why are not tested timerevent with margins ? Would not be easier take timerevent always as < Start-margin_before, End+margin_after>  ?

Quote

Dimitrij's Photo Dimitrij 26 Dec 2013

My question is - why are not tested timerevent with margins ? Would not be easier take timerevent always as < Start-margin_before, End+margin_after>  ?

According to my logic in this case is no automatic correction.

Only manually.

Quote

ims's Photo ims 26 Dec 2013

yes, but when somebody using margins, then he want not thinking about it and he take event as whole recording duration. Then may be, he will want automatic correction using too. 

May be, in case, when is conflict, there could be Q: Use autocorrection Yes/No. Do not know...

Quote