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
Added "exactcleanstrings" advanced setting. #19219
Conversation
I see that @KarellenX has added the "Wiki: Needed" label. |
No. It just means when/if it is merged, then a wiki edit is required to note the change, which can be done by anyone. Approving this PR is not dependent on the wiki edit. |
Maybe it makes sense to make more flexible and add the new advancedsettings parameter (to not break existing configs)? |
Previously, if the regex match was at the beginning of the file name, the entire file name would be removed. |
It'd be nice if could update a test case, but it looks like we have no unit tests for CUtil |
It seems there are actually some unit tests for Do you want me to go ahead with that? |
The proposed changes introduce ambiguity. It will be harder to document cleanup behaviour (which is already confusing) and may confuse users even more. I think it's match better to add a new parameter, like |
It was easier to to add a separate |
@bejhanj Thank you, looks good. It is a good idea to not allow the entire string to be erased. @garbear Can you comment on #19219 (comment)? |
…atch (rather than removing the match and everything after as the "cleanstrings" advanced setting does).
Good idea, done. |
Still waiting on @garbear to respond... @Karlson2k, any thoughts on this? |
Looks better. My 2 comments:
Then it gets my +1! |
Yes, it could result in log spew if A) a regex is invalid (which is no different than the way
I can't seem to spot the style differences, could you point them out please? |
It looks like it was on me to finish providing feedback and I let this PR fall through the cracks. Sorry about that @bejhan , and if you re-open, I'll get this in. |
No worries @garbear, it happens; I could've followed up as well. I actually no longer have a need for this feature as I've since conformed to Kodi's naming conventions. However, I can reopen if you think this feature would be of use to others. |
Maybe make a post on the forum about it, see if anyone has input. |
Description
Modifiedcleanstrings
to remove only the regex match (rather than the match onward), if it is at the beginning of the string.Added
exactcleanstrings
advanced setting that removes only the regex match.Motivation and Context
This enables prefix removal while preserving the existing suffix removal behavior.This is an alternative to the the existing
cleanstrings
advanced setting, which removes the regex match and everything after it.The motivation is to enable more precise string cleaning (such as prefix removal).
How Has This Been Tested?
Applied this to the Leia branch and compiled for Windows x64 then tested 3 cases:1. Match at beginning of movie name.2. Match partway through movie name.3. No match in movie name.advancedsettings.xml:<advancedsettings>
<video>
<cleanstrings>
<regexp>BD</regexp>
</cleanstrings>
</video>
</advancedsettings>
1. BD 50 First Dates (2004).mp42. 7 Days in Hell (2015) BD HEVC.mp43. 40 Days and 40 Nights (2002).mp4All movies were successfully scraped in UI with log providing confirmation:2021-02-12 10:19:09.678 T:12620 DEBUG: ADDON::CScraper::FindMovie: Searching for '7 Days in Hell' using The Movie Database scraper (path: 'C:\Users\Bejhan\AppData\Roaming\Kodi\addons\metadata.themoviedb.org', content: 'movies', version: '5.2.6')
...
2021-02-12 10:19:10.622 T:12620 DEBUG: VideoInfoScanner: Adding new item to movies:smb://BEJHAN-PC/Videos/Test/7 Days in Hell (2015) BD HEVC.mp4
...
2021-02-12 10:19:11.634 T:12620 DEBUG: ADDON::CScraper::FindMovie: Searching for '40 Days and 40 Nights' using The Movie Database scraper (path: 'C:\Users\Bejhan\AppData\Roaming\Kodi\addons\metadata.themoviedb.org', content: 'movies', version: '5.2.6')
...
2021-02-12 10:19:12.606 T:12620 DEBUG: VideoInfoScanner: Adding new item to movies:smb://BEJHAN-PC/Videos/Test/40 Days and 40 Nights (2002).mp4
...
2021-02-12 10:19:13.525 T:12620 DEBUG: ADDON::CScraper::FindMovie: Searching for '50 First Dates' using The Movie Database scraper (path: 'C:\Users\Bejhan\AppData\Roaming\Kodi\addons\metadata.themoviedb.org', content: 'movies', version: ~'5.2.6')
...
2021-02-12 10:19:13.865 T:12620 DEBUG: VideoInfoScanner: Adding new item to movies:smb://BEJHAN-PC/Videos/Test/BD 50 First Dates (2004).mp4
Applied this to the Leia branch and compiled for Windows x64 then tested 4 cases:
advancedsettings.xml:
All movies were successfully scraped in UI with log providing confirmation:
Screenshots (if appropriate):
Types of change
Checklist: