File morituri-better-htoa-handling.patch of Package morituri

diff -aur a/morituri/rip/cd.py b/morituri/rip/cd.py
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -38,6 +38,7 @@
 from morituri.extern.command import command
 
 
+SILENT = 1e-10
 MAX_TRIES = 5
 
 
@@ -404,6 +405,18 @@
             # overlay this rip onto the Table
             if number == 0:
                 # HTOA goes on index 0 of track 1
+                # ignore silence in PREGAP
+                if trackResult.peak <= SILENT:
+                    self.debug('HTOA peak %r is below SILENT threshold, disregarding', trackResult.peak)
+                    self.itable.setFile(1, 0, None,
+                    self.ittoc.getTrackStart(1), number)
+                    self.debug('Unlinking %r', trackResult.filename)
+                    os.unlink(trackResult.filename)
+                    trackResult.filename = None
+                    self.stdout.write('HTOA discarded, contains digital silence\n')
+                else:
+                    self.itable.setFile(1, 0, trackResult.filename,
+                    self.ittoc.getTrackStart(1), number)
                 self.itable.setFile(1, 0, trackResult.filename,
                     self.ittoc.getTrackStart(1), number)
             else:
openSUSE Build Service is sponsored by