Fixed m3u and cue sheet generation

Added conditional to `program.write_m3u()` to
ignore skipped tracks.

Added skipped_tracks support to the `Program` and
`image.ImageVerifyTask` classes to avoid crashing
when a file for a skipped track doesn't exist.

Added conditional to `accurip.calculate_checksums`
to check if a path exists before trying to calculate
checksums, this prevents `accuraterip-checksum.c` from
emitting an error message (`sf_open failed!`) when a
path doesn't exist (as when a track is skipped).

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
This commit is contained in:
blueblots
2021-02-20 15:15:22 +00:00
committed by JoeLametta
parent 13e1ab6c14
commit 6505591462
4 changed files with 37 additions and 16 deletions

View File

@@ -57,6 +57,7 @@ class Program:
metadata = None
outdir = None
result = None
skipped_tracks = None
def __init__(self, config, record=False):
"""
@@ -612,7 +613,12 @@ class Program:
"""
cueImage = image.Image(self.cuePath)
# assigns track lengths
verifytask = image.ImageVerifyTask(cueImage)
if self.skipped_tracks is not None:
verifytask = image.ImageVerifyTask(cueImage,
[os.path.basename(t.filename)
for t in self.skipped_tracks])
else:
verifytask = image.ImageVerifyTask(cueImage)
runner.run(verifytask)
if verifytask.exception:
logger.error(verifytask.exceptionMessage)
@@ -627,6 +633,7 @@ class Program:
])
if not (checksums and any(checksums['v1']) and any(checksums['v2'])):
return False
return accurip.verify_result(self.result, responses, checksums)
def write_m3u(self, discname):
@@ -637,6 +644,8 @@ class Program:
if not track.filename:
# false positive htoa
continue
if track.skipped:
continue
if track.number == 0:
length = (self.result.table.getTrackStart(1) /
common.FRAMES_PER_SECOND)