Welcome, Guest
Python Scripts for ComicRack

TOPIC: Standardize Library Script Tweaked

Standardize Library Script Tweaked 8 years 6 months ago #3661

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 907
  • Thank you received: 182
  • Karma: 37
Hello again all!

I made some changes to DouglasBubbletrousers's "Standard Library" script (wich is a beautiful script by the way; I learned a lot from it).

In general what the script does is rename the book file(s) to a standardize name pattern, creates a new folder structure of [Publisher] \[Imprint] \[Series], move file(s) to new folder and update ComicRack with new location. Then remove the previous folder if it is empty.

The detailed break down of the file structure would look like this:
[script's hard coded set directory] \[Publisher] \[Imprint]^if not null field^ \[Series] \[Series] Vol.[Volume] #[Number] (of [Count]^if not null field^) ([Month]^in text format if not null field^, [Year])
example:
Comics \DC Comics \Batman- Battle for the Cowl \Batman- Battle for the Cowl Vol.1 #01 (of 3) (May, 2009).cbz

The code checks for invalid characters in field values when making folder names. Where the month value goes, it puts the text format of the month, not the number. So it would be May, June, July, etc. It also puts the seasons in text format if the Month value is between 13 and 16. So a value of 13 would be Spring and 16 would be Winter.

I also put a lot more notes in the script to document what each piece of code is to accomplish. It may not be perfect or exactly what you want, but hopefully it helps someone out there. Much thanks again goes to cYo and DouglasBubbletrousers for their great work! Enjoy!

Zip file is attached.

Onyx X aka SoundWave

IMPORTANT
Update to script is located on page 2. The attachment in this post has been removed as of Tuesday, June 9, 2009, and an updated version is now located on page 2.

Thanks!
Attachments:
Last Edit: 8 years 6 months ago by oraclexview.
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3667

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Now that I am in the process of finally sorting all my comics, this sounds just perfect.

A question though, does it handle duplicates somehow?

Thanks
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3668

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 907
  • Thank you received: 182
  • Karma: 37
The original script file didn't handle duplicates, so I didn't take this into account when I made the changes that I wanted. I believe that if there is a file that already has that same name and folder structure, then the script will just skip that file because there is already a file in that location by that exact name. I'll verify this.
There is another script out there that I believe handles duplicates to some level if my memory serves me correctly. If I find it here in the forums, I'll take a look at it and try to use it to add in some level of duplicate conditions for this script.

perezmu, what are conditions that you'd like to see in this script to handle duplicates? After thinking about it, I figure it they could be handled similar to the way that Windows handles duplicate files in the same folder location. Give the user the option to either completely override the file or add it to that folder as well with the copy number appended to the end of the file name. Maybe it could also check both files and automatically keep the larger of the two and delete the smaller copy. Let me know what you think.

Thanks

Onyx X aka SoundWave
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3670

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Hi there,

Thanks for the answer. I think CR has a built-in dupe finder, but I am not sure if I am right or maybe it is a script as you suggest, and I cannot remember exactly where I read about it.

I had not really thought exactly what I'd like to see. But some ideas have come to my mind...

Going for the larger one seems right for older scans, since it probably means higher scan resolutions and/or c2c against story only... as long as you prefer c2c to story-only! (more on this below). For newer scans, larger files might not be the best choice though, because many new comics are scanned by no less than three scanners, and which you like most is now a matter of personal tastes.

So, this is what I came up with (just mindstorming, not asking, because I guess this would be rather complicated):

- At the beginning of the process, give choice to be asked at each dupe or process by a given rule...

- Rules might be based on (1) size, (2) number of pages and/or (3) tags or filename (before renaming, this is!) codes...

For instance, a rule might be a list of words, keeping the file which mathches the word which is nearest to the begining of the list, or the one who matches more

For instance, a rule saying: "c2c, scannerA, scannerB" should keep c2c scannerA comic prior to c2c scannerB, and c2c prior to any other, and scannerA prior to scannerB if no c2c is found.

Maybe all the rules (size, pages) could be incorporated in this type of list rules by adding reserved works like "pagecount" or "keeplarger" or "keepsmaller"... so that something like
'c2c, keeplarger' would mean, keep any marked as c2c but if several c2c are found, larger one should be kept (has 2 matches to the list), and if no c2c is present, simply keep largest. Or have size and pagecount as on/off switches to apply always added to the rest of the rules...

Well I guess I went beyond your question. Did not mean to overwhelm you... just thinking out loud... :blush:

In any case, thanks for the script!
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3672

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 907
  • Thank you received: 182
  • Karma: 37
I think going beyond the simple scope of the task allows us all to brainstorm in full spectrum so that we can push this great application to the limits. Your ideas are some pretty good ones for those that want that kind of detailed control without the manual labor of examining each file. Myself personally, I’d rather examine the content manually rather than go off of just the file name structure (especially when they are files that you’ve acquired from other sources). However, this manually intensive process doesn’t work for everyone. That’s where a duplicate script (whether it is incorporated or separated) would be so valuable.

My question is, from a design perspective, would it be optimal for the rules to be hard coded in the script or user defined in the script? Same with the reserve words; if I (we as a forum collective) were able to get this written, how “advanced” would we want the options to be? I’m thinking we don’t want the user to get too overwhelmed with options to the point where the script confuses them, thus potentially giving them undesired results.

However best to tackle this function, I’m definitely up to the task to try and come up with something that works.

Onyx X aka SoundWave
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3692

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Hi,

I just wanted to drop by and say I am loving this script!!!! Along with Chronowerk's and the one to get info from filenames this one is just making my life so easy!!!!!

Thanks.

Just a couple of minor glitches, both related to dates: if your date is something like -/1993 or the like or your month is set to 0, you will get itno problems. Just for you to know.
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3697

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
:(

Is it only me, or the Script drops the "tags" when moving around the files...?

The problem comes with Chronowerk's script: it stores the info of the comic reference to the db in this place...
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3704

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 907
  • Thank you received: 182
  • Karma: 37
Here is an update to script with some fixes:
Takes into account if Month value is empty. Just grabs Year, instead of Month and Year.
Takes into account if Month value is "0". Just grabs Year, instead of Month and Year.

If you find anything else that needs to be fixed or potentially improved upon, let me know!

Thanks

Onyx X aka SoundWave

MPORTANT
Update to script is located on page 2. The attachment in this post has been removed as of Monday, June 22, 2009, and an updated version, 1.3, is now located on page 2, post #3769.

Thanks!
Attachments:
Last Edit: 8 years 5 months ago by oraclexview.
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 6 months ago #3706

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Thanks!
The administrator has disabled public write access.

Re:Standardize Library Script Tweaked 8 years 5 months ago #3769

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 907
  • Thank you received: 182
  • Karma: 37
Here is version 1.3 of the Standardize Library Tweaked script.
This version includes the fixes from the last version:
Takes into account if Month value is empty. Just grabs Year, instead of Month and Year.
Takes into account if Month value is "0". Just grabs Year, instead of Month and Year.

I also updated script to include the definitions directly into the Python script, so no more need for a "XML" related file. I also added a icon file to display script icon in both the library level menu and the books selected level popup menu.

I've included full descriptions of what each piece of code is doing for those that wish to take a crack at learning this cool language to tweak and make their own scripts.

There is also a TEST copy of the script included that sends detailed outputs to the Script Output Window when you open ComicRack (ComicRack.exe -dso -ssc) in debug mode. Basically what I do is just add ( -dso -ssc) at the end of the Target field in Properties for my ComicRack shortcut icon.
Here is cYo's details on what this setup means.

I hope you guys find this script or any portion of it useful.

Thanks!
Onyx X aka SoundWave

File Attachment:

File Name: Standardiz...ed13.zip
File Size:8 KB
The administrator has disabled public write access.
Time to create page: 0.228 seconds

Who's Online

We have 245 guests and 2 members online