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

py3: add new helper: get_replacements_list #2242

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lasers
Copy link
Contributor

@lasers lasers commented Mar 27, 2024

An alternative to PRs listed below.

I copied thresholds code. Minimal test. Allow users to be more specific.

Get placeholders_list first so we can target existing placeholders rather than all placeholders.
I don't know if this PR is the optimal solution, just an alternative.

Code untested on this player.. I tested on nvidia_smi. Sorry if you ran into issues.

This is just an idea / experiment.

Please test this.

# Ought to do dict (perform on matched string placeholders)
    replacements = {
        "artist": [
            "([\(\[][^)\]]*?(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version)[^)\]]*?[\)\]])",
            "([\-,;/])([^\-,;/])*(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version).*"
        ],
    }

# Ought to do list. (perform on all string placeholders)
    replacements = [
            "([\(\[][^)\]]*?(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version)[^)\]]*?[\)\]])",
            "([\-,;/])([^\-,;/])*(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version).*"
        ]

Solves #2234 (comment).

Closes #2234.
Closes #2237.

@lasers lasers force-pushed the replacements branch 7 times, most recently from 0596fad to 2d05477 Compare March 28, 2024 07:04
@lasers lasers marked this pull request as ready for review March 28, 2024 07:08
@lasers
Copy link
Contributor Author

lasers commented Mar 31, 2024

Ideally, we should separate this into artist and album. Who volunteer?

"([\(\[][^)\]]*?(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version)[^)\]]*?[\)\]])",
"([\-,;/])([^\-,;/])*(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version).*",

@lasers
Copy link
Contributor Author

lasers commented Oct 26, 2024

Merged verison of the two regex patterns according to GPT. Untested.

replacements = [
    r"([\(\[\-,;/][^)\],;/]*?(bonus|demo|edit|explicit|extended|feat|mono|remaster|stereo|version)[^)\],;/]*?[\)\]])"
]

@lasers lasers changed the title make self.py3.replace helper py3: add new helper: get_replacements_list Dec 23, 2024
@lasers
Copy link
Contributor Author

lasers commented Dec 23, 2024

@ultrabug Review plz.

@lasers
Copy link
Contributor Author

lasers commented Dec 24, 2024

I didn't add this for mpris and mpd_status.

I don't need this for cmus, deadbeef, moc... This PR might be better understood with more examples... is which why I added few more music modules. I can drop them... and users could contribute them later just easily... or more likely easier to leave them in... and work on mpris, mpd_status later. Idk. Modules are untested.

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.

1 participant