tinytag icon indicating copy to clipboard operation
tinytag copied to clipboard

TypeError while getting a ogg file.

Open secp192k1 opened this issue 5 years ago • 2 comments
trafficstars

Hello. Im using tinytag 1.4.0 with Python 3. When I try to get the information of a file with the extension ogg. It shows this error. GitHub doesn't support ogg files so I uploaded it here.

Traceback (most recent call last):
  File "C:/Users/Slimakoi/Desktop/Python/parser.py", line 17, in <module>
    print(TinyTag.get(file2.name).filesize)
  File "C:\Program Files\Python38\lib\site-packages\tinytag\tinytag.py", line 173, in get
    tag.load(tags=tags, duration=duration, image=image)
  File "C:\Program Files\Python38\lib\site-packages\tinytag\tinytag.py", line 189, in load
    self._determine_duration(self._filehandler)
  File "C:\Program Files\Python38\lib\site-packages\tinytag\tinytag.py", line 757, in _determine_duration
    self.duration = self._max_samplenum / float(self.samplerate)
TypeError: float() argument must be a string or a number, not 'NoneType'

Snippet of my code:

from tinytag import TinyTag

with open("groove.ogg", "rb") as file:
    print(TinyTag.get(file.name))

secp192k1 avatar Nov 01 '20 15:11 secp192k1

Interesting. This seems to be an issue with Flac-to-ogg mapping. (It turns out your ogg file is a flac in disguise).

I need to check the documentation and find a way to read these streams correctly at a later point in time. Here's the docs: https://xiph.org/flac/ogg_mapping.html

devsnd avatar Nov 06 '20 13:11 devsnd

Thanks for looking into it!

secp192k1 avatar Nov 06 '20 20:11 secp192k1