X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=automanga;h=bb6c4d5f1ca331f688966d19958b76c0f1128886;hb=e7cc76067ff041bf8edd6c79f2d96df97c8eaf58;hp=8fad81758b93a560e0f6bd87cf619d18b8e15e3b;hpb=5c000565c156ae32de0480e83d98f12e65f14f03;p=automanga.git diff --git a/automanga b/automanga index 8fad817..bb6c4d5 100755 --- a/automanga +++ b/automanga @@ -1,11 +1,11 @@ -#!/usr/bin/python +#!/usr/bin/python3 import sys, getopt import manga.lib, manga.reader, manga.profile, manga.local -import glib, gobject, gtk +from gi.repository import Gtk, Gdk, GObject -gobject.threads_init() -gtk.gdk.threads_init() +GObject.threads_init() +Gdk.threads_init() def usage(out): out.write("usage: automanga [-h] [-p PROFILE] {DIRECTORY|-l LIBRARY ID|-a ALIAS}\n") @@ -79,7 +79,11 @@ def main(): if listtag is not None: if profile is not None: for mprof in profile.bytag(listtag): - mng = mprof.open() + try: + mng = mprof.open() + except KeyError: + sys.stderr.write("%s %s: no longer found\n" % (mprof.libnm, mprof.id)) + continue sys.stdout.write("%s %s: \"%s\"\n" % (mprof.libnm, mprof.id, mng.name)) return @@ -106,7 +110,7 @@ def main(): try: libname, mid = profile.getalias(alias) except KeyError: - sys.stderr("automanga: no such alias: %s\n" % alias) + sys.stderr.write("automanga: no such alias: %s\n" % alias) sys.exit(1) try: lib = manga.lib.findlib(libname) @@ -152,14 +156,13 @@ def main(): if mprof is not None: ntags = [tag for tag in args if tag[:1] != "-"] rtags = [tag[1:] for tag in args if tag[:1] == "-"] - print ntags, rtags if ntags: mprof.tags.add(*ntags) if rtags: mprof.tags.remove(*rtags) return reader = manga.reader.reader(mng, mprof) reader.show() - gtk.main() + Gtk.main() try: main()