Fix for non existing DYEAR information

This commit is contained in:
Dirk Alders 2025-07-28 17:31:01 +02:00
parent 8e4b94efc2
commit 0f1155465b
4 changed files with 14 additions and 2 deletions

View File

@ -104,6 +104,7 @@ def cddb(disc_id, server_url=default_server, user=default_user, host=hostname, c
return None return None
data = {} data = {}
for line in response.readlines(): for line in response.readlines():
logger.debug("CDDB line: %s", repr(line))
line = line.decode("utf-8").rstrip() line = line.decode("utf-8").rstrip()
if line == '.': # end of matches if line == '.': # end of matches
break break
@ -113,7 +114,11 @@ def cddb(disc_id, server_url=default_server, user=default_user, host=hostname, c
value = match[1].strip() value = match[1].strip()
if key: if key:
if key == KEY_YEAR: if key == KEY_YEAR:
try:
value = int(value) value = int(value)
except ValueError:
logger.warning("Could not determine KEY_YEAR... value=%s", repr(value))
value = 0
data[key] = value data[key] = value
elif match[0] == "DTITLE": elif match[0] == "DTITLE":
art_tit = value.split(" / ", 2) art_tit = value.split(" / ", 2)

View File

@ -66,4 +66,6 @@ def get_filetype(full_path):
def get_disc_device(): def get_disc_device():
return discid.get_default_device() rv = discid.get_default_device()
logger.debug("Disc device is %s", repr(rv))
return rv

View File

@ -66,6 +66,7 @@ def track_to_targetpath(basepath: str, track: dict, ext: str):
def disc_track_rip(track_num: int, target_file: str, progress_callback): def disc_track_rip(track_num: int, target_file: str, progress_callback):
logger.info("Ripping track %d to %s", track_num, target_file)
FAC_SEC_VAL = 1224 FAC_SEC_VAL = 1224
# #
cdp_cmd = subprocess.getoutput("which cdparanoia") cdp_cmd = subprocess.getoutput("which cdparanoia")
@ -119,6 +120,7 @@ def wav_to_mp3(infile: str, basepath: str, track_information, progress_callback,
logger.error("lame is required for encoding. You need to install it to your system.") logger.error("lame is required for encoding. You need to install it to your system.")
else: else:
outfile = track_to_targetpath(basepath, track_information, 'mp3') outfile = track_to_targetpath(basepath, track_information, 'mp3')
logger.info("Encoding %s to %s", infile, outfile)
cmd = [lame_cmd, "-b", str(bitrate), "-V", str(vbr), "--vbr-old", "-q", str(quaulity), infile, outfile] cmd = [lame_cmd, "-b", str(bitrate), "-V", str(vbr), "--vbr-old", "-q", str(quaulity), infile, outfile]
cmd.extend(["--tc", "Encoded by lame"]) cmd.extend(["--tc", "Encoded by lame"])
for key in track_information: for key in track_information:

View File

@ -70,6 +70,7 @@ def get_disc_data(full_path, user_callback):
if did is None: if did is None:
logger.error("Could not determine disc id...") logger.error("Could not determine disc id...")
sys.exit(1) sys.exit(1)
logger.debug("Disc-ID identified %s", repr(did))
q = media.CDDB.query(did) q = media.CDDB.query(did)
if q is None: if q is None:
data = { data = {
@ -84,9 +85,11 @@ def get_disc_data(full_path, user_callback):
return media.CDDB.my_disc_metadata(**data) return media.CDDB.my_disc_metadata(**data)
if len(q) == 1: if len(q) == 1:
logger.debug("Single database entry identified")
# Only one entry # Only one entry
did = tuple(q.keys())[0] did = tuple(q.keys())[0]
else: else:
logger.debug("Multiple databse entries identified. Asking user for feedback...")
# multiple entries (choose) # multiple entries (choose)
if user_callback is None: if user_callback is None:
logger.warning("No usercallback to handle multiple cddb choices...") logger.warning("No usercallback to handle multiple cddb choices...")