Welcome, Guest
Python Scripts for ComicRack

TOPIC: Data Manager 2.xx Series for ComicRack

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46595

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
DodgyEmu wrote:
Data Manager hangs for me when I use this rule:
<rule field="Title" modifier="RegEx" value=".*\bpart|Part|pt|Pt\b\W+\bOne|one|0*1|i|I\b.*" /> =>
<action field="Title" modifier="RegexReplace" value="(.*)\bpart|Part|pt|Pt\b\W+\bOne|one|0*1|i|I\b(.*)||$1Part 01$2" />
I'm trying to change all titles with 'part one' (or 'Part 1', 'part.1', etc.) in them to be uniformly 'Part 01'.

There may just be an obvious mistake in the RegEx that I'm missing or I'm misunderstanding how the RegexReplace works, but I had a similar rule working in an earlier version of Data Manager.
Any help would be appreciated.

I think your problem is that the initial and latter portion of the title is being considered in the OR statement try encapsulating your or statment with a capture parenthesis and just skip the reference number.
Last Edit: 10 months 3 weeks ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46596

  • DodgyEmu
  • DodgyEmu's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
I've tried with the rule being:
<rule field="Title" modifier="RegEx" value=".*\b(part|Part|pt|Pt)\b\W+\b(One|one|0*1|i|I)\b.*" /> =>
<action field="Title" modifier="RegexReplace" value="(.*)\b(part|Part|pt|Pt)\b\W+\b(One|one|0*1|i|I)\b(.*)||$1Part 01$4" />
The same thing happens, it still hangs.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46601

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
That does seem to be a perfectly OK expression, and interestingly it dosent hang if you replace the $4 with 1 2 or 3, so presumably the last bracketed part isn't being assigned correctly.

Also if I place a character like X at the end of Title and expect it in the string like this:

(.*)\b(part|Part|pt|Pt)\b\W+\b(One|one|0*1|i|I)\b(.*)X||$1Part 01$4

The expression works too, which again makes me think something is going wrong with bracket matching at the end of the field.
Even more interestingly if you put the X in brackets you can match it OK with $5, so the problem is specifically with bracketed wildcards at the end of the string, so perhaps this is a pointer error.
Last Edit: 10 months 3 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46605

  • DodgyEmu
  • DodgyEmu's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
jkthemac wrote:
That does seem to be a perfectly OK expression, and interestingly it dosent hang if you replace the $4 with 1 2 or 3, so presumably the last bracketed part isn't being assigned correctly.

Also if I place a character like X at the end of Title and expect it in the string like this:

(.*)\b(part|Part|pt|Pt)\b\W+\b(One|one|0*1|i|I)\b(.*)X||$1Part 01$4

The expression works too, which again makes me think something is going wrong with bracket matching at the end of the field.
Even more interestingly if you put the X in brackets you can match it OK with $5, so the problem is specifically with bracketed wildcards at the end of the string, so perhaps this is a pointer error.
I haven't been able to get any of these to work, as long as a match is found it always hangs for me.
Could you please give an example of a title that you were able to get the replace to work successfully for, and the exact rule you used?
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46606

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
The expression works too, which again makes me think something is going wrong with bracket matching at the end of the field.
Even more interestingly if you put the X in brackets you can match it OK with $5, so the problem is specifically with bracketed wildcards at the end of the string, so perhaps this is a pointer error.

if so then the problem is inherent in .NET's processing of the Regular Expression. The current version of the script uses the simplest implementation of .NET for the regex replace Regex.Replace(String input, String replacement), rather than Python, the next version will be just the opposite. I'm not sure the differences between .NET's Regular Expression implementation & Pythons but I'll discover that when i have time to work on the script again.

Edit: If you know anything about coding and feeling daring you could try (at your own risk) swapping out System.Text.RegularExpressions for Python's re module and using re.sub(input, replacement) in the dmClasses.py file at function dmAction.RegExReplace. but again I'm not sure what that might break in the script.
Last Edit: 10 months 3 weeks ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46611

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
DodgyEmu wrote:
I haven't been able to get any of these to work, as long as a match is found it always hangs for me.
Could you please give an example of a title that you were able to get the replace to work successfully for, and the exact rule you used?

I was testing manually by editing the title, and I was leaving the rule blank, so I wasn't matching anything. That may make a difference.

But quickly making one that works:


File Attachment:

File Name: test.zip
File Size:0 KB



That matches and corrects this:

Test title Pt One, The end X
Last Edit: 10 months 3 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46612

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
Another couple of issues I am having:
When I merge a rule it always doubles the rule, loading in two versions at once.
The search function (which I use constantly due to the way my ruleset does multiple jobs so the structure is not simple) no longer allows me to double click on the results to go to the rule.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 3 weeks ago #46613

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
T3KN0Gh057 wrote:
if so then the problem is inherent in .NET's processing of the Regular Expression. The current version of the script uses the simplest implementation of .NET for the regex replace Regex.Replace(String input, String replacement), rather than Python, the next version will be just the opposite. I'm not sure the differences between .NET's Regular Expression implementation & Pythons but I'll discover that when i have time to work on the script again.

I would imagine .NET would not have this issue because this is a pretty standard string, it would have been picked up and fixed years ago. Much more likely, the way you are calling the routine is encouraging the match to point past the end of the string.

P.S. Although even that dosent make a lot of sense because the match is apparently working, the replace is having difficulties. It will certainly be interesting to see if switching implementations helps.

P.P.S. tested the string as:

(.*)\b(part|Part|pt|Pt)\b\W+\b(One|one|0*1|i|I)\b(.)||$1Part 01$4
So that it only matches the first character after the 'one' and that is still hanging, so it is probably not an end of string error.

Even this expression fails which would be a basic test for any implementation of regex:

^(.*)$||$1

Which implies the script is replacing an invalid string, probably an invalid delimiter that is being picked up with the match.
Last Edit: 10 months 3 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 2 weeks ago #46640

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Is it possible to move or copy the data in the custom fields with this new version of DM?
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 10 months 2 weeks ago #46645

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
laxarus wrote:
Is it possible to move or copy the data in the custom fields with this new version of DM?

Yes is is. Just include the name of the field in curly brackets.

For example adding the data in a custom 'Concept' field to tags:

=> <<Tags.Add:{Concept}>>
Last Edit: 10 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.
Time to create page: 0.232 seconds

Who's Online

We have 253 guests and 4 members online