Welcome, Guest
Python Scripts for ComicRack

TOPIC: Extract only 1st page in archive (cover page)

Extract only 1st page in archive (cover page) 8 years 7 months ago #3052

  • Infina
  • Infina's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Hi guys,

I was wondering if it was possible to create a script to batch extract the cover page (1st page) from a tree of directories containing archives. I just recently found the extract page option in CR. I have been trying to do this with 7zip and PowerArchiver, but because I've compressed my archives to cb7, I've run into a bunch of problems with both apps.

Thanks alot!
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3071

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
This script will extract the first page of all selected eComics. The file name is generated based on the eComic series name, volume number, and issue number.

Unzip the file contents into your ComicRack Scripts folder and start ComicRack. Select the eComics for which you want the first page extracted. Under the right click Automation menu, select the "Extract First Page.." menu item. You will be asked where to save all the pages so choose the folder in which you want the pages to be saved.

Let me know if this fulfills your needs. The automatic naming can be customized by editing the ExtractFirstPage.py file.

File Attachment:

File Name: ExtractFir..._1_1.zip
File Size:3 KB
Attachments:
Last Edit: 8 years 7 months ago by wadegiles.
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3083

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 675
  • Karma: 181
you could use
ComicBook.FrontCoverPageIndex

to get the index of the first front cover page (this is usually 0, but does not have to be).
Last Edit: 8 years 7 months ago by cYo.
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3091

  • Infina
  • Infina's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
wadegiles wrote:
This script will extract the first page of all selected eComics. The file name is generated based on the eComic series name, volume number, and issue number.

Unzip the file contents into your ComicRack Scripts folder and start ComicRack. Select the eComics for which you want the first page extracted. Under the right click Automation menu, select the "Extract First Page.." menu item. You will be asked where to save all the pages so choose the folder in which you want the pages to be saved.

Let me know if this fulfills your needs. The automatic naming can be customized by editing the ExtractFirstPage.py file.

File Attachment:

File Name: ExtractFir...e1_0.zip
File Size:2 KB

Thanks so much for your efforts. When I try to execute the script, however, it says: Exception has been thrown by the target of an invocation. Could it be caused by my files all being .cb7 format?
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3093

  • ChimChim
  • ChimChim's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Infina wrote:

Thanks so much for your efforts. When I try to execute the script, however, it says: Exception has been thrown by the target of an invocation. Could it be caused by my files all being .cb7 format?

I get the same error message & my files are .cbr
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3094

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
My mistake. Uploaded the wrong file. I also put in cyo's suggestion about the cover index. Updated file is in the second post of this thread.
Attachments:
Last Edit: 8 years 7 months ago by wadegiles.
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3095

  • Infina
  • Infina's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
wadegiles, you are amazing. thanks so much!
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3098

  • Infina
  • Infina's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Is there any way for the exported pages to derive their name from the filename of their respective comics? I seem to run into a conflict with similarly named comics in the same directory.
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3100

  • wadegiles
  • wadegiles's Avatar
  • Offline
  • Gold Boarder
  • Posts: 248
  • Thank you received: 3
  • Karma: 20
Replace this text in ExtractFirstPage.py. Use any plain text editor like Notepad:

destinationFilePath = destinationFolder + CreateComicName(book) + ' Page' + pageNameString + '.jpg'

with the following:

destinationFilePath = destinationFolder + book.FileName + ' Page' + pageNameString + '.jpg'


The difference between the two lines is in bold red text.
Last Edit: 8 years 7 months ago by wadegiles.
The administrator has disabled public write access.

Re:Extract only 1st page in archive (cover page) 8 years 7 months ago #3103

  • Tension113
  • Tension113's Avatar
  • Offline
  • Senior Boarder
  • Posts: 49
  • Thank you received: 2
  • Karma: 0
Had to register just to say thank you so much for this script.. This is exactly what I was looking for.. Just came across ComicRack yesterday and so far I think it's great.. I also use XBMC to browse through my comics but was having a problem with thumbnails showing up in there.. This script fixes that..

Can I change something in the destinationfolder= to have it automatically extract the image into the same folder as the file it's extracting it from? I'm only doing one folder at a time right now, but it'd be cool to be able to select the entire bunch..

Thanks again..
The administrator has disabled public write access.
Time to create page: 0.219 seconds

Who's Online

We have 207 guests and 10 members online