Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
usage()
try:
tag = TinyTag.get(filename, image=save_image_path is not None)
if save_image_path:
image = tag.get_image()
if image:
with open(save_image_path, 'wb') as fh:
fh.write(image)
if formatting == 'json':
print(json.dumps(tag.as_dict()))
elif formatting == 'csv':
print('\n'.join('%s,%s' % (k, v) for k, v in tag.as_dict().items()))
elif formatting == 'tsv':
print('\n'.join('%s\t%s' % (k, v) for k, v in tag.as_dict().items()))
except TinyTagException as e:
sys.stderr.write(str(e))
def get_tag(self, filename):
try:
return tinytag.TinyTag.get(filename)
except tinytag.TinyTagException as x:
print("Tag error:", x)
print("Occurred when processing file: ", filename.location.encode("ascii", errors="replace"))
return tinytag.TinyTag.get(filename, duration=False)