Welcome, Guest
Python Scripts for ComicRack

TOPIC: [Script] Expand by - Smartlist Script (working with stacks) (Ver 1.3 Beta)

[Script] Expand by - Smartlist Script (working with stacks) (Ver 1.3 Beta) 1 month 18 hours ago #48276

  • Xelloss
  • Xelloss's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
Some context:

Since I began using Comicrack one of the things I have always had trouble with making smartlist and filtering comics is to work with stacks as "units". It is easy to find a comic that has x attribute, or follow a filtering rule... But when you want to FILTER COMPLETE STACKS by those rules, it is almost imposible. In that way smartlist always works with comics, and never see stacks as such (stacks are only a way of viewing the results)

For example,

If I want to view all series (with all comics of the series inside) where Batman appear (in at least a comic), I can't
If I want all series that reach comic number 100, I can't
If I want all the comics from the years that Spider-Man appear, I can't

In other words, I can applied rules to comics perfectly, but not to stacks as a whole...For smartlists stacks or groups don't exist.

So I begin to think in a tool to change that. Something simple that using custom smartlist could make me do smartlist that see stacks and apply rules to them.

Of course stacks are not a field I can access from a smartlist, but I can make my own stacks by simply choosing the stack parameters ("what I separate the comics in stacks by"). And that is why I created this script, that perhaps can seem a bit "useless" at first look, but used correctly it can be a powerful tool for filtering stacks instead of just comics...

What it really does:

This script takes what the rules above of this one return (the SameXSameY script does) and then read the attribute we ask for, for example "Series". Then it make a list of all series it can find in the comics we have already filtered, and look for ALL BOOKS IN LIBRARY that share this attribute. In short, if we "expand by" for example Series, it will return all comic with the same Series in the Library that the ones we filtered before (with other normal rules)


Example1: I want all series in which Batman appears

rule1 = Characters - appears - Batman (this will filter all comics which has Batman in it)
rule2 = Expand by "Series|Volume" (this will expand the previous comics to all comics in the same Series/Volume in the library)

Now I have as a result the stacks (Series,Volume) that has Batman in it (complete volumes)

Example2: I want all series that has a number 10 in it

rule1 = Number - is - 10
rule2= Expand by "Series|Volume"

Example3: (using more than one expand by): I want all series that has Batman AND Superman in it (even in different comics)

rule1 = Characters - appears - Batman (this will filter all comics which has Batman in it)
rule2 = Expand by "Series|Volume" (this will expand the previous comics to all comics in the same Series/Volume in the library)
rule3 = Characters - appears - Superman (this will filter comics from the series where Batman appears where Superman appears)
rule2 = Expand by "Series|Volume" (this will expand the previous comics to all comics in the same Series/Volume)

Now I have all Series-Volume where Superman and Batman appear

Mixing rules and this script in similar ways you can work with stacks, as they were comics, you only have to be careful how you apply the rules (order is important)

NOTE: This will work for "virtual stacks" you make by choosing the attributes you want to stack by, not the ones you use in the view

The script (Beta 1.3):

File Attachment:

File Name: Expandby-2-3.crplugin
File Size:2 KB


Changes:

# 1.1 Fixed performance issue (half the code rewritten). Also now it has a second field where you can limit the number of comics in each stack to expand (more than that is expended, less than that is filtered)
# 1.2 Added the option to limit the stacks by % of the comics in the input in relation with the complete stacks
# 1.3 Better performance, now it is about 10x faster

Some symbols you can use to customize your search even more (the same that in SameXSameY script)

| : You use this between attributes, when you want to group/stack comics by not one but two or more of them:

Example: "Series|Volume" will group comics with the same Series AND Volume

!: You use ! before any attribute to make the comparassion not exactly the same, but similar

Example: "!Series" will see Spider-Man and Spiderman as the same Series

Note: For a list of attributes you can use, check the SameXDifferentY topic. Custom Values can be used as normal attributes, just write exactly the name of it.

Please test it and tell me what you think of this :)

- As usual, all bug reports and ideas for improving the script are welcome and thanked for!


This script was based in the SameXDifferentY script you can find here:

comicrack.cyolito.com/forum/13-scripts/3...-y-smart-list-script

(they seem to do similar things, but while SameXDifferentY is a filter rule, this script returns MORE comcis than the ones it "filter")
Last Edit: 4 weeks 2 days ago by Xelloss.
The administrator has disabled public write access.

[Smartlist Script] "Expand by" Smartlist Script (working with stacks) - BETA 1 month 13 hours ago #48284

  • Xelloss
  • Xelloss's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
Ok, a few hours later, a HUGE update XD

Changes:

# 1.1 Fixed performance issue (half the code rewritten). Also now it has a second field where you can limit the number of comics in each stack to expand (more than that is expended, less than that is filtered)
# 1.2 Added the option to limit the stacks by % of the comics in the input in relation with the complete stacks
# 1.4 Better performance, now it is about 10x faster

Ver 1.3:

File Attachment:

File Name: Expandby-2.crplugin
File Size:2 KB


All in all, in addittion to performance boost (the code was a disaster XD) and bug fixing, I added a field b where you can limit the size of the stack to expand

If it is larger it is expanded
If it is smaller it is filtered

You can use numbers (1,2,3,etc) for number of comics, or use % (20%,30%, etc) for limits based on the relation between the comics that follows the above rules and the complete stacks.

Example1: I want all Volumes that has at least 3 comics of Batman

Characters - constains - Batman
Expand by - Series|Volume - 3


Example2: I want all Volumes that has at least 30% of their comics published in the year 2017

Year - is - 2017
Expand by - Series|Volume - 30%


If you don't understand this field, just leep it empty and it will work as before :P

Please use this version, not the old one which is SLOOOOOWWWWW
Last Edit: 1 month 13 hours ago by Xelloss.
The administrator has disabled public write access.
The following user(s) said Thank You: rmagere
Time to create page: 0.205 seconds

Who's Online

We have 264 guests and 5 members online