[Plugin] LabelPlus v0.3.2.2

Suggest, post, or discuss plugins for Deluge
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Plugin] LabelPlus v0.3.2.2

Post by ambipro »

I'm not sure if this is what you intended, but I can adjust it if need be....

Code: Select all

^(?:((?!s\d{1,3})(?!e\d{1,3})).)*\WWEB(-DL)?\W
This will not match season packs or individual episodes that contain .WEB. or .WEB-DL. in their name.

I'd turn off match case as well, because there is no guarantee that the episode or season would have lowercase s or e, or that a release isn't labeled web-dl instead of WEB-DL

Just my advice.
umaximus
New User
New User
Posts: 3
Joined: Sat Oct 28, 2023 11:34 pm

Re: [Plugin] LabelPlus v0.3.2.2

Post by umaximus »

mhertz wrote: Sun Oct 29, 2023 1:33 pm Sorry don't know and really bad at regex and always have to look it up for the smallest patterns lol, but regardless, atleast I could check that it here doesn't cut the last rule and keeps it upon re-enter prefs, so cannot reproduce. I entered it after your pics, and the hyphen in first rule look strange(light-grey instead black), I thought was a space at first honestly, but maybe just your font or something.

I wanted test if also omits rule if used as first and only rule, and add debug-prints to see what the error was, but as said, couldn't even reproduce with regular two rules as per pic, sorry.

I used basher's labelplus fork which you do too, as else not having such reverse regex rule available even(as latest bdutro fork, which I tested too), plus I tested that it retains both rules on both latest v0.3.2.5 and previous v0.3.2.4, so neither an older version issue.

I don't suppose you could match reverse or what called with a normal "matches regex" rule instead, and seem to remember something about needed use double or even more, backslashes often with python regex pattern matching, but regardless, I couldn't reproduce your exact steps even, so that case moot already and answer lying elsewhere presumably.

Edit: Tested on linux, as see you're on unraid, but i'll test in windows thinclient also now, just in case. Edit: Nope, still same, windows to linux, and windows only. Damn, neither thought about webUI, okay last test then. Edit: Forgot no prefs for this plugin in webUI, only basic set-label support for loaded torrents, so can't test my test-case.
Thank you fur such a commitment with all the testing you have done, much appreciated. I think the problem is that I am using bdutro fork of labelplus. Would you mind linking me basher's one. I am on Deluge 2.1.1
umaximus
New User
New User
Posts: 3
Joined: Sat Oct 28, 2023 11:34 pm

Re: [Plugin] LabelPlus v0.3.2.2

Post by umaximus »

ambipro wrote: Sun Oct 29, 2023 2:21 pm I'm not sure if this is what you intended, but I can adjust it if need be....

Code: Select all

^(?:((?!s\d{1,3})(?!e\d{1,3})).)*\WWEB(-DL)?\W
This will not match season packs or individual episodes that contain .WEB. or .WEB-DL. in their name.

I'd turn off match case as well, because there is no guarantee that the episode or season would have lowercase s or e, or that a release isn't labeled web-dl instead of WEB-DL

Just my advice.
Yes, this is exactly what I was after! Thank you very much! I was never before using regex, so it was my newbie quick learning from here https://www.rexegg.com/regex-quickstart.html. It looks really powerful tool to achieve any kind of sorting. And thanks for the tip about match case, I thought this was a tab to enable/disable rules :roll: Now it makes sense
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

Sure buddy and thanks for your kind post :) However in your screenshot you explicitly have basher's fork because of even having such "doesn't match regex" option, but sure I'll post basher's regardless... Hmm, wait a minute, I tested bdutro's fork, not my own previously posted build where included a reverse match PR, from Sammy or serene-arc or something, can't remember, and not on my computer now, plus don't have that build I posted anymore, and used link-host down. Sorry, should have thought of that, just now remembered while writing. I believe that PR I included is now in basher's fork, plus better maintained/updated. Hope it was that then, good thinking :)

https://github.com/laur89/deluge-labelplus

@ambipro, Thanks for helping with the regex buddy.(Edit: Posted before above post)
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Plugin] LabelPlus v0.3.2.2

Post by ambipro »

mhertz wrote: Mon Oct 30, 2023 8:25 am @ambipro, Thanks for helping with the regex buddy.(Edit: Posted before above post)
of course!
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Plugin] LabelPlus v0.3.2.2

Post by ambipro »

basher wrote: Sat Jul 09, 2022 7:48 pm doing this to tag you :P
Hey, I seem to recall there being talk of a way to like, bind LabelPlus to the Label plugin's labels?

It would be cool if you could schedule it to like, set the regular labels to the at the very least the parent labels (not using sub-labels here) - cross-seed uses them....it wont break without them but it would just make a mess.

Seems pretty trivial to do label.set_torrent call?
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

Sorry not to but in just very quick comment, as knew I seen this before but couldn't remember, but is in mgaulton's bdutro fork of labelplus, but when I searched my posts then previously wrote that found 2-3 issues I fixed in those commits, and then another I gave up on, at the time atleast, though don't have the sources anymore and I'm sure basher don't need either(mine), if agree adding. Not at my computer, so not tested and just quick comment. Anyway, carry on :)

https://github.com/mgaulton/deluge-labelplus

Edit: I'm referring to last couple commits specifically, after forked from bdutro(only 3 made additionally).
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Plugin] LabelPlus v0.3.2.2

Post by ambipro »

Yeah, if it exists in another setting, that seems even better and can be ported over to his fork :D

It would be cool to have something that bound labels from labelplus to labels of the standard label program. Not entirely sure of the approach that would be most feasible...

Any of this, of course, would be a great addition though.
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Plugin] LabelPlus v0.3.2.2

Post by ambipro »

Following up, when trying to use a manual download through interactive search in Sonarr (I would assume this is the same in radarr) - I get the following failure, which is a traceback from labelplus...

Code: Select all

2023-11-21 08:38:51.9|Trace|HttpClient|Response content (2583 bytes): {"result": null, "error": {"message": "Failure: [Failure instance: Traceback (failure with no frames): <class 'deluge.error.WrappedException'>: missing ), unterminated subpattern at position 9\nTraceback (most recent call last):\n  File \"/usr/lib/python3.11/site-packages/deluge/core/rpcserver.py\", line 334, in dispatch\n    ret = self.factory.methods[method](*args, **kwargs)\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py\", line 140, in hook_set_torrent\n    target_label_id = self._find_autolabel_match(torrent_id)\n                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py\", line 1644, in _find_autolabel_match\n    if self._has_autolabel_match(torrent_id, id):\n       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py\", line 1632, in _has_autolabel_match\n    return labelplus.common.config.autolabel.find_match(props,\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/common/config/autolabel.py\", line 132, in find_match\n    if op_func(value, query, flags):\n       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/common/config/autolabel.py\", line 89, in <lambda>\n    OP_MATCHES_REGEX: lambda x,y,z: re.search(y, x, z),\n                                    ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/__init__.py\", line 176, in search\n    return _compile(pattern, flags).search(string)\n           ^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/__init__.py\", line 294, in _compile\n    p = _compiler.compile(pattern, flags)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/_compiler.py\", line 743, in compile\n    p = _parser.parse(p, flags)\n        ^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/_parser.py\", line 982, in parse\n    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/_parser.py\", line 457, in _parse_sub\n    itemsappend(_parse(source, state, verbose, nested + 1,\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.11/re/_parser.py\", line 867, in _parse\n    raise source.error(\"missing ), unterminated subpattern\",\nre.error: missing ), unterminated subpattern at position 9\n\n]", "code": 4}, "id": "396764d1"}
2023-11-21 08:38:51.9|Trace|SonarrErrorPipeline|Handling Exception
2023-11-21 08:38:51.9|Fatal|SonarrErrorPipeline|Request Failed. POST /api/v3/release

[v4.0.0.731] NzbDrone.Core.Download.Clients.Deluge.DelugeException: Failure: [Failure instance: Traceback (failure with no frames): <class 'deluge.error.WrappedException'>: missing ), unterminated subpattern at position 9
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/deluge/core/rpcserver.py", line 334, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py", line 140, in hook_set_torrent
    target_label_id = self._find_autolabel_match(torrent_id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py", line 1644, in _find_autolabel_match
    if self._has_autolabel_match(torrent_id, id):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/core/core.py", line 1632, in _has_autolabel_match
    return labelplus.common.config.autolabel.find_match(props,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/common/config/autolabel.py", line 132, in find_match
    if op_func(value, query, flags):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/plugins/LabelPlus-0.3.2.5.egg/labelplus/common/config/autolabel.py", line 89, in <lambda>
    OP_MATCHES_REGEX: lambda x,y,z: re.search(y, x, z),
                                    ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 982, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 457, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 867, in _parse
    raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 9
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

Seemingly doesn't like filename/tracker whatever auto label matching with your regex, as missing end parenthesis in regex apparently thought during parse so char or combo of them(in title) makes it trip, presumably. Hope basher or others clever enough to fix such, or add "failsafes" to workaround, or maybe you could tweak your pattern dunno(if even related and not purely title). Just talking out of my you know what, as over my head, and sorry no help fullness to offer.
Post Reply