Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 bad request using Python 3 (mediatools or discisrc backend) #74

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions isrcsubmit.py
Expand Up @@ -689,7 +689,7 @@ def gather_isrcs(disc, backend, device):
# redundant to "libdiscid", but this might be handy for prerelease testing
elif backend == "discisrc":
pattern = \
br'Track\s+([0-9]+)\s+:\s+([A-Z]{2})-?([A-Z0-9]{3})-?(\d{2})-?(\d{5})'
r'Track\s+([0-9]+)\s+:\s+([A-Z]{2})-?([A-Z0-9]{3})-?(\d{2})-?(\d{5})'
try:
if sys.platform == "darwin":
device = get_real_mac_device(device)
Expand All @@ -698,24 +698,24 @@ def gather_isrcs(disc, backend, device):
except OSError as err:
backend_error(err)
for line in isrcout:
line = decode(line) # explicitely decode from pipe
if options.debug:
printf(line) # already includes a newline
if line.startswith(b"Track") and len(line) > 12:
if line.startswith("Track") and len(line) > 12:
match = re.search(pattern, line)
if match is None:
print("can't find ISRC in: %s" % line)
continue
track_number = int(match.group(1))
isrc = ("%s%s%s%s" % (match.group(2), match.group(3),
match.group(4), match.group(5)))
isrc = decode(isrc)
backend_output.append((track_number, isrc))

# media_info is a preview version of mediatools, both are for Windows
# this does some kind of raw read
elif backend in ["mediatools", "media_info"]:
pattern = \
br'ISRC\s+([0-9]+)\s+([A-Z]{2})-?([A-Z0-9]{3})-?(\d{2})-?(\d{5})'
r'ISRC\s+([0-9]+)\s+([A-Z]{2})-?([A-Z0-9]{3})-?(\d{2})-?(\d{5})'
if backend == "mediatools":
args = [backend, "drive", device, "isrc"]
else:
Expand All @@ -726,17 +726,17 @@ def gather_isrcs(disc, backend, device):
except OSError as err:
backend_error(err)
for line in isrcout:
line = decode(line) # explicitely decode from pipe
if options.debug:
printf(line) # already includes a newline
if line.startswith(b"ISRC") and not line.startswith(b"ISRCS"):
if line.startswith("ISRC") and not line.startswith("ISRCS"):
match = re.search(pattern, line)
if match is None:
print("can't find ISRC in: %s" % line)
continue
track_number = int(match.group(1))
isrc = ("%s%s%s%s" % (match.group(2), match.group(3),
match.group(4), match.group(5)))
isrc = decode(isrc)
backend_output.append((track_number, isrc))

# cdrdao will create a temp file and we delete it afterwards
Expand Down