Welcome, Guest
Python Scripts for ComicRack

TOPIC: Organize Library Files & Folders 2.0

Organize Library Files & Folders 2.0 8 years 3 months ago #3777

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 906
  • Thank you received: 182
  • Karma: 37
IMPORTANT
UPDATE
IMPORTANT
UPDATE
IMPORTANT
UPDATE
IMPORTANT
UPDATE
NOTE:
Remember, if you are using the latest versions of ComicRack, you want to store all your scripts within your local current user Application Data ComicRack script folder.

The updated version of this script, 2.2.0, can be found in the new section for downloading scripts here:
Download updated script, version 2.2.0 here!

I've also decided to keep the previous version posted, located on page 8 of this thread, for those of you who may still be running older versions of ComicRack.
IMPORTANT
UPDATE
IMPORTANT
UPDATE
IMPORTANT
UPDATE
IMPORTANT
UPDATE


Organize Library Files & Folders 2.0

Here it is! My latest update to the script I tweaked a month ago for organizing and standardizing your eComic library naming and structure. Due to the extra changes I made, I decided to change the name and make this a totally separate script because I wasn’t quite sure how receptive others would be to the additions that I made.

So, here is a complete breakdown of exactly how this script works. First there’s the File folder structure and naming. The user must manually set the root directory where they want their eComics to reside on the computer. The script then creates a new subfolder of the Publisher within the root folder, then an Imprint subfolder if it exists, and finally a Series subfolder. The Series subfolder also gets the beginning year it was published concatenated at the end. The syntax looks like this:
[root directoy] \ [Publisher] \ [Imprint if exist] \ [Series] ([YearBegan] Series) \
So for example if your eComic is The Amazing Spider-Man, Volume 1, Issue 366 or Air, Volume 1, Issue 8 your respective directories would be:
G: \ Comics \ Marvel Comics \ The Amazing Spider-Man (1963 Series) \
G: \ Comics \ DC Comics \ Vertigo \ Air (2009 Series) \

Then there is the file naming structure. The syntax for this is:
[Series] Vol. [Volume] # [Number with leading zeros] (of [Count if exist] ) ( [Month in text format] , [Year] )
So with the same eComics above as an example your files would be named:
The Amazing Spider-Man Vol. 1 #366 (September, 1992).cbz
Air Vol. 1 #08 (June, 2009).cbz

The code only creates an Imprint folder if the Imprint field contains a value. When naming the file, it adds the Count value after the Number value if the Count field contains a value. The script also checks for invalid characters in field values when making folder and file names. A text format is used for the Month value in the file name. 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.

Also, very important – as of right now, you should run this script on at least each issue of a given Series, so that it names the Series folder properly. You could also run this script on your whole library, which would most definitely name each Series folder properly but this could take time to process depending on how large your eComic library is. A future update will ensure that this extra user step is not necessary.

The script includes the definitions directly into the Python script, so no 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.

Hopefully this script becomes as valuable for others as it is for myself. Enjoy and take care!
Onyx X aka SoundWave

IMPORTANT
Update to script is located below on page 1. The attachment in this post has been removed as of Wednesday, July 22, 2009, and an updated version, 2.1, is now located on page 1, post #3980.

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

Re:Organize Library Files & Folders 2.0 8 years 3 months ago #3839

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Wow, I can't believe I missed this script. It's so amazing! It does the work of the "Guided Rename" and "Standardize Library" scripts but in one go and without the extra hassle. Even better is that the default naming convention and folder layout is what I use already (with the month and year at the end of a comics name).

I just have one request: When I organize a "Limited Series" or a "One-Shot", instead of having the folder say "2009 Series", could it say "2009 Limited Series" or "2009 One-Shot"?

I hope you understood the gist of what I was trying to say. If you could do that, this becomes the perfect script (for me anyways).

Once again, AMAZING script!
The administrator has disabled public write access.

Re:Organize Library Files & Folders 2.0 8 years 3 months ago #3841

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 906
  • Thank you received: 182
  • Karma: 37
I wasn’t sure if this script was considered by some to be redundant since wadegiles’ wonderful guided script exists. Therefore, it’s good to see this script has its value. I think it’s a great idea to include the Format in the Series folder name. That will be easy enough to include in the script.

In addition, I’ve been thinking to add a Library Hook that allows the user of this script to set the root directory without having to manually update the script. If you use this script, please let me know if you think this is a function worth adding or if you think it’s too menial of an issue to worry about.

I was also thinking about coming up with a way of incorporating Tags to add information such as the names of those who created the eComic file into the file name to help keep track of the files origins. Also, with this in mind, using Tags could be used to identify if an eComic file was a c2c (Cover to Cover) or other type of comic file, and this info could be added to the file name as well. Let me know if you all think these would be interesting and useful additions to the script.

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

Re:Organize Library Files & Folders 2.0 8 years 3 months ago #3844

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
The Library Hook feature you're talking about is useful (and certainly appreciated if implemented) but it's not required because manually updating the file is easy enough. However, the feature itself would be great and if it's easy enough, you might want to add it.

Also, as for redundancy, your script does a wide array of features together, reducing time needed overall. I don't have to use both guided rename and standardize library (which takes MUCH longer) where as this does both things and at a faster speed (much faster for me).

As for adding the c2c tags in the cover name, I can't really give you my input because I always add the credits to the "Notes" section manually (at first, I added them to the "Tags" section, but I don't think that's what that section is for). Unless, of course, this feature also does that? Or is capable of doing that? If so, I'm all for it.

Also, once again your script is amazing. I've saved so much time already, I think I'll cry. T_T Keep up the good work.

:)
The administrator has disabled public write access.

Re:Organize Library Files & Folders 2.0 8 years 3 months ago #3847

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 906
  • Thank you received: 182
  • Karma: 37
Glad you’re enjoying the script and getting usage out of it! And at the same time, I’ve stumbled upon a program, Python/IronPython, that’s been pretty easy to pick up and apply quick compared to other languages.

Yeah, I figured the Library Hook for setting the root directory really wasn’t necessary, but it is a nice function I would love to learn how to accomplish, so at the very least I’ll keep everyone posted if I get it to work properly.

Keeping this script as close to fast as it originally was has most definitely been one of my major concerns while adding new ideas. So it does please me to know that it’s still quite fast for others.

When it comes to the scanner name and scan type, as perezmu would like to see added, I’m thinking it can come from either the Tags field or the Notes field. With the discussions on this thus far, it would seem that pulling this information from the Notes field would be better since it is a data field that is less likely to get trashed (even more less likely if eComics are in the CBZ container format) by the application should the eComic file ever be moved outside of the ComicRack app environment. So even though the Tags section is capable of storing this info, it’s most likely best to store this in Notes.

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

Re:Organize Library Files & Folders 2.0 8 years 2 months ago #3980

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 906
  • Thank you received: 182
  • Karma: 37
Organize Library Files & Folders 2.1
Hello all! This is the latest update to the script that I’ve been working on. I used a few code lines from wadegiles’ Move Files script, so credit is given.
I’ve fixed one particular part of the script and added a couple of new features.
Fixes:
1) There was an issue with creating the issue number list. The issue number list wasn’t sorting properly because I had forgotten that ComicRack stores the Number value as a text string and not as an interger. So I simply converted this value to an interger and now it is sorting the list properly.

Added Features:
1) I added another sub script called Configuration Library Root Directory Dialog 1.0. This sub script allows the user to set the root directory for their library directly from the ComicRack application so that you no longer have to edit the Python script file. This function can be located in your Automation commands under “File” on the Menu bar.
2) I added a small and easy request, which I thought was a great idea, from chaoshunter
chaoshunter wrote:
I just have one request: When I organize a "Limited Series" or a "One-Shot", instead of having the folder say "2009 Series", could it say "2009 Limited Series" or "2009 One-Shot"?
So now when your Series folder is named it adds at the end of that name Year of the first book you have in that series and the series Format. For Examples:
P:\\Books\\Comics\\DC Comics\\Batman- Battle for the Cowl (2009 Mini-Series)\\Batman- Battle for the Cowl Vol.1 #01 (of 3) (May, 2009).cbz
P:\\Books\\Comics\\3H Productions\\Transformers The Wreckers (2001 Special)\\Transformers The Wreckers Vol.1 #01 (July, 2001).cbz

As always, I’ve included a test copy of the script to be used in conjunction with ComicRack in debug mode. To have ComicRack properly load the Test version, just rename “L” to Library” and “B” to “Books” where code lines start with:
#@Hook

Finally remember that the main script, Organize Library Files Folders 2.1, is accessed from both the library level Automation menu and the books selected level popup Automation menu. The companion script, Configuration Library Root Directory Dialog 1.0, is accessed from the library level Automation menu if you want to set the Root Directory for the first time, or if you want to reset it to a different location. The companion script, Configuration Library Root Directory Dialog 1.0, is also imbedded in the main script. So it will be automatically accessed if you haven’t already set your Root Directory.

I hope these two additions enhance the script rather than take away from it.
Enjoy!
Onyx X aka SoundWave

IMPORTANT
Update to script is located on page 3. The attachment in this post has been removed as of Thursday, July 23, 2009, and an updated version, 2.1.1, is now located on page 3, post #3992.

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

Re:Organize Library Files & Folders 2.0 8 years 2 months ago #3982

  • pcvii
  • pcvii's Avatar
  • Offline
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1
  • Karma: 0
I donno if your script has the problem that i know one of the rename scripts does. But for titles or series with characters that can't appear in filenames. like : or ?

that can cause those files to be skipped. Like I said I don't know if you have the same problem as those rename scripts but i thought you might take a look at it. I am about to test your script out.
The administrator has disabled public write access.

Re:Organize Library Files & Folders 2.0 8 years 2 months ago #3983

  • pcvii
  • pcvii's Avatar
  • Offline
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1
  • Karma: 0
So far so good i had a file comic with : in the series and your script replaced it with a -

Good deal!
The administrator has disabled public write access.

Re:Organize Library Files & Folders 2.0 8 years 2 months ago #3984

  • pcvii
  • pcvii's Avatar
  • Offline
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1
  • Karma: 0
Some reason after I run this script once it won't work again till i restart.

Exception has been thrown by the target of an invocation

Ok I figured it out some comics info is missing. And when it isn't there the script fails.

i think it's a
dir=dir
statement for when
book.Publisher == ""

I think that is what is causing the issue.

i had month year and publisher empty. then i put in each one till it started working.

Yep i changed it to
dir="(Unknown Publisher)\\"
some reason the two slashes in the forum get turned into one. but their are two there. someone isn't escaping characters in the posts.

and no more error
Last Edit: 8 years 2 months ago by pcvii.
The administrator has disabled public write access.

Re:Organize Library Files & Folders 2.0 8 years 2 months ago #3985

  • oraclexview
  • oraclexview's Avatar
  • Offline
  • Moderator
  • aka SoundWave
  • Posts: 906
  • Thank you received: 182
  • Karma: 37
What comic info is missing? So I can take those exceptions and figure out how to handle them in the script.

Onyx X aka SoundWave
The administrator has disabled public write access.
Time to create page: 0.224 seconds

Who's Online

We have 191 guests and 6 members online