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

Unexpected results when filtering by year #11113

Closed
uklotzde opened this issue Dec 5, 2022 · 6 comments
Closed

Unexpected results when filtering by year #11113

uklotzde opened this issue Dec 5, 2022 · 6 comments

Comments

@uklotzde
Copy link
Contributor

uklotzde commented Dec 5, 2022

Bug Description

Filtering by an integer year only covers the special case where the corresponding date field contains an integer value. All other tracks are ignored.

Example

year:2022

Found

  • 2022

Not found

  • 2022-12-06
  • 2022-05-19T07:00:00Z

And this is only a small subset of what ID3v2 considers as valid. Surprisingly, these tracks are found when using the filter year:2022- with a trailing slash. Probably because the search is now falling back to a string-like match. The filter condition is silently ignored and simply all tracks are found, which is even worse.

Version

2.3

OS

No response

@ronso0
Copy link
Member

ronso0 commented Dec 6, 2022

And this is only a small subset of what ID3v2 considers as valid.

@uklotzde Please share your source. For 2.3 I only found TYER:
"The 'Year' frame is a numeric string with a year of the recording. This frames is always four characters long (until the year 10000)."

Assuming that any 'year' string (of any length > 4) has just one four-char numerical field (at string index 0), a quick fix is to move "year" from m_numericFilters to m_textFilters.

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2022

https://id3.org/id3v2.4.0-structure

Hence valid timestamps are yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddTHH, yyyy-MM-ddTHH:mm and yyyy-MM-ddTHH:mm:ss.

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2022

The raw year field must be treated and preserved as an arbitrary string as it is. But without parsing time stamps when importing file metadata and storing them in an appropriate format in the database this could never work as intended.

@daschuer
Copy link
Member

daschuer commented Dec 6, 2022

It is a bit complicated because of legacy:
TDRC (ID3v2.4) = TYER + TDAT (ID3v2.3)

See:
https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#id31

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2022

It is a bit complicated because of legacy: TDRC (ID3v2.4) = TYER + TDAT (ID3v2.3)

See: https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#id31

That doesn't make any difference. Applications need to handle all common values that may occur in these fields. This is not restricted to ID3v2.x.

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2022

For extracting meaningful data you need to parse those values liberally and then store them in your database: https://gitlab.com/uklotzde/aoide-rs/-/blob/dev/crates/media/src/util/mod.rs#L323

Don't expect that anyone adheres to specifications. You will find all kinds of values in user data.

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

No branches or pull requests

3 participants