Skip to content

Commit

Permalink
[AutoTimer] auto resolve conflict offset time begin/end (30 sec)
Browse files Browse the repository at this point in the history
example - for sake of simplicity, usage is on a single tuner receiver ,
no overlaps in the timers
Timer A = 19:00 to 19:30
Timer B = 19:30 to 20:00
The above will always result in a clash because one ends at 19:30 and
the other also starts at 19:30
End 19:30:00.000 and start at 19:30:30.000 should work, but that is not
currently possible.

Merged from OpenPLi/enigma2-plugins@6798f07
  • Loading branch information
Huevos committed Jul 9, 2017
1 parent 1b8bc94 commit 04ecb2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions autotimer/src/AutoTimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,26 @@ def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLim
# Try to add timer
conflicts = recordHandler.record(newEntry)

if conflicts and not timer.hasOffset() and not config.recording.margin_before.value and not config.recording.margin_after.value and len(conflicts) > 1:
change_end = change_begin = False
conflict_begin = conflicts[1].begin
conflict_end = conflicts[1].end
if conflict_begin == newEntry.end:
newEntry.end -= 30
change_end = True
elif newEntry.begin == conflict_end:
newEntry.begin += 30
change_begin = True
if change_end or change_begin:
conflicts = recordHandler.record(newEntry)
if conflicts:
if change_end:
newEntry.end += 30
elif change_begin:
newEntry.begin -= 30
else:
doLog("[AutoTimer] The conflict is resolved by offset time begin/end (30 sec) for %s." % newEntry.name)

if conflicts:
# Maybe use newEntry.log
conflictString += ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
Expand Down

0 comments on commit 04ecb2c

Please sign in to comment.