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

Extract song count from text #609

Merged
merged 3 commits into from
Jul 13, 2024
Merged

Extract song count from text #609

merged 3 commits into from
Jul 13, 2024

Conversation

JohnHKoh
Copy link
Contributor

@JohnHKoh JohnHKoh commented Jun 21, 2024

Use RegEx search to search for track count integer instead of using indexing. If the number cannot be extracted, return 0 as a fallback. I never hit the error in parsers, but seeing as the logic is the same, I went ahead and changed it there too.

Addresses #608

@JohnHKoh JohnHKoh force-pushed the song_count_fix branch 2 times, most recently from ffc0eba to 1d62e98 Compare June 21, 2024 17:57
song_count = second_subtitle_runs[has_views + 0]["text"].split(" ")
song_count = to_int(song_count[0]) if len(song_count) > 1 else 0
song_count_text = second_subtitle_runs[has_views + 0]["text"]
song_count_search = re.search(r"\d+", song_count_text)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Could you please add a test to check that it works for all supported languages?

Not sure what oddities we might be missing here.

@sigma67 sigma67 merged commit 08d9f30 into sigma67:main Jul 13, 2024
3 of 4 checks passed
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 this pull request may close these issues.

2 participants