Welcome, Guest
Python Scripts for ComicRack

TOPIC: Rename files per user specification

Rename files per user specification 10 years 1 week ago #188

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
This package was a result of a question in another thread.

Extract the contents of the zip file to your scripts folder and restart ComicRack. You'll find a new Automation menu option when you right click on a selection of comics. \"Rename Files per User Specification\"

The option displays an input box with some text describing the functionality. Using tokens listed in the dialog, you can build your own file renaming template. To avoid potential disaster, I built some exit conditions into the script. If the script is trying to rename a comic that contains no information for a token (e.g. Series name is blank and was specified as part of the rename template), the script will exit and give you a little message identifying the file name of the offender.

The instructions displayed are included below:

Please enter your desired filename format using any combination of the tokens below and text to decorate them. Please note that EVERY comic you've selected MUST contain a valid value for EVERY token you specify. Otherwise, the operation will terminate but any files already renamed will NOT be reverted. You have been warned.

Valid tokens:
%Series% %Volume% %Number% %Count% %Year% %Month% %Imprint% %Publisher%
%AlternateSeries% %AlternateNumber% %AlternateCount%

Valid zero-padding tokens:
2 digits: %PaddedMonth% %PaddedVolume%
3 digits: %PaddedNumber% %PaddedCount% %PaddedAlternateNumber% %PaddedAlternateCount%

Token identifiers are NOT case-sensitive so %Series%, %SERIES%, and %series% are considered the same.

File Attachment:

File Name: UserSpecif...ame1.zip
File Size:2 KB
The administrator has disabled public write access.

Re:Rename files per user specification 10 years 1 week ago #193

Thank you. This is very useful. Specially for non-Python scripters :)
The administrator has disabled public write access.

Re:Rename files per user specification 10 years 4 days ago #245

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
Is anyone interested in a more user-friendly version of this script? Something with buttons to add a token to the format, a way to specify how much zero-padding to use for a token, and a Clear Format button is what I had in mind.
The administrator has disabled public write access.

Re:Rename files per user specification 9 years 11 months ago #294

  • Wacko
  • Wacko's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 3
  • Karma: 0
I would like to be able to change the path or move to a new folder structure as the file are renamed. Is that something you can add to the script?
The administrator has disabled public write access.

Re:Rename files per user specification 9 years 11 months ago #295

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
I would like to be able to change the path or move to a new folder structure as the file are renamed

ME TOO! If I knew how to update the path for a ComicRack entry, I could move the file and keep everything synchronized. I'll have to find out from cYo whether he has exposed this or not.
The administrator has disabled public write access.

Re:Rename files per user specification 9 years 11 months ago #296

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 676
  • Karma: 181
The RenameFile method accepts paths.

So you can call it with

[code:1]
book.RenameFile (\"C:\My Comics\Alan Moore\Watchmen\Watchmen #01\"«»)
[/code:1]

You should not specify any extension, as this is handled by ComicRack. Also make sure the path exists. ComicRack will move the eComic file to the new path.

Because of a bug in 0.9.60 filename has to be different to execute the method (even if path is different).

method returns false if something went wrong btw.

If you know what you are doing, you can also do the moving/renaming of the file by yourself and change the FilePath property of the comic. This is the full path (including extension) of the eComic. Messing this up and ComicRack will not find the book anymore :)
Last Edit: 9 years 11 months ago by cYo.
The administrator has disabled public write access.
Time to create page: 0.303 seconds

Who's Online

We have 299 guests and 5 members online