Script fixes

git-svn-id: http://comictagger.googlecode.com/svn/trunk@507 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville@gmail.com 2013-02-14 21:07:36 +00:00
parent ee5b4a689e
commit 8759784561
4 changed files with 17 additions and 11 deletions

View File

@ -24,7 +24,7 @@ def main():
filelist = utils.get_recursive_filelist( sys.argv[1:] )
#first find all comics with metadata
print "reading in all comics..."
print >> sys.stderr, "reading in all comics..."
comic_list = []
max_name_len = 2
for filename in filelist:

View File

@ -39,7 +39,7 @@ def make_folder( folder ):
def make_link( source, link ):
if not os.path.exists( link ):
os.symlink( source , link )
os.symlink( os.path.abspath(source) , link )
def main():
utils.fix_output_encoding()
@ -94,7 +94,12 @@ def main():
make_link( filename, os.path.join(date_folder, os.path.basename(filename)) )
#do publisher/series organizing:
series_folder = os.path.join(link_root, "series", str(md.publisher), str(md.series))
fixed_series_name = md.series
if fixed_series_name is not None:
# some tweaks to keep various filesystems happy
fixed_series_name = fixed_series_name.replace("/", "-")
fixed_series_name = fixed_series_name.replace("?", "")
series_folder = os.path.join(link_root, "series", str(md.publisher), unicode(fixed_series_name))
make_folder( series_folder )
make_link( filename, os.path.join(series_folder, os.path.basename(filename)) )

View File

@ -27,9 +27,9 @@ import tempfile
import zipfile
import shutil
from comictaggerlib.comicarchive import *
import comictaggerlib.utils
from comictaggerlib.settings import *
import comictagger.utils
from comictaggerlib.comicarchive import *
subfolder_name = "PRE_AD_REMOVAL"
unwanted_types = [ 'Deleted', 'Advertisment' ]
@ -70,7 +70,7 @@ def main():
#skip any of our generated subfolders...
if os.path.basename(curr_folder) == subfolder_name:
continue
sys.out.write("Removing unwanted pages from " + filename)
sys.stdout.write("Removing unwanted pages from " + filename)
# verify that we can write to current folder
if not os.access(filename, os.W_OK):
@ -97,7 +97,6 @@ def main():
new_pages = list()
for p in md.pages:
if p.has_key('Type') and p['Type'] in unwanted_types:
continue
else:
pageNum = int(p['Image'])
@ -120,7 +119,9 @@ def main():
new_num += 1
#preserve the old comment
zout.comment = ca.archiver.getArchiveComment()
comment = ca.archiver.getArchiveComment()
if comment is not None:
zout.comment = ca.archiver.getArchiveComment()
except Exception as e:
print "Failure creating new archive: {0}!".format(filename)
@ -141,7 +142,7 @@ def main():
# Create a new archive object for the new file, and write the old CIX data, with new page info
ca = ComicArchive( filename, settings )
md.pages = new_pages
ca.writeMetadata( style )
ca.writeMetadata( style, md )
if __name__ == '__main__':

View File

@ -41,12 +41,12 @@ def main():
issue_id = sys.argv[2]
if not os.path.exists(filename):
print >> sys.stderr, opts.filename + ": not found!"
print >> sys.stderr, filename + ": not found!"
return
ca = ComicArchive(filename, settings )
if not ca.seemsToBeAComicArchive():
print >> sys.stderr, "Sorry, but "+ opts.filename + " is not a comic archive!"
print >> sys.stderr, "Sorry, but "+ filename + " is not a comic archive!"
return
ii = IssueIdentifier( ca, settings )