1
0
Fork 0
mirror of https://github.com/putnam/binmerge.git synced 2025-04-19 08:28:06 +02:00

add error message for broken or blank cuesheets

This commit is contained in:
Chris Putnam 2024-02-06 00:37:34 -06:00
parent 6653879620
commit a8c34ae00a

View file

@ -98,6 +98,9 @@ class File:
self.tracks = []
self.size = os.path.getsize(filename)
class ZeroBinFilesException(Exception):
pass
class BinFilesMissingException(Exception):
pass
@ -134,6 +137,9 @@ def read_cue_file(cue_path):
if bin_files_missing:
raise BinFilesMissingException
if not len(files):
raise ZeroBinFilesException
if len(files) == 1:
# only 1 file, assume splitting, calc sectors of each
next_item_offset = files[0].size // Track.globalBlocksize
@ -323,6 +329,9 @@ def main():
except BinFilesMissingException:
e("One or more bin files were missing on disk. Aborting.")
return False
except ZeroBinFilesException:
e("Unable to parse any bin files in the cuesheet. Is it empty?")
return False
except Exception as exc:
e("Error parsing cuesheet. Is it valid?")
traceback.print_exc()