How to use the tinytag.TinyTagException function in tinytag

To help you get started, we’ve selected a few tinytag examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github devsnd / tinytag / tinytag / __main__.py View on Github external
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))
github irmen / synthesizer / examples / jukebox / musicfiledb.py View on Github external
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)