Welcome, Guest
Python Scripts for ComicRack

TOPIC: Remove scanner credits

Re: Remove scanner credits 5 years 6 months ago #22677

  • dfuse
  • dfuse's Avatar
  • Offline
  • Senior Boarder
  • Posts: 76
  • Thank you received: 3
  • Karma: 4
This must be the best satisfaction/loc ratio I have ever written code for :)
The administrator has disabled public write access.

Re:Remove scanner credits 5 years 2 months ago #25580

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
Here you go.
Move first page to end. It marks the first page as advertisement, the second page as front cover and then moves the first page to the end.
Attachments:
The administrator has disabled public write access.
The following user(s) said Thank You: Ladyrixx, Edtion, Enoch Root, raskozz

Re: Remove scanner credits 4 years 10 months ago #28965

  • bking
  • bking's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
  • Karma: 0
Just wanted to say thanks for creating a simple example to follow that I could use to solve my own problem without having to know python!

I imported a large batch of PDF comics from a purchased DVD, and converted them to CBZ. The PDFs were all scanned with 2 pages on one, so for the conversion I selected "Double pages"=split.

I ended up with all comics having 2 pages tagged as "Front Cover", and the 1st blank one was the thumbnail. With a small alteration to your script I was able to solve my problem in minutes instead of taking days to do it manually!

The attached script (in case anyone else needs it), checks if the 1st 2 pages are both marked as "Front Cover", and if so, it marks the 1st one as "Deleted".
Attachments:
The administrator has disabled public write access.
The following user(s) said Thank You: 600WPMPO

Re:Remove scanner credits 4 years 9 months ago #29183

  • Enoch Root
  • Enoch Root's Avatar
  • Offline
  • Junior Boarder
  • Posts: 27
  • Thank you received: 1
  • Karma: 0
Stonepaw,

This is a great script. I have started looking into Python to see how to move the last page to the front. I thought it would be relatively easy, not so for this non-developer.

Can you provide the line of code that would move the last page to the front?
The administrator has disabled public write access.

Re: Remove scanner credits 4 years 8 months ago #30828

  • Dorin
  • Dorin's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
I just wanted to say this is a huge help to me. Thank you very much
The administrator has disabled public write access.

Re: Remove scanner credits 4 years 1 month ago #36910

  • snailtail
  • snailtail's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 1
  • Karma: 0
Any chance you could mod the plugin to move the first 2 pages to the end (or mark as deleted) - for comics with 2 scanners/advert as the first 2 pages, running move first page to end twice just toggles between the 2 adverts.
The administrator has disabled public write access.

Remove scanner credits 3 years 9 months ago #38010

  • Kickka
  • Kickka's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Just wondering if someone could help me with an issue I've been having with this script since, well since I started using it. Specifically Stonepaws "Move first to end" version.

When I run the script this is what happens:
-Page 1 gets marked as advertisement (edited to make it deleted)
-Page 2 gets marked as cover
-Page 1 gets moved to Page 2

Obviously the bold bit is the issue, the page isn't being moved to the end. Though it usually gets moved into page 2 slot it sometimes just goes into a random location. I just did a batch of 10 comics, 9 of the credits pages got moved to the second page and one of them got moved to page 12 (of 17). Really all 10 cases is incorrect since the page should be moved to the end but thought I would specify.

I've even tried to fix the script but to no avail. I cannot get the books.movePage() method (may be slightly off with the name, don't have the script open right now) to work as intended. I've tried just hardcoding the position and testing it with no luck. Looked un the api reference list in the wiki for help but that page is pretty sparse and missing methods (like movePage).

Any help would be greatly appreciated
The administrator has disabled public write access.

Remove scanner credits 3 years 9 months ago #38013

  • bking
  • bking's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
  • Karma: 0
Here are two examples.
One moves the first page to the end; and the other moves the last page to the first.

Hopefully the examples will help you figure out your issue.
Attachments:
The administrator has disabled public write access.

Remove scanner credits 3 years 9 months ago #38019

  • Kickka
  • Kickka's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
I looked at the code you gave me and even tried it out. The code for moving page to the end still didn't work but the code for moving the last page to the start did. That gave me the obvious solution of looping all but one end page to the start, not a great fix but can't argue with results.

For anyone else having the same issues as I detailed 2 posts up, here is the code I used to fix it (this is just minor edits to Stonepaw's original work):
################################################################################
#
# Copyright Stonepaw 2012.
# Any code can be used or modified from this file as long as credit is given
#
# Modified by Kickka 2014
# Edits include:
#   -Changing page type from advert to deleted
#   -Changing directly move page to last into looping all pages but 1 from
#      the end to the start (dirty fix to get past a issue with moving)
#
################################################################################

#@Hook Books
#@Name Move First Page to End
import clr
clr.AddReference("ComicRack.Engine")
from cYo.Projects.ComicRack.Engine import ComicPageType

def MoveFirstPageToEnd(books):
    for book in books:
        book.UpdatePageType(1, ComicPageType.FrontCover)
        book.UpdatePageType(0, ComicPageType.Deleted)
	for i in range(0,book.Pages.Count-1):
		book.MovePages(0,[book.Pages[book.Pages.Count-1]])
The administrator has disabled public write access.

Remove scanner credits 3 years 9 months ago #38037

  • Enoch Root
  • Enoch Root's Avatar
  • Offline
  • Junior Boarder
  • Posts: 27
  • Thank you received: 1
  • Karma: 0
I tried this a while ago and decided to change my approach as there are sometimes several scanner pages.

It basically became a highly iterative process where I marked all pages as "story", moved the last page to the front just to see if it was a scanner page, marked that as deleted and then converted to CBZ. Then for the converted comics, I moved the last page to the front, looked to see if it was a scanner page, marked it as deleted and converted again to CBZ. I did this until there were no more scanner pages. Quite boring.

Then I got hooked into Hazel. Now, when I download a comic, Hazel will unarchive it, look at the pages, delete the ones that hit the scanner rules, and re-archive. I don't have to look at anything anymore. If I happen to notice a scanner page at in a comic that my rules missed, I add it as a new rule. I don't see very many scanner pages anymore.

I am on Mac OS X but if you are on Windows, I understand that there is a similar automator named Belvedere.
The administrator has disabled public write access.
Time to create page: 0.356 seconds

Who's Online

We have 219 guests and 4 members online