Welcome, Guest
Python Scripts for ComicRack

TOPIC: Arturo's New Comics Toolbox

Re:Arturo's New Comics Toolbox 8 years 4 weeks ago #4447

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Great, I have been wondering for a while how to use scripts in lists! Thanks!
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 4 weeks ago #4448

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 920
  • Thank you received: 267
  • Karma: 173
You're very welcome.

I discovered how to use smart list scripts by accident while trying to see if I could use the note field in smart lists. There doesn't seem to be a whole lot of documentation on how to use or write them, so I just used the example script to start off.

Still not sure what the third argument is in the example script is for... Perhaps cYo can fill us in?
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 4 weeks ago #4449

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 675
  • Karma: 181
b is the second parameter.

If you set @PCount to 2, you will get two input fields for your smartlist script.
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4456

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Is there anyone who can update the script so that the tags (DCP/Minutemen) are preserved when saving to the TAGS field?

It would save a lot of time.
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4457

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
chaoshunter wrote:
Is there anyone who can update the script so that the tags (DCP/Minutemen) are preserved when saving to the TAGS field?

I am not sure I understand what you mean, could you elaborate a little, with an example?
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4458

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Don't worry, I figured it out. After messing around with regular expressions for a while, I managed to make the script put the names for DCP, Minutemen and all the manga I usually read. I've updated it and it catches pretty much everthing.

This should find:
*-DCP
Minutemen-*
MinuteMen-*

and for manga, anything in between:
[ ]

like..
[Franky House] will be saved as: Franky House

Hope that helps any lurkers such as myself and other users.

File Attachment:

File Name: Scripts-20090925.zip
File Size:1 KB
Last Edit: 8 years 3 weeks ago by chaoshunter.
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4467

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
.*?(?<Tags>[^()]*?DCP|Minute[Mm]en\-[a-zA-Z&\s]+-?[a-zA-Z&\s]+|[a-zA-Z&\s]+(?=((?!\[).)*?\])|(?<=([1-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9][0-9]))[a-zA-Z&\s]+).*

Can anyone help me with this regular expression?

If I take away this part:
|(?<=([1-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9][0-9]))[a-zA-Z&\s]+
..it works fine, but with it included, the DCP and Minutemen sections don't work.
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4471

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
That expression looks extremely overcomplicated. Lots of or'ed positive look-behinds. You might want to just explain what you are trying to accomplish.

As you can see from the following, I tried to figure out what you were trying to do, but when I got to the bit where you either want a positive look-ahead OR a positive look-behind I decided I couldn't figure out what you were trying to accomplish.

Regular expression analysis --
Non-greedy match for the parts that don't match what's in "Tags" (seems superfluous since you aren't keeping the string):
.*?

Name the match "Tags"
(?<Tags>

All the string prior to an open or close paren
[^()]*

Any or no character followed by one of the following:
1) DCP
2) a rather complicated string starting with Minute (note that this will not match "DCP-something")
3) a string that only contains alphabet, ampersands or white-spaces
?DCP|Minute[Mm]en\-[a-zA-Z&\s]+-?[a-zA-Z&\s]+|[a-zA-Z&\s]+

One of the following:
1) A positive look ahead stored as an unnamed group
2) A positive look behind stored as an unnamed group while matching on at least one character of alpha, ampersand or white-space
(?=((?!\[).)*?\])|(?<=([1-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9][0-9]))[a-zA-Z&\s]+

End of match "Tags"
)

Catch the rest of the string (seems superfluous since you aren't keeping it).
.*
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4475

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Sorry for the confusion, looking back, I should've explained it from the start.

Essentially what I want this expression to do, is to capture the the scanner names from the following formats:
*-DCP
Minutemen-*
*[Scanlators Name]
*Number*Scanlators Name

So examples of the above would be:
Captain America #42 GreenGiant-DCP ... would capture: GreenGiant-DCP
The Web #1 Minutemen-ThePyre ... would capture: Minutemen-ThePyre
Bleach 375[Sleepyhouse] ... would capture: Sleepyhouse
bleach 375Sleepyhouse ... would capture: Sleepyhouse


.*?(?<Tags>[^()]*?DCP = This retrieves it if the Scanner is DCP.

|Minute[Mm]en\-[a-zA-Z&\s]+-? [a-zA-Z&\s]+| = This retrieves it if the Scanner is Minutemen or MinuteMen followed by whatever the scanner name is. This is long because it captures both Minutmen-ThePyre and something like Minutemen-Sha-Hic.

[a-zA-Z&\s]+(?=((?!\[).)*?\]) = This retrieves scans from a section. Essentially if the above to fails, this tries to capture anything from inside [ ]

|(? <=([1-9]))[a-zA-Z&\s]+|(?<=([1-9][0-9]))[a-zA-Z&\ s]+|(?<=([1-9][0-9][0-9]))[a-zA-Z&\s]+).* = Here is where I have a problem. If I remove this section, everything works fine (DCP, Minutmen, []), all of them retrieve the tags fine. But as soon as I add this section, the previous statements stop working. This is essentially a last resort. It's trying to capture whatever comes after 1, 2 or 3 numbers. So, for bleach375Sleepyhouse, it would capture Sleepyhouse.

I'm thinking of dropping the last section all together because it makes the regular expression too long but I just wanted to check if anyone could see what was making the previous sections stop functioning.
The administrator has disabled public write access.

Re:Arturo's New Comics Toolbox 8 years 3 weeks ago #4481

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
The way it's structured, you are trying to find one of the first 3 patterns plus the last pattern. Try this one and let me know if it's any better:
.*?(?<Tags>[^()]*?DCP|Minute[Mm]en\-[a-zA-Z&\s]+-?[a-zA-Z&\s]+|[a-zA-Z&\s]+(?=((?!\[).)*?\])|(?<=([1-9]|[1-9][0-9]{1,2}))[a-zA-Z&\s]+).*
The administrator has disabled public write access.
Time to create page: 0.212 seconds

Who's Online

We have 199 guests and 10 members online