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

Year sanitazer fails with values met in the wild #30

Open
pyhedgehog opened this issue Jun 5, 2022 · 1 comment · May be fixed by #41
Open

Year sanitazer fails with values met in the wild #30

pyhedgehog opened this issue Jun 5, 2022 · 1 comment · May be fixed by #41

Comments

@pyhedgehog
Copy link

I've got error: ValueError: Could not extract year from: 2014-11-18 15:05:00
I propose following patch to sanitize_year():

if re.match(r'^[0-9]{4}[-\s][0-9]{2}[-\s][0-9]{2}(?:[T\s][0-9]{2}:[0-9]{2}:[0-9]{2})?$', year):

instead of

if re.match(r'^[0-9]{4}[-\s][0-9]{2}[-\s][0-9]{2}$', year):
@pyhedgehog pyhedgehog linked a pull request Apr 28, 2023 that will close this issue
@retiredprogrammer440
Copy link

I just installed music_tag and the current version still has this issue. Since by definition re.match matches the beginning of the string, I simply remover the $ in the match string. Changed:

re.match(r'^[0-9]{4}[-\s][0-9]{2}[-\s][0-9]{2}$', year):

to:

re.match(r'^[0-9]{4}[-\s][0-9]{2}[-\s][0-9]{2}', year): # Remover $ at end of string

and it worked fine

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

Successfully merging a pull request may close this issue.

2 participants