diff --git a/scripts/find_dupes.py b/scripts/find_dupes.py index 57c6476..bf6f94e 100755 --- a/scripts/find_dupes.py +++ b/scripts/find_dupes.py @@ -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: diff --git a/scripts/make_links.py b/scripts/make_links.py index 7f0b8cf..c99167e 100755 --- a/scripts/make_links.py +++ b/scripts/make_links.py @@ -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)) ) diff --git a/scripts/remove_ads.py b/scripts/remove_ads.py index 656f355..fbfe04f 100755 --- a/scripts/remove_ads.py +++ b/scripts/remove_ads.py @@ -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__': diff --git a/scripts/validate_cover.py b/scripts/validate_cover.py index 70e92cc..468201e 100755 --- a/scripts/validate_cover.py +++ b/scripts/validate_cover.py @@ -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 )