Welcome, Guest
Python Scripts for ComicRack

TOPIC: Question on scripting certain actions...

Question on scripting certain actions... 8 years 3 months ago #3851

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

does anyone know if any of these two actions can be called from a python script?:

- export ecomic as (cbz, cbr...)

- update ecomic files (save changes)

Thanks
The administrator has disabled public write access.

Re:Question on scripting certain actions... 8 years 3 months ago #3854

CR doesn't support cbr (either for writing metadata or exporting/converting), but you can call the file rename from scripts, so one would assume you can call these functions as well. Only Cyo knows for sure...
The administrator has disabled public write access.

Re:Question on scripting certain actions... 8 years 3 months ago #3863

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
For saving ComicInfo changes check into the script named CommitProposed.py. This script is included with the ComicRack installation.

You can script an export using one of the cYo.Projects.ComicRack.Engine.IO.Provider.PackedStorageProvider subclasses, the cYo.Projects.ComicRack.Engine.IO.ComicBookImageProvider, and the cYo.Projects.ComicRack.Engine.IO.Provider.CombinedComics static class' OpenProvider static method.

Script would look something like the following once you got references to namespaces and classes imported. I have NOT tested this at all, but it should be pretty close to what you are looking for. I use .NET Reflector, a free tool, to examine the ComicRack assemblies and get this information. One more caveat: this information is based on 0.9.101, the last non-development version.
ComicBookImageProvider cbip = CombinedComics.OpenProvider(books)
CbzStorageProvider csp = CbzStorageProvider()
targetPath = "C:\\exported\\"
for book in books:
  if (File.Exists(targetPath)):
    target = Path.GetTempFileName()
    book.ComicInfo = cbip.Store(cbip, book.ComicInfo, target, ExportSetting());
    ShellFile.DeleteFile(string[] { targetPath })
    File.Move(target, targetPath)
  else:
    book.comicInfo = csp.Store(cbip, book.comicInfo, targetPath, ExportSetting.ConvertToCBZ)
The administrator has disabled public write access.

Re:Question on scripting certain actions... 8 years 3 months ago #3864

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

Re:Question on scripting certain actions... 8 years 3 months ago #3870

  • spyd3r0x
  • spyd3r0x's Avatar
  • Offline
  • Senior Boarder
  • Posts: 67
  • Karma: 4
perezmu wrote:
- export ecomic as (cbz, cbr...)
I've seen you mention converting cbr to cbz a few other places as well. FYI, I use a simple .bat file to do the conversion. It just requires that you have 7zip installed. I do that, instead of using CR's built-in export, as the export process deletes all non-image files, and renames all of the files to a standardized naming structure. I'd like to preserve all of that information. I usually perform the conversion before importing the files into ComicRack. Let me know if you're interested, and I can post the code.
The administrator has disabled public write access.

Re:Question on scripting certain actions... 8 years 3 months ago #3877

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
I use both 7zip and IZarc for modifying my eComic files. IZarc is built from 7zip and provides a wonderful Convert Archive context menu option directly in Windows Explorer. Select a bunch of CBRs, RARs, etc and pick the format to which you'll convert. You can't really choose the destination folder unless you pick only one archive but I find it invaluable. You can pick and choose which context menu items are displayed as well. Definitely worth a look for mass conversions.
Last Edit: 8 years 3 months ago by wadegiles.
The administrator has disabled public write access.

Re:Question on scripting certain actions... 8 years 3 months ago #3878

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1114
  • Thank you received: 64
  • Karma: 51
Thanks both for the tips on converting...

I was asking mainly to make the import info from comicvine more complete, and have it, once the info is imported, I was planning to have the option to convert the file to cbz and then save the data to the file, all in one go!
The administrator has disabled public write access.
Time to create page: 0.181 seconds

Who's Online

We have 204 guests and 4 members online