Created
December 30, 2015 03:17
-
-
Save pale2hall/60542d02f28305422c2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this file to rename flac files from file-name.flac to file-name.flac.part | |
# if they don't decode properly. | |
##################################################################### | |
import subprocess | |
import sys | |
import os | |
for root, dirs, files in os.walk('.'): | |
for filename in files: | |
if filename.endswith(".flac"): | |
try: | |
output = subprocess.check_output(["flac", "-t", "--totally-silent", filename]) | |
returncode = 0 | |
except subprocess.CalledProcessError as e: | |
output = e.output | |
returncode = e.returncode | |
if returncode == 1: | |
print "error for " + os.path.join(root,filename); | |
os.rename(os.path.join(root,filename), os.path.join(root,filename)+".part") | |
else: | |
print "success for " + filename; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment