How to use the tinytag.TinyTag.get 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 dawiddydlinski / web-rpi-fm / server.py View on Github external
def file_list():
    payload = {}
    # p = subprocess.Popen("ls", stdout=subprocess.PIPE, shell=True, cwd="static/audio")
    # p.wait()
    # files = p.stdout.readlines()
    # files = [x.strip() for x in files]
    i = 0
    for r, d, f in os.walk("static/audio"):
        for f2 in f:
            try:
                file = f2
                f = TinyTag.get("static/audio/" + file, image=True)
                if not f.title:
                    f.title = file
                img_exists = os.path.isfile("static/img/" + file.split(".")[0] + ".png")
                if img_exists:
                    img_path = file.split(".")[0] + ".png"
                else:
                    img_path = None
                payload[i] = {
                    "filename": file,
                    "name": f.title,
                    "length": f.duration,
                    "author": f.artist,
                    "img": img_path
                }
                i += 1
            except:
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)