Trim causes ZeroDivisionError

Bug #83632 reported by Edward Clark
10
Affects Status Importance Assigned to Milestone
Jokosher
Fix Released
High
Laszlo Pandy

Bug Description

1. Load an audio file.
2. hold shift key make selection for trimming
3. Select Trim Icon

Trim does not occur but produces the following in the terminal:

Traceback (most recent call last):
  File "/home/edward/trunk/Jokosher/EventViewer.py", line 989, in TrimToSelection
    self.event.Trim(self.event.selection[0], self.event.selection[1])
  File "/home/edward/trunk/Jokosher/UndoSystem.py", line 72, in UndoWrapper
    result = func(funcSelf, *args, **kwargs)
  File "/home/edward/trunk/Jokosher/Event.py", line 426, in Trim
    leftSplit = self.split_event(start_split, False)
  File "/home/edward/trunk/Jokosher/Event.py", line 365, in split_event
    e.__UpdateAudioFadePoints()
  File "/home/edward/trunk/Jokosher/Event.py", line 951, in __UpdateAudioFadePoints
    self.__UpdateFadeLevels()
  File "/home/edward/trunk/Jokosher/Event.py", line 968, in __UpdateFadeLevels
    oneSecondInLevels = len(self.levels) / self.duration
ZeroDivisionError: integer division or modulo by zero

Using r1284.

Laszlo Pandy (laszlok)
Changed in jokosher:
assignee: nobody → laszlok2
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
David Corrales (davidcorrales) wrote :

Is this bug fixed now? I can't get to reproduce it here.
Can anyone provide a good test case audio file?

Revision history for this message
Edward Clark (eeclark) wrote :

using r1306

still occuring for me.

Revision history for this message
Laszlo Pandy (laszlok) wrote :

No it is not fixed. It happens if you try and cut really close to either edge of an event. The piece that it cuts off will have a duration of 0, and that causes the traceback. To fix this, we need an if statement checking if the duration is zero. If it is, we don't chop anything off that side. However when undoing trim, Jokosher expects to replace one clip on either side. If one of those clips was not created because if this if statement, Jokosher will crash when not finding the second clip to put back. The proper way to solve all these issues to is make trim use the atomic undo action system, which means it can specify how many actions it wishes to perform, and only those will get undone. This bug is assigned to me and I will fix it as soon as I get a chance.

Revision history for this message
Laszlo Pandy (laszlok) wrote :

r1346

Changed in jokosher:
status: Confirmed → Fix Committed
Laszlo Pandy (laszlok)
Changed in jokosher:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.