+ error('No Content-Type!')
+
+
+def parse_args(argv):
+ from optparse import OptionParser
+ parser = OptionParser(usage="%prog [OPTIONS] QUERY [FILTER ...]",
+ description="""
+Download subtitles from subdivx.com searching the string QUERY. If FILTERs are
+specified, only subtitles that matches all those filters are downloaded.
+Filters have the format "X:fitler", where X is a field specification: t=titulo,
+d=desc, a=autor, f=formato, c=comentarios, C=cds, F=fecha and D=downloads.
+filter is a string that should be found on that field (case insensitive). If
+the format specifier is not known (or there isn't one) the filter string is
+looked in all the fields.
+ """.strip())
+ parser.add_option("-l", "--list-only",
+ default=False, action='store_true',
+ help="don't download the subtitles, just list them")
+ parser.add_option("-q", "--quiet",
+ default=False, action='store_true',
+ help="don't print progress messages")
+
+ (opts, args) = parser.parse_args()
+ if not args:
+ parser.error("Missing query string")
+
+ if opts.quiet and opts.list_only:
+ parser.error("Using --quiet and --list-only together doesn't "
+ "make any sense")
+
+ return (args[0], args[1:], opts)
+
+(query_str, filters, opts) = parse_args(sys.argv)
+
+get_subs(query_str, filters)