X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=automanga;h=0381786b830ef00871330c2ed29326d8165641cd;hb=fab0538835546d145a61ffe2771bcb0a23f89a50;hp=34c08050bf8d4499dbd3c175462518a1bfc2ee00;hpb=1f51eb5842dd016ac3258b670be44633d22062fc;p=automanga.git diff --git a/automanga b/automanga index 34c0805..0381786 100755 --- a/automanga +++ b/automanga @@ -1,20 +1,20 @@ #!/usr/bin/python import sys, getopt -import manga.lib, manga.reader, manga.local +import manga.lib, manga.reader, manga.profile, manga.local import glib, gobject, gtk gobject.threads_init() gtk.gdk.threads_init() def usage(out): - out.write("usage: automanga [-h] [DIR]\n") - out.write(" automanga [-h] -l LIBRARY ID\n") + out.write("usage: automanga [-h] [-p PROFILE] [-l LIBRARY] [DIR-OR-ID]\n") out.write(" automanga [-h] -s LIBRARY NAME\n") libname = None search = False -opts, args = getopt.getopt(sys.argv[1:], "hl:s") +profile = "" +opts, args = getopt.getopt(sys.argv[1:], "hl:sp:") for o, a in opts: if o == "-h": usage(sys.stdout) @@ -23,6 +23,18 @@ for o, a in opts: libname = a elif o == "-s": search = True + elif o == "-p": + if a == "": + profile = None + else: + profile = a +if profile == "": + try: + profile = manga.profile.profile.last() + except KeyError: + profile = manga.profile.profile.byname("default") +elif profile is not None: + profile = manga.profile.profile.byname(profile) if search: if len(args) < 2: @@ -52,11 +64,16 @@ if libname is not None: sys.stderr.write("automanga: no such manga: %s\n" % args[0]) sys.exit(1) else: + libname = "local" if len(args) > 0: mng = manga.local.manga(args[0]) else: mng = manga.local.manga(".") -reader = manga.reader.reader(mng) +mprof = None if profile is None else profile.getmanga(libname, mng.id, True) +if profile is not None: + profile.setlast() + +reader = manga.reader.reader(mng, mprof) reader.show() gtk.main()