Commits

Guido Draheim committed 6006135

mark [DEL] items

  • Participants
  • Parent commits e906e6b

Comments (0)

Files changed (2)

File src/dvbcronrecording/computer.py

         x += u" %s@%s" % (self.channelname, ustar(self.adapter))
         x += u" (%s %s %s)" % (ustar(self.onlyday), ustar(months), ustar(self.weekday))
         x += u" '%s'" % (unicode(self.title))
+        if self.newtimeMMM == self.endtimeMMM and not self.extratimeM:
+            x += u" [DEL]"
         x += u" }"
         return x
     def __str__(self):
                 if previous.datetimeX > current.datetimeX:
                     if previous.datetimeY < current.datetimeY:
                         # previous is fully inside the current times -> delete
+                        self.logg.debug("    %s deleted as moved inside", previous.item.title)
                         previous.message += _(" deleted as moved inside")
                         previous.datetimeY = previous.datetimeX
                         previous.newtimeMMM = previous.endtimeMMM
                     else:
                         # we would actually need to swap it around
                         # the previous gets a start time after current.
+                        self.logg.debug("    %s previous moved after next recording - swapped around,", previous.item.title)
                         previous.message += _(" previous moved after next recording - swapped around,")
                         previous.datetimeX = current.datetimeY
                         previous.newtimeMMM = current.endtimeMMM + current.extratimeM
                     previous.datetimeY -= overlapY
                     if current.item.channelname != previous.item.channelname:
                         previous.message += _(" extra minutes minus %03d,") % overlapM
+                        self.logg.debug("   ^%s extra minutes minus", previous.item.title)
                     else:
                         previous.message += _(" continues")
+                        self.logg.debug("   ^%s continues", previous.item.title)
                     previous = current
                 else: 
                     extraY = datetime.timedelta(minutes = previous.extratimeM)
                         previous.endtimeMMM = previous.newtimeMMM
                         previous.extratimeM = 0
                         previous.message += _(" deleted as next one starts %s,") % MMMtoHHMM(current.newtimeMMM)
+                        self.logg.debug("   ^%s deleted as next one starts", previous.item.title)
                     else:
                         if previous.datetimeY > current.datetimeX:
                             previous.datetimeY = current.datetimeX
                             previous.endtimeMMM = current.newtimeMMM
                             if current.item.channelname != previous.item.channelname:
                                 previous.message += _(" end time set to next start %s,") % MMMtoHHMM(current.newtimeMMM)
+                                self.logg.debug("   ^%s end time set to next start", previous.item.title)
                             else:
                                 previous.message += _(" continues")
+                                self.logg.debug("   ^%s continues", previous.item.title)
                         if previous.datetimeY - previous.datetimeX < minimum:
                             previous.deleted = True
                             previous.datetimeY = previous.datetimeX
                             previous.endtimeMMM = previous.newtimeMMM
                             previous.extratimeM = 0
                             previous.message += _(" and deleted as it is too short now")
+                            self.logg.debug("   ^%s and deleted as it is too short now", previous.item.title)
                         else:
                             previous = current
             else: # previous.item.rank >= current.item.rank
                         current.datetimeX = previous.datetimeX
                         current.newtimeMMM = previous.endtimeMMM
                         current.message += _(" set start time to previous start %s,") % MMMtoHHMM(current.newtimeMMM)
+                        self.logg.debug("   %s set start time to previous start", current.item.title)
                         assert previous.datetimeY > current.datetimeX
                 if current.datetimeY <= previous.datetimeY:
                     if previous.datetimeX > current.datetimeX:
-                        current.message+= _(" previous starts after current")
+                        current.message += _(" previous starts after current")
+                        self.logg.debug("   %s previous starts after current", current.item.title)
                     current.deleted = True
                     current.datetimeX = current.datetimeY
                     current.newtimeMMM = current.endtimeMMM
                     current.extratimeM = 0
                     current.message += _(" deleted as previous one ends %s,") % MMMtoHHMM(previous.endtimeMMM)
+                    self.logg.debug("   %s deleted as previous one ends", current.item.title)
                 else:
                     if current.datetimeX < previous.datetimeY:
                         current.datetimeX = previous.datetimeY
                         current.newtimeMMM = previous.endtimeMMM + previous.extratimeM
                         if current.item.channelname != previous.item.channelname:
                             current.message += _(" set start time to previous end %s,") % MMMtoHHMM(current.newtimeMMM)
+                            self.logg.debug("   %s set start time to previous end", current.item.title)
                         else:
                             current.message += _(" continues")
+                            self.logg.debug("   %s continues", current.item.title)
                     if current.datetimeY - current.datetimeX < minimum:
                         current.deleted = True
                         current.datetimeX = current.datetimeY
                         current.newtimeMMM = current.endtimeMMM
                         current.extratimeM = 0
                         current.message += _(" and deleted as it is too short now")
+                        self.logg.debug("   %s and deleted as it is too short now", current.item.title)
                     else:
                         previous = current
     def assign_adapters_for_timelist(self, recordertimelist):
                             previous.adapter = adapter
                             done = True; break
             if not done:
-                # can not split overlapping recordings to different adapers
+                self.logg.debug(" can not split overlapping recordings to different adapers")
                 pass
     def timelist_groups(self, req, timelist, adapter = None):
         _ = Translate(PACKAGE, req.locale)
             item.months = [ elem.datetimeX.month ]
             item.adapter = elem.adapter
             if item.newtimeMMM != elem.item.newtimeMMM:
+                self.logg.debug(" [%s]>>[%s]" % (MMMtoHHMM(elem.item.newtimeMMM), MMMtoHHMM(item.newtimeMMM))) 
                 item.message += " [%s]>>[%s]" % (MMMtoHHMM(elem.item.newtimeMMM), MMMtoHHMM(item.newtimeMMM))
             if item.endtimeMMM != elem.item.endtimeMMM:
+                self.logg.debug(" [%s]<<[%s]" % (MMMtoHHMM(item.endtimeMMM), MMMtoHHMM(elem.item.endtimeMMM)))
                 item.message += " [%s]<<[%s]" % (MMMtoHHMM(item.endtimeMMM), MMMtoHHMM(elem.item.endtimeMMM))
             # ==>
             if not group or elem.datetimeX > previous.datetimeY:
                 if group:
                     yield group ; previousgroup = group; group = None
                 item.message = " ."+item.message
-                if elem.deleted: 
+                if elem.deleted:
+                    self.logg.debug("   [DEL] %s", item.title) 
                     item.message += _(" [DEL]")
                     predeletes += [ item ]
                 else:
                 # HANDOVER
                 item.message = " :"+item.message
                 if elem.deleted: 
+                    self.logg.debug("   [DEL] %s", item.title)
                     item.message += _(" [DEL]")
                     group.items += [ item ]
                 else:

File src/tests/computer_test.py

         res = self.computer.plan4(req, [a1, a2, a3, a4])
         self.logg.info("RESULT:%s", res)
         E = u"""
-{[{  [23:20-23:20]+0 nuke@0 (22 4 6) 'A1' },
+{[{  [23:20-23:20]+0 nuke@0 (22 4 6) 'A1' [DEL] },
   {  [23:20-00:30]+3 arte@0 (22 4 6) 'A2' },
   {  [00:33-01:10]+3 arte@0 (23 4 0) 'A3' },
   {  [01:13-01:50]+5 arte@0 (23 4 0) 'A4' }]}"""
         res = self.computer.plan4(req, [a1, a2, a3, a4])
         self.logg.info("RESULT:%s", res)
         E = u"""
-{[{  [23:20-23:20]+0 nuke@0 (22 4 6) 'A1' },
+{[{  [23:20-23:20]+0 nuke@0 (22 4 6) 'A1' [DEL] },
   {  [23:20-00:30]+3 arte@0 (22 4 6) 'A2' },
   {  [00:33-01:10]+3 arte@0 (23 4 0) 'A3' },
   {  [01:13-01:50]+5 arte@0 (23 4 0) 'A4' }]}"""
         self.logg.info("RESULT:%s", res)
         E = u"""
 {[{  [23:20-00:30]+3 arte@0 (22 4 6) 'A1' },
-  {  [00:20-00:20]+0 nuke@0 (23 4 0) 'A2' },
+  {  [00:20-00:20]+0 nuke@0 (23 4 0) 'A2' [DEL] },
   {  [00:33-01:10]+3 arte@0 (23 4 0) 'A3' },
   {  [01:13-01:50]+5 arte@0 (23 4 0) 'A4' }]}"""
         self.assertEqual(E, unicode(res))