dhowden / tag

ID3, MP4 and OGG/FLAC metadata parsing in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: expose Duration() for each audio type

delucks opened this issue · comments

Hello!
I'm using your library to parse out information from a variety of different audio files for storage in a database. I'd like to store the duration of each track as well, but it looks like this library doesn't have support for getting each track's duration from the metadata headers yet. To confirm this is possible, I looked through the specs of all the formats currently supported- there are fields in all for retrieving the duration (or length as it's sometimes called). As an example, here's a python library which appears to parse all of them. I would appreciate support for this field! If you are short on time, I will start work on implementing this.

Yes, we don't currently have duration because that's digging into the audio format itself, rather than the ID3/equiv layer of metadata. I think that there was an attempt to expose bitrates in a previous pull request (see #7), which might be of some help.

I see, the approach in #7 looks similar for the specific codec they're working with. Would you mind elaborating more on your comment on issue 7 about moving the code into a sub-package? If I start working on code that works with formats rather than the metadata layer, would you like me to create a codecs/formats package and keep the implementation there separate from the main package?

Bumping up this thread — I need this feature as well and would love to help landing it, happy to take cues from you @dhowden on how to organize the code since that seemed to be a concern with the previous PR.