From f040f8dc74b1e5f810568e2a72ebe0d0651be88e Mon Sep 17 00:00:00 2001 From: beville Date: Tue, 4 Dec 2012 05:27:32 +0000 Subject: [PATCH] Added a terse mode for only printing the page count and tags block types git-svn-id: http://comictagger.googlecode.com/svn/trunk@201 6c5673fe-1810-88d6-992b-cd32ca31540c --- comictagger.py | 9 +++++++-- options.py | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/comictagger.py b/comictagger.py index 4d1328d..af427b1 100755 --- a/comictagger.py +++ b/comictagger.py @@ -123,8 +123,13 @@ def process_file_cli( filename, opts, settings ): brief += "]" print brief - print - + + if opts.terse: + sys.stdout.flush() + return + + print + if opts.data_style is None or opts.data_style == MetaDataStyle.CIX: if has[ MetaDataStyle.CIX ]: print "------ComicRack tags--------" diff --git a/options.py b/options.py index d8a1022..3afd2ea 100644 --- a/options.py +++ b/options.py @@ -72,6 +72,7 @@ If no options are given, {0} will run in windowed mode -r, --rename Rename the file based on specified tag style. --noabort Don't abort save operation when online match is of low confidence -v, --verbose Be noisy when doing what it does + --terse Don't say much (for print mode) -h, --help Display this message """ @@ -81,6 +82,7 @@ If no options are given, {0} will run in windowed mode self.no_gui = False self.filename = None self.verbose = False + self.terse = False self.metadata = None self.print_tags = False self.delete_tags = False @@ -162,7 +164,7 @@ If no options are given, {0} will run in windowed mode opts, args = getopt.getopt( input_args, "hpdt:fm:vonsr", [ "help", "print", "delete", "type=", "parsefilename", "metadata=", "verbose", - "online", "dryrun", "save", "rename" , "raw", "noabort" ]) + "online", "dryrun", "save", "rename" , "raw", "noabort", "terse" ]) except getopt.GetoptError as err: self.display_help_and_quit( str(err), 2 ) @@ -193,6 +195,8 @@ If no options are given, {0} will run in windowed mode self.raw = True if o in ("--noabort"): self.abortOnLowConfidence = False + if o in ("--terse"): + self.terse = True if o in ("-t", "--type"): if a.lower() == "cr": self.data_style = MetaDataStyle.CIX