kawaiiDango / pano-scrobbler

Scrobbles to last.fm, ListenBrainz, libre.fm, GNU FM, Maloja, Pleroma or to a file, on Android
https://kawaiidango.github.io/pano-scrobbler/
GNU General Public License v3.0
1.11k stars 30 forks source link

Regex extract to only apply if word found in string #393

Closed nicoleahmed closed 10 months ago

nicoleahmed commented 10 months ago

Hi

Great app.

I would like to use regex rules only when certain combos are found in the field

Specifically a delimiter proceeded by BBC or MTV

I tried using a look ahead which didn't work.

Im wanting to split a track name into track and album but only if those words are found

E. G.

Nicole 's song (BBC live lounge) Would become Track: Nicole's song Album: BBC live lounge

But "Nicole's song - festival of light" would be unaffected

Screenshot_20231206-114409 Screenshot_20231206-114416

nicoleahmed commented 10 months ago

Another separate issue to the groups matching question (apply rule only if test group present)

Is that that the rule is applied even if not all the fields are matched. Example I have to put an artist field in to extract. But the rule is applied in testing even when there is no track info provided - just artist info.

I assumed this would be AND logic rather than OR logic

But what I'm seeing in testing is that my test filter is applied even with the artist field Screenshot_20231206-115443 Screenshot_20231206-115436

nicoleahmed commented 10 months ago

It works properly in testing if artist info is excluded. But regex extract can't be used without an artist field

I only want to extract album information and leave artist alone.

Is there a way to do this?

Screenshot_20231206-120028

nicoleahmed commented 10 months ago

I think the issue would be fixed if artist group wasnt compulsory Screenshot_20231206-120311

nicoleahmed commented 10 months ago

Apologies

I think I'd got the regex wrong

Here is the regex I used and seems to be working g

^(?.?)(?:\s)(-|(|[|\/)(.?(?bbc[A-Za-z0-9 ]?))(?:\s*)?[)]]?$

kawaiiDango commented 10 months ago

Your first regex seems to work for me in the regex test screen although it won't actually work for YouTube as of now because, for YouTube user regexes are applied only after it goes through the built in YouTube title parser. This will change after I rewrite the messy built in YouTube title parser one day.

The second issue of OR like behaviour seems like a bug, it will be fixed soon.

Screenshot_20231206-182518.png

Screenshot_20231206-182502.png

nicoleahmed commented 10 months ago

Yes sorry there is a bug

The OR vs AND

So Screenshot_20231208-114808 This rule is being applied even when there is no Saturday Night Live in the track info

Screenshot_20231208-114827

kawaiiDango commented 10 months ago

Both issues should be fixed in v3.14