1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-12 17:26:23 +00:00

Sync droplet

This commit is contained in:
Ciro Mattia Gonano
2013-01-25 14:12:24 +01:00
parent 292f77d0bd
commit 553611399e
6 changed files with 26 additions and 19 deletions

View File

@@ -59,7 +59,7 @@
<key>savedFrame</key>
<string>144 338 889 690 0 0 1680 1028 </string>
<key>selectedTabView</key>
<string>result</string>
<string>event log</string>
</dict>
</dict>
</plist>

View File

@@ -239,7 +239,7 @@ def Usage():
parser.print_help()
def main(argv=None):
global parser, options
global parser, options, epub_path
usage = "Usage: %prog [options] comic_file|comic_folder"
parser = OptionParser(usage=usage, version=__version__)
parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD",
@@ -250,14 +250,14 @@ def main(argv=None):
help="Split pages 'manga style' (right-to-left reading) [default=False]")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
help="Verbose output [default=False]")
parser.add_option("-i", "--image-processing", action="store_false", dest="imgproc", default=True,
help="Apply image preprocessing (page splitting and optimizations) [default=True]")
parser.add_option("--no-image-processing", action="store_false", dest="imgproc", default=True,
help="Do not apply image preprocessing (page splitting and optimizations) [default=True]")
parser.add_option("--upscale-images", action="store_true", dest="upscale", default=False,
help="Resize images smaller than device's resolution [default=False]")
parser.add_option("--stretch-images", action="store_true", dest="stretch", default=False,
help="Stretch images to device's resolution [default=False]")
parser.add_option("--cut-page-numbers", action="store_false", dest="cutpagenumbers", default=True,
help="Try to cut page numbering on images [default=True]")
parser.add_option("--no-cut-page-numbers", action="store_false", dest="cutpagenumbers", default=True,
help="Do not try to cut page numbering on images [default=True]")
options, args = parser.parse_args(argv)
if len(args) != 1:
parser.print_help()
@@ -269,7 +269,11 @@ def main(argv=None):
dirImgProcess(path)
print "Creating ePub structure..."
genEpubStruct(path)
epub_path = path
def getEpubPath():
global epub_path
return epub_path
if __name__ == "__main__":
Copyright()

View File

@@ -206,6 +206,20 @@ class SectionStripper:
def getHeader(self):
return self.stripped_data_header
def main(argv=None):
infile = argv[0]
outfile = argv[1]
data_file = file(infile, 'rb').read()
try:
strippedFile = SectionStripper(data_file)
file(outfile, 'wb').write(strippedFile.getResult())
print "Header Bytes: " + binascii.b2a_hex(strippedFile.getHeader())
if len(argv)==3:
file(argv[2], 'wb').write(strippedFile.getStrippedData())
except StripException, e:
print "Error: %s" % e
sys.exit(1)
if __name__ == "__main__":
sys.stdout=Unbuffered(sys.stdout)
print ('KindleStrip v%(__version__)s. '
@@ -218,16 +232,5 @@ if __name__ == "__main__":
print "<strippeddatafile> is optional."
sys.exit(1)
else:
infile = sys.argv[1]
outfile = sys.argv[2]
data_file = file(infile, 'rb').read()
try:
strippedFile = SectionStripper(data_file)
file(outfile, 'wb').write(strippedFile.getResult())
print "Header Bytes: " + binascii.b2a_hex(strippedFile.getHeader())
if len(sys.argv)==4:
file(sys.argv[3], 'wb').write(strippedFile.getStrippedData())
except StripException, e:
print "Error: %s" % e
sys.exit(1)
main(sys.argv[1:])
sys.exit(0)

View File

@@ -59,7 +59,7 @@
<key>savedFrame</key>
<string>144 338 889 690 0 0 1680 1028 </string>
<key>selectedTabView</key>
<string>result</string>
<string>event log</string>
</dict>
</dict>
</plist>

Binary file not shown.