mirror of
https://github.com/rwinkhart/flac2pod.git
synced 2026-09-02 23:27:19 -04:00
Scan tracks as individuals if there are mismatched channels
This commit is contained in:
@@ -42,23 +42,24 @@ if __name__ == "__main__":
|
|||||||
if gain != 2 and (args.force or gain == 0):
|
if gain != 2 and (args.force or gain == 0):
|
||||||
print(f"[{album}/*] Adding ReplayGain data...")
|
print(f"[{album}/*] Adding ReplayGain data...")
|
||||||
system(f"metaflac --remove-replay-gain {std_album}/*")
|
system(f"metaflac --remove-replay-gain {std_album}/*")
|
||||||
output = run(f"metaflac --add-replay-gain {std_album}/*", shell=True, stdout=PIPE, text=True)
|
output = run(f"metaflac --add-replay-gain {std_album}/*", shell=True, stderr=PIPE, text=True)
|
||||||
if output.returncode == 1:
|
if output.returncode == 1:
|
||||||
if output.stdout.__contains__('sample') or output.stdout.__contains__('resolution of'):
|
if output.stderr.__contains__('sample') or output.stderr.__contains__('resolution of') or output.\
|
||||||
print('Resolution/Sample Rate mismatch, scanning tracks as individuals...')
|
stderr.__contains__('does not match'):
|
||||||
|
print('Resolution/Sample Rate/Channel mismatch, scanning tracks as individuals...')
|
||||||
for song in listdir(album):
|
for song in listdir(album):
|
||||||
print(f"[{album}/{song}] Adding ReplayGain data...")
|
print(f"[{album}/{song}] Adding ReplayGain data...")
|
||||||
std_song = song.replace(' ', '\\ ').replace("'", "\\'").replace(')', '\\)')\
|
std_song = song.replace(' ', '\\ ').replace("'", "\\'").replace(')', '\\)')\
|
||||||
.replace('(', '\\(').replace('&', '\\&').replace('`', '\\`').replace('$', '\\$')
|
.replace('(', '\\(').replace('&', '\\&').replace('`', '\\`').replace('$', '\\$')
|
||||||
output = run(f"metaflac --add-replay-gain {std_album}/{std_song}", shell=True, stdout=PIPE,
|
output = run(f"metaflac --add-replay-gain {std_album}/{std_song}", shell=True, stderr=PIPE,
|
||||||
text=True)
|
text=True)
|
||||||
if output.returncode == 1:
|
if output.returncode == 1:
|
||||||
print('There was an error processing your files.')
|
print('There was an error processing your files.')
|
||||||
print(f"Return Code: [{str(output.returncode)}] {output.stdout}")
|
print(f"Return Code: [{str(output.returncode)}] {output.stderr}")
|
||||||
s_exit(1)
|
s_exit(1)
|
||||||
else:
|
else:
|
||||||
print('There was an error processing your files.')
|
print('There was an error processing your files.')
|
||||||
print(f"Return Code: [{str(output.returncode)}] {output.stdout}")
|
print(f"Return Code: [{str(output.returncode)}] {output.stderr}")
|
||||||
s_exit(1)
|
s_exit(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user