Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read disc number / total number of discs? #24

Closed
EgbertW opened this issue Jan 20, 2016 · 7 comments
Closed

Read disc number / total number of discs? #24

EgbertW opened this issue Jan 20, 2016 · 7 comments

Comments

@EgbertW
Copy link
Contributor

EgbertW commented Jan 20, 2016

Thanks for the great library. I'm using it to build a script to automatically file audio files in a correct location and it's been really helpful.

However, I have several multiple-disc albums where track numbers are duplicated on each disc. The actual disc number is stored in the disc number part of the track. However, tinytag doesn't seem to read this information. Any chance for adding this in a future release?

I could give it a shot myself, but I have no idea about FLAC / OGG / MP3 ID3tag specifications and wouldn't know where to actually find this information. What sources did you use in order to implement tintytag?

@devsnd
Copy link
Owner

devsnd commented Jan 21, 2016

Hi Egbert,

All the resources on which tinytag are based are linked in the source code, you can find most specifications of the formats next to the functions/classes that implement their parsers.

What kind of audio data are you dealing with? TinyTag makes it seems as if all meta-data was the same, but actually the formats of the meta-data differs enormously between file formats.

Also, can you please provide some sample data so I can play around with it if I find the time?

@EgbertW
Copy link
Contributor Author

EgbertW commented Jan 21, 2016

I understand that. The most recent example was using FLAC audio, but I do have several occasions of the same situation in MP3. I'm not sure if all file formats support the 'disc number' tag, but it would be great to extract this data when it's available.

Due to copyright issues I can't share the media file in question, but it shouldn't be a problem to forge a sample. I'll look into it shortly.

I'll also have a look at the documentation referenced in the source code to see if I get anywhere with it.

@EgbertW
Copy link
Contributor Author

EgbertW commented Jan 21, 2016

I found the info in the docs in the source code and did an initial attempt to parse the data in: b004715

I need to test if it works correctly, but I need to gather samples for all supported formats first. It seems that disc number is supported in WMA (WM/PartOfSet), OGG (not officially but de facto as DISCNUMBER) and ID3v2 (as TPOS). That leaves it unavailable in ID3v1 but I guess that's not a big deal. I'll report back when I verified the behavior.

Additionally, I encountered a bug in the WMA implementation: the mapping of AlbumArtist was to album, rather than to artist. I fixed that while I was at it.

@EgbertW
Copy link
Contributor Author

EgbertW commented Jan 21, 2016

I put together some short samples that I found randomly on the internet of WMA, OGG, FLAC and MP3. I used a program called Mp3tag to add track numbers and disc numbers to all of them, and used these to test it. Some bugs remained, which I fixed in commit 26f8cd9 - this one reads the disc number in all of them. I moved some code around to parse the track number / total number of tracks as the same system is used for disc number, and it's also used in all formats, so I added this to _set_field() directly. In the event that the fieldname is either disc or track, it is optionally split on the '/' sign.

The samples I used are available here, for the time being:

http://www.pointpro.nl/samples.zip

@devsnd
Copy link
Owner

devsnd commented Jan 23, 2016

Hey Egbert,

Thanks for the patch, it looks very good, you even took the time to properly refactor everything, nice :)

Before I release a new version with your changes, I will create new test samples from the samples you gave me; I will have to reduce their size before I can check them in.

Anyway, thank you very much for helping, I appreciate it!

@devsnd
Copy link
Owner

devsnd commented Feb 1, 2016

Hey Egbert, I tested it and released a new version 0.11.0 on pypi.

Thanks again for the help :)

@devsnd devsnd closed this as completed Feb 1, 2016
@EgbertW
Copy link
Contributor Author

EgbertW commented Feb 1, 2016

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants