TianyiShi2001 / audiotags

Unified IO for different types of audio metadata
https://tianyishi2001.github.io/audiotags
MIT License
41 stars 29 forks source link

FR: support for X/Y style TRACKNUMBER #5

Open jamesyoungman opened 3 years ago

jamesyoungman commented 3 years ago

I have FLAC files which look like this:

$ metaflac --list Aphex_Twin/Chosen_Lords/02-Reunion_2.flac
METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4608 samples
  maximum blocksize: 4608 samples
  minimum framesize: 761 bytes
  maximum framesize: 16014 bytes
  sample_rate: 44100 Hz
  channels: 2
  bits-per-sample: 16
  total samples: 13932660
  MD5 signature: 169d402100e8b2b7f4a34be8f6e69d42
METADATA block #1
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 262
  vendor string: reference libFLAC 1.2.1 20070917
  comments: 9
    comment[0]: album=Chosen Lords
    comment[1]: discid=820d4b0a
    comment[2]: title=Reunion 2
    comment[3]: artist=Aphex Twin
    comment[4]: albumartist=Aphex Twin
    comment[5]: musicbrainz_discid=38zPtfQswmOKtZtgzc8Q3KV2KNo-
    comment[6]: artistsort=Aphex Twin
    comment[7]: date=2006-04-10
    comment[8]: tracknumber=2/10
METADATA block #2
  type: 1 (PADDING)
  is last: true
  length: 1006

audiotags's call to track_number() returns None in this case. I would prefer if it returnes Some(2).

My understanding is that this use of TRACKNUMBER may be non-standard but it's not uncommon. A number of other tools (easytags, for example) work successfully with files like this.

nVitius commented 1 year ago

I know this is an older issue, but I wanted to chime in on this.

It's definitely not an uncommon use-case. ototoy, for example, tags all their flacs with the %n/%x format for TRACKNUMBER. Also, it's common for vinyl recordings to be tagged with A1 or B1 as the TRACKNUMBER.

The vorbis comment spec does not specify that any of the fields need to be in a specific format, or that TRACKNUMBER should be an integer.

It might be complicated to change the return type of tag.track_number, but I think it makes sense for the tool to support what appears to be a common tag format.