Welcome, Guest
Python Scripts for ComicRack

TOPIC: CR Data Manager - manipulate data based on rules - version 1.2.4

Re: CR Data Manager - manipulate data based on rules - version 1.2.2 4 years 1 month ago #37161

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
Freakeao wrote:
Ok. Just after posting this I figured out the first part.
<<Series.RegEx:^(\d{1,4}[a-z]) - >> => <<Series.RegexReplace:^(\d{1,4}[a-z]) - ||>>

But AlternateNumber only has a SetValue or Calc action. How about I take the matched value from Series regex and put that in as the AlternateNumber

hmmm... I'm pretty sure RegEx Replace only works on the field it's specified to. Its simply to modify a field that the information isn't quite right.

but it would be useful if you coud do something like this (using your example)
<<Series.RegExVarReplace:(?<AlternateNumber>\d{1,4}[a-z]) - >>
Last Edit: 4 years 1 month ago by T3KN0Gh057.
The administrator has disabled public write access.

Re: CR Data Manager - manipulate data based on rules - version 1.2.2 4 years 1 month ago #37240

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
With docdoom currently very busy i've sort of delved deep into datamanager and started to make what i consider to be a few needed modifications and additions.


there will be a new Modifier called RegExVarReplace(should be available in the next release of data manager) basically you just use named capture groups to specify the fields to put things into ...

Example:
FileName: [1992-07] Archer & Armstrong #000 (of 026).cbz
Regular Expression: \[(?<Year>(0-9]{4})-(?<Month>[0-9]{2})\] (?<Series>[^#]+) #(?<Number>[0-9]+) \(of (?<Count>[0-9]+)\)

You can even create (or modify) custom fields, simply by adding a capture group named anything that is not handled by Data Manager specifically.
FileName: Wander - Olive Hopkins and the Ninth Kingdom 003 (2013) (digital) (Son of Ultron-Empire)
Regular Expression #1: \((?<Scanner>[^-]+)-(?<ScanGroup>Empire)\)

which results in creating the two custom fields and their values
Scanner: Son of Ultron
ScanGroup: Empire

Note: Conversions will be done to proper type, if the specified data can not be converted to the correct type specified by the field (for instance numeric) the field info will not be applied. So be sure things that are specified can successfully be converted to the type it should be.


Groups will also be able to be used to filter comics and apply default actions. (Any comic not meeting the rules specified by the group will not have any of the rulesets or groups contained in that group evaluated at all

For example:
Group Name: Image Comics
Filters: Publisher Is Image OR Publisher is Image Comics
Default Actions: Publisher SetValue Image Comics
Subgroup: [Imprint] Shadowline
Filter: Imprint is Shadowline
etc.....

Any book with the publisher "Image" or "Image Comics" will continue on to be further evaluated by the 'Shadowline' SubGroup (and finally having its Publisher name Corrected to "Image Comics" after all subgroups and child rulesets are procesed, but if the publisher is anything other than 'Image' or 'Image Comics' it will never make it into evaluation by the Shadowline Subgroup.

Rules and actions on the group level can be used in any combination
  • Rules without actions just to filter (and likewise speed up the process by not evaluating uneccesary comic)
  • Actions with out Rules: To apply globally to any comic that makes it to the specified group
  • Rules and Actions: Filtering and applying default actions
  • Neither: allowing all books to be evaluated)
Last Edit: 4 years 1 week ago by T3KN0Gh057.
The administrator has disabled public write access.
The following user(s) said Thank You: Gantz, gdison

Re: CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 11 months ago #37781

Is the current version of Data manager broken? I have reinstalled it twice and it still does not seem to follow the rules I have set.

I set up a simple rule like this, to set the story arc for all books with "Fear Itself" in the series or alternate Series to "Fear Itself".



However, it applies the action to all books, even when none of the rules are met.



Also add button in the template manager is broken, and doesn't add a template, but does add the rule or action.

Last Edit: 3 years 11 months ago by Christicles.
The administrator has disabled public write access.

Re: CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 11 months ago #37821

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
Christicles wrote:
Is the current version of Data manager broken? I have reinstalled it twice and it still does not seem to follow the rules I have set.

I set up a simple rule like this, to set the story arc for all books with "Fear Itself" in the series or alternate Series to "Fear Itself".



However, it applies the action to all books, even when none of the rules are met.



Also add button in the template manager is broken, and doesn't add a template, but does add the rule or action.


Going to have to investigate that a bit later, if docDoom doesn't jump on it (he's extremely busy these days, and I'd have to reinstall v1.2.2 to check it - I'm currently working on a new version as you can see above, and I only programmed the GUI in 1.2.2).

As for the Template Add button being broke I will look into and fix that within the week;
The administrator has disabled public write access.

Re: CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 11 months ago #37824

Cool, Thanks Ghost.
Also if it helps, I think it's a problem with rule groups as individual rules are working fine. From what I could test, trying different combinations, it seems to be something with setting the rules as "OR". Hope that helps in some way.
Last Edit: 3 years 11 months ago by Christicles.
The administrator has disabled public write access.

CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 9 months ago #38252

  • AZweimiller
  • AZweimiller's Avatar
  • Offline
  • Junior Boarder
  • Posts: 22
  • Thank you received: 1
  • Karma: 0
I was very excited to discover this script tonight! I use Series Group like many people here and found it very tedious having to set this field by hand each Wednesday. Of course this script can do much more than just set Series Group, but that's where I want to start. That being said, the OR functionality does not work at all. When I change a ruleset to OR, it matches EVERYTHING. Example:

MODE: OR
Series StartsWith 'Detective Comics'
Series StartsWith 'Batman'

ACTION:
Series Group = 'Batman'

This matches every book I run it on! I verified that all rulesets using OR will match all books. Even if your ruleset only has a single rule, switching it to OR causes this to happen. I don't know python but I know enough other languages to follow the code. Here's what I found in dmparser.py
                for rule in self.rules:
                        self.theRuleValues = []
                        matched = self.matchRule(rule,book)
                        if self.ruleMode == 'OR' and matched == True:
                                return True
                        if self.ruleMode == 'AND' and not matched: return False
                return True
I changed the last line to this:
		if self.ruleMode == 'AND':
			return True
		else:
			return False
The OR rule mode now works as expected. The short explanation for the change is that in the original code has the FOR loop return True at the end, even if none of the rules matched. This works fine for AND mode because if a single rule does not match, the loop exits and returns False immediately. Completing the loop in AND mode means all the rules matched. In OR mode, the loop exits with True when the first match is found. If no matches are found by the end of the loop, we need to return False by default instead.

EDIT:
Submitted a patch: code.google.com/p/cr-data-manager/issues...ks=109&ts=1392783743
Last Edit: 3 years 9 months ago by AZweimiller.
The administrator has disabled public write access.
The following user(s) said Thank You: docdoom

CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 9 months ago #38253

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
Thanks. I will upload a new installation package next weekend.


doom
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
Last Edit: 3 years 9 months ago by docdoom.
The administrator has disabled public write access.

CR Data Manager - manipulate data based on rules - version 1.2.2 3 years 9 months ago #38366

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
The "OR-problem" (issue 110) is fixed and the bugfix can be downloaded here.

doom
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
The administrator has disabled public write access.

CR Data Manager - manipulate data based on rules - version 1.2.3 3 years 9 months ago #38372

  • rbasniak
  • rbasniak's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
I just installed Data Manager and I can't make it work:

1. I want to set the custom field CMRO on all comics with CMRO on tags. As you can see the pictures, the comics have the value CMRO on their Tag field.





2. My rule is the one on the following image.





When I run it says that 'Your criteria matched no book. No data was touched by the Data Manager.'

I tried changing the rules to many other fields/values/modifiers and they all gave me the same result.

Am I missing something here?
The administrator has disabled public write access.

CR Data Manager - manipulate data based on rules - version 1.2.3 3 years 9 months ago #38374

  • docdoom
  • docdoom's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 320
  • Thank you received: 89
  • Karma: 31
@rbasniak: that's weird: I tried your rule and it works as it should here. Please post your dataman.dat file. Maybe I find something in there...
Author of the CR Data Manager. Download and manual at google code - please post feature requests and bugs here
The administrator has disabled public write access.
Time to create page: 0.319 seconds

Who's Online

We have 200 guests and 3 members online