Commits

Guido Draheim  committed a22d28c

handle some cases of "previous starts after current" more gratiously

  • Participants
  • Parent commits c8ae4be

Comments (0)

Files changed (2)

File src/dvbcronrecording/computer.py

             if previous.datetimeY <= current.datetimeX:
                 previous = current
                 continue # nothing to do - there is a gap
-            if previous.datetimeX > current.datetimeX:
-                msg = (u"previous starts after current\nPREV %s\nNEXT %s" 
-                       % (previous, current))
-                raise Exception(msg)
             overlapY = previous.datetimeY - current.datetimeX
             overlapM = deltaM(overlapY)
             assert overlapM > 0
             if previous.item.rank < current.item.rank:
+                if previous.datetimeX > current.datetimeX:
+                    if previous.datetimeY < current.datetimeY:
+                        # previous is fully inside the current times -> delete
+                        previous.message += _(" deleted as moved inside")
+                        previous.datetimeY = previous.datetimeX
+                        previous.newtimeMMM = previous.endtimeMMM
+                        previous.extratimeM = 0
+                        previous.deleted = True
+                        previous = current
+                        continue
+                    else:
+                        msg = (u"previous starts after current\nPREV %s\nNEXT %s" 
+                               % (previous, current))
+                        raise Exception(msg)                        
                 # move previous endtime down
                 if overlapM <= previous.extratimeM:
                     previous.extratimeM -= overlapM
                             previous.message += _(" and deleted as it is too short now")
                         else:
                             previous = current
-            else:
-                # move current starttime up
+            else: # previous.item.rank >= current.item.rank
+                # ..move current starttime up
+                if previous.datetimeX > current.datetimeX:
+                    if previous.datetimeX >= current.datetimeY:
+                        msg = (u"previous starts after current\nPREV %s\nNEXT %s" 
+                               % (previous, current))
+                        raise Exception(msg)
+                    else:
+                        current.datetimeX = previous.datetimeX
+                        current.newtimeMMM = previous.endtimeMMM
+                        current.message += _(" set start time to previous start %s,") % MMMtoHHMM(current.newtimeMMM)
+                        assert previous.datetimeY > current.datetimeX
                 if current.datetimeY <= previous.datetimeY:
                     if previous.datetimeX > current.datetimeX:
                         current.message+= _(" previous starts after current")

File src/dvbcronrecording/dvbcronrecording.de.po

 
 msgid "ACTIVATE: the modified recordinglist was activated"
 msgstr "AKTIVIERT: die veränderte Aufnahmelist wurde aktiviert"
+
+msgid " deleted as moved inside"
+msgstr " gelöscht da nun innerhalb"
+
+msgid "  set start time to previous start %s,"
+msgstr " Startzeit gesetzt auf vorige Startzeit %s,"