Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression introduced due to Python 3 port #424

Closed
JoeLametta opened this issue Nov 26, 2019 · 1 comment
Closed

Fix regression introduced due to Python 3 port #424

JoeLametta opened this issue Nov 26, 2019 · 1 comment
Assignees
Labels
Accepted Accepted issue on our roadmap Bug Generic bug: can be used together with more specific labels Regression Bug that breaks functionality known to work in previous releases
Milestone

Comments

@JoeLametta
Copy link
Collaborator

After manual testing of this port, I've found a regression (everything else appears to be working fine).
Output:

$ WHIPPER_DEBUG=DEBUG WHIPPER_LOGFILE=whipper.log whipper image verify *.cue
Traceback (most recent call last):              
  File "/usr/local/bin/whipper", line 11, in <module>
    load_entry_point('whipper==0.7.4.dev124+gc981ce2.d20191106', 'console_scripts', 'whipper')()
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/command/main.py", line 43, in main
    ret = cmd.do()
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/command/basecommand.py", line 139, in do
    return self.cmd.do()
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/command/basecommand.py", line 139, in do
    return self.cmd.do()
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/command/image.py", line 61, in do
    verified = prog.verifyImage(runner, cueImage.table)
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/common/program.py", line 561, in verifyImage
    responses = accurip.get_db_entry(table.accuraterip_path())
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/image/table.py", line 828, in accuraterip_path
    discId1, discId2 = self.accuraterip_ids()
  File "/usr/local/lib/python3.6/dist-packages/whipper-0.7.4.dev124+gc981ce2.d20191106-py3.6-linux-x86_64.egg/whipper/image/table.py", line 822, in accuraterip_ids
    discId1 &= 0xffffffff
TypeError: unsupported operand type(s) for &=: 'float' and 'int'

Debug log:

DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.common.config:loaded 1 sections from config file
DEBUG:whipper.image.table:set logName
INFO:whipper.image.cue:parsing .cue file 'HTOA Test CD - DAE Drive Features Database.cue'
DEBUG:whipper.image.cue:found track 1
DEBUG:whipper.image.cue:found index 0 of track <Track 01> in './00. HTOA Test CD - Hidden Track One Audio.flac':0
DEBUG:whipper.image.cue:found index 1 of track <Track 01> in './01. HTOA Test CD - Music (In Pregap and Track).flac':0
DEBUG:whipper.image.image:setup image start
DEBUG:whipper.image.image:schedule scan of audio length of './00. HTOA Test CD - Hidden Track One Audio.flac'
DEBUG:whipper.image.image:verifying track 1
DEBUG:whipper.image.image:schedule scan of audio length of './01. HTOA Test CD - Music (In Pregap and Track).flac'
DEBUG:whipper.image.image:verifying image
DEBUG:whipper.extern.task.task:run task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.extern.task.task:Adding listener <whipper.extern.task.task.SyncRunner object at 0x7f77d37b36a0>
DEBUG:whipper.extern.task.task:run loop
DEBUG:whipper.extern.task.task:start task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.extern.task.task:MultiSeparateTask.start()
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Checking tracks'
DEBUG:whipper.extern.task.task:MultiSeparateTask.next()
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): starting task 1 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35c0>
DEBUG:whipper.extern.task.task:Adding listener <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track (1 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track'
DEBUG:whipper.common.task:started ['soxi', '-s', './00. HTOA Test CD - Hidden Track One Audio.flac'] with pid 31609
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): started task 1 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35c0>
DEBUG:whipper.common.task:read from stdout: b'8305500\n'
DEBUG:whipper.common.task:return code was 0
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track (1 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track'
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: task <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35c0> (1 of 2)
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: pick next task
DEBUG:whipper.extern.task.task:MultiSeparateTask.next()
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): starting task 2 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35f8>
DEBUG:whipper.extern.task.task:Adding listener <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track (2 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track'
DEBUG:whipper.common.task:started ['soxi', '-s', './01. HTOA Test CD - Music (In Pregap and Track).flac'] with pid 31610
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): started task 2 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35f8>
DEBUG:whipper.common.task:read from stdout: b'10324104\n'
DEBUG:whipper.common.task:return code was 0
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track (2 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track'
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: task <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b35f8> (2 of 2)
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: all tasks done
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:stopped task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.extern.task.task:done running task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b3a20>
DEBUG:whipper.image.image:verified image
DEBUG:whipper.image.table:set logName
DEBUG:whipper.image.image:setup image done
DEBUG:whipper.image.table:set logName
INFO:whipper.image.cue:parsing .cue file 'HTOA Test CD - DAE Drive Features Database.cue'
DEBUG:whipper.image.cue:found track 1
DEBUG:whipper.image.cue:found index 0 of track <Track 01> in './00. HTOA Test CD - Hidden Track One Audio.flac':0
DEBUG:whipper.image.cue:found index 1 of track <Track 01> in './01. HTOA Test CD - Music (In Pregap and Track).flac':0
DEBUG:whipper.image.image:schedule scan of audio length of './00. HTOA Test CD - Hidden Track One Audio.flac'
DEBUG:whipper.image.image:verifying track 1
DEBUG:whipper.image.image:schedule scan of audio length of './01. HTOA Test CD - Music (In Pregap and Track).flac'
DEBUG:whipper.extern.task.task:run task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>
DEBUG:whipper.extern.task.task:Adding listener <whipper.extern.task.task.SyncRunner object at 0x7f77d37b36a0>
DEBUG:whipper.extern.task.task:run loop
DEBUG:whipper.extern.task.task:start task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>
DEBUG:whipper.extern.task.task:MultiSeparateTask.start()
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Checking tracks'
DEBUG:whipper.extern.task.task:MultiSeparateTask.next()
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): starting task 1 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3e80>
DEBUG:whipper.extern.task.task:Adding listener <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track (1 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track'
DEBUG:whipper.common.task:started ['soxi', '-s', './00. HTOA Test CD - Hidden Track One Audio.flac'] with pid 31611
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): started task 1 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3e80>
DEBUG:whipper.common.task:read from stdout: b'8305500\n'
DEBUG:whipper.common.task:return code was 0
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track (1 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track'
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: task <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3e80> (1 of 2)
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: pick next task
DEBUG:whipper.extern.task.task:MultiSeparateTask.next()
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): starting task 2 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3cc0>
DEBUG:whipper.extern.task.task:Adding listener <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>
DEBUG:whipper.extern.task.task:starting
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track (2 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 0.0 on 'Getting length of audio track'
DEBUG:whipper.common.task:started ['soxi', '-s', './01. HTOA Test CD - Music (In Pregap and Track).flac'] with pid 31612
DEBUG:whipper.extern.task.task:BaseMultiTask.next(): started task 2 of 2: <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3cc0>
DEBUG:whipper.common.task:read from stdout: b'10324104\n'
DEBUG:whipper.common.task:return code was 0
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track (2 of 2) ...'
DEBUG:whipper.extern.task.task:notifying progress: 1.0 on 'Getting length of audio track'
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: task <whipper.program.soxi.AudioLengthTask object at 0x7f77d37b3cc0> (2 of 2)
DEBUG:whipper.extern.task.task:BaseMultiTask.stopped: all tasks done
DEBUG:whipper.extern.task.task:stopping
DEBUG:whipper.extern.task.task:reset runner to None
DEBUG:whipper.extern.task.task:stopped task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>
DEBUG:whipper.extern.task.task:done running task <whipper.image.image.ImageVerifyTask object at 0x7f77d37b30b8>

Code of the relevant section:

def accuraterip_ids(self):
"""
returns both AccurateRip disc ids as a tuple of 8-char
hexadecimal strings (discid1, discid2)
"""
# AccurateRip does not take into account data tracks,
# but does count the data track to determine the leadout offset
discId1 = 0
discId2 = 0
for track in self.tracks:
if not track.audio:
continue
offset = self.getTrackStart(track.number)
discId1 += offset
discId2 += (offset or 1) * track.number
# also add end values, where leadout offset is one past the end
# of the last track
offset = self.getTrackEnd(self.tracks[-1].number) + 1
discId1 += offset
discId2 += offset * (self.getAudioTracks() + 1)
discId1 &= 0xffffffff
discId2 &= 0xffffffff
return "%08x" % discId1, "%08x" % discId2

It seems that the offset is a float (int.0).
The value of the offset comes either from offset = self.getTrackStart(track.number), relevant code here:

def getTrackStart(self, number):
"""
:param number: the track number, 1-based
:type number: int
:returns: the start of the given track number's index 1, in CD frames
:rtype: int
"""
track = self.tracks[number - 1]
return track.getIndex(1).absolute

or from offset = self.getTrackEnd(self.tracks[-1].number) + 1, relevant code here:

def getTrackEnd(self, number):
"""
:param number: the track number, 1-based
:type number: int
:returns: the end of the given track number (ie index 1 of next track)
:rtype: int
"""
# default to end of disc
end = self.leadout - 1
# if not last track, calculate it from the next track
if number < len(self.tracks):
end = self.tracks[number].getIndex(1).absolute - 1
# if on a session border, subtract the session leadin
thisTrack = self.tracks[number - 1]
nextTrack = self.tracks[number]
if int(nextTrack.session or 1) > int(thisTrack.session or 1):
gap = self._getSessionGap(nextTrack.session)
end -= gap
return end

In both cases what's alarming is that the float value seems to originate from the self.tracks[number].getIndex(index).absolute call. I don't know why that one is a float but it should be an int.
If I run the same command using whipper's code from develop branch (commit f740a0e) against the same files, it completes successfully.

This can be replicated using the files included in this ZIP archive but I don't think it depends on these specific files.

Originally posted by @JoeLametta in #411 (comment)

JoeLametta added a commit that referenced this issue Nov 26, 2019
Python 3 port

From now on whipper's codebase will be compatible only with Python 3.
NOTE: This pull request introduces a regression: more details in #424.

Special thanks to @ddevault for kickstarting the porting effort!
@JoeLametta JoeLametta changed the title Fix regression introduced in #411 Fix regression introduced due to Python 3 port Nov 26, 2019
@JoeLametta JoeLametta pinned this issue Nov 26, 2019
@JoeLametta JoeLametta added this to the 0.9.0 milestone Nov 26, 2019
@MerlijnWajer
Copy link
Collaborator

diff --git a/whipper/image/image.py b/whipper/image/image.py
index c68a6f0..1d2251c 100644
--- a/whipper/image/image.py
+++ b/whipper/image/image.py
@@ -167,7 +167,7 @@ class ImageVerifyTask(task.MultiSeparateTask):
                                  "in debug log (set RIP_DEBUG=4)")
             index = track.indexes[1]
             assert taskk.length % common.SAMPLES_PER_FRAME == 0
-            end = taskk.length / common.SAMPLES_PER_FRAME
+            end = taskk.length // common.SAMPLES_PER_FRAME
             self.lengths[trackIndex] = end - index.relative
 

@MerlijnWajer MerlijnWajer self-assigned this Dec 3, 2019
@JoeLametta JoeLametta unpinned this issue Dec 4, 2019
@JoeLametta JoeLametta added Accepted Accepted issue on our roadmap Bug Generic bug: can be used together with more specific labels Regression Bug that breaks functionality known to work in previous releases labels Dec 4, 2019
hydrian pushed a commit to hydrian/whipper that referenced this issue Dec 18, 2019
Fixes whipper-team#424.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Signed-off-by: hydrian <ben.tyger@tygerclan.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug Generic bug: can be used together with more specific labels Regression Bug that breaks functionality known to work in previous releases
Projects
None yet
Development

No branches or pull requests

2 participants