Jump to content


Photo

Auto correction time when conflict timers

patch

  • Please log in to reply
11 replies to this topic

#1 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 08:36

--- 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

 


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #2 littlesat

  • PLi® Core member
  • 57,206 posts

+700
Excellent

Posted 26 December 2013 - 09:25

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

Edited by littlesat, 26 December 2013 - 09:29.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Auto correction time when conflict timers #3 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 09:29

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

 

This topic:

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


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #4 littlesat

  • PLi® Core member
  • 57,206 posts

+700
Excellent

Posted 26 December 2013 - 09:29

I meant the mechanism behind the fix...

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Auto correction time when conflict timers #5 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 09:39

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.


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #6 littlesat

  • PLi® Core member
  • 57,206 posts

+700
Excellent

Posted 26 December 2013 - 09:56

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.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Auto correction time when conflict timers #7 littlesat

  • PLi® Core member
  • 57,206 posts

+700
Excellent

Posted 26 December 2013 - 10:16

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.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Auto correction time when conflict timers #8 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 11:28

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

Ok.


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #9 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 11:53

Thank you.


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #10 ims

  • PLi® Core member
  • 13,806 posts

+214
Excellent

Posted 26 December 2013 - 18:41

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


Kdo nic nedělá, nic nezkazí!

Re: Auto correction time when conflict timers #11 Dimitrij

  • PLi® Core member
  • 10,334 posts

+351
Excellent

Posted 26 December 2013 - 19:29

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.


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: Auto correction time when conflict timers #12 ims

  • PLi® Core member
  • 13,806 posts

+214
Excellent

Posted 26 December 2013 - 19:52

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...


Kdo nic nedělá, nic nezkazí!



Also tagged with one or more of these keywords: patch

3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users