Fix for non existing DYEAR information
This commit is contained in:
parent
8e4b94efc2
commit
0f1155465b
7
CDDB.py
7
CDDB.py
@ -104,6 +104,7 @@ def cddb(disc_id, server_url=default_server, user=default_user, host=hostname, c
|
||||
return None
|
||||
data = {}
|
||||
for line in response.readlines():
|
||||
logger.debug("CDDB line: %s", repr(line))
|
||||
line = line.decode("utf-8").rstrip()
|
||||
if line == '.': # end of matches
|
||||
break
|
||||
@ -113,7 +114,11 @@ def cddb(disc_id, server_url=default_server, user=default_user, host=hostname, c
|
||||
value = match[1].strip()
|
||||
if key:
|
||||
if key == KEY_YEAR:
|
||||
value = int(value)
|
||||
try:
|
||||
value = int(value)
|
||||
except ValueError:
|
||||
logger.warning("Could not determine KEY_YEAR... value=%s", repr(value))
|
||||
value = 0
|
||||
data[key] = value
|
||||
elif match[0] == "DTITLE":
|
||||
art_tit = value.split(" / ", 2)
|
||||
|
@ -66,4 +66,6 @@ def get_filetype(full_path):
|
||||
|
||||
|
||||
def get_disc_device():
|
||||
return discid.get_default_device()
|
||||
rv = discid.get_default_device()
|
||||
logger.debug("Disc device is %s", repr(rv))
|
||||
return rv
|
||||
|
@ -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):
|
||||
logger.info("Ripping track %d to %s", track_num, target_file)
|
||||
FAC_SEC_VAL = 1224
|
||||
#
|
||||
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.")
|
||||
else:
|
||||
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.extend(["--tc", "Encoded by lame"])
|
||||
for key in track_information:
|
||||
|
@ -70,6 +70,7 @@ def get_disc_data(full_path, user_callback):
|
||||
if did is None:
|
||||
logger.error("Could not determine disc id...")
|
||||
sys.exit(1)
|
||||
logger.debug("Disc-ID identified %s", repr(did))
|
||||
q = media.CDDB.query(did)
|
||||
if q is None:
|
||||
data = {
|
||||
@ -84,9 +85,11 @@ def get_disc_data(full_path, user_callback):
|
||||
return media.CDDB.my_disc_metadata(**data)
|
||||
|
||||
if len(q) == 1:
|
||||
logger.debug("Single database entry identified")
|
||||
# Only one entry
|
||||
did = tuple(q.keys())[0]
|
||||
else:
|
||||
logger.debug("Multiple databse entries identified. Asking user for feedback...")
|
||||
# multiple entries (choose)
|
||||
if user_callback is None:
|
||||
logger.warning("No usercallback to handle multiple cddb choices...")
|
||||
|
Loading…
x
Reference in New Issue
Block a user