+ case REMOTE:
+ if (key == null) {
+ key = args[i];
+ } else if (host == null) {
+ host = args[i];
+ } else if (port == null) {
+ port = Integer.parseInt(args[i]);
+
+ BasicLibrary lib = new RemoteLibrary(key, host, port);
+ lib = new CacheLibrary(Instance.getRemoteDir(host), lib);
+
+ BasicReader.setDefaultLibrary(lib);
+
+ action = MainAction.START;
+ } else {
+ exitCode = 255;
+ }
+ break;
+ }
+ }
+
+ final Progress mainProgress = new Progress(0, 80);
+ mainProgress.addProgressListener(new Progress.ProgressListener() {
+ private int current = mainProgress.getMin();
+
+ @Override
+ public void progress(Progress progress, String name) {
+ int diff = progress.getProgress() - current;
+ current += diff;
+
+ if (diff <= 0)
+ return;
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < diff; i++) {
+ builder.append('.');
+ }
+
+ System.err.print(builder.toString());
+
+ if (progress.isDone()) {
+ System.err.println("");
+ }
+ }
+ });
+ Progress pg = new Progress();
+ mainProgress.addProgress(pg, mainProgress.getMax());
+
+ VersionCheck updates = VersionCheck.check();
+ if (updates.isNewVersionAvailable()) {
+ // Sent to syserr so not to cause problem if one tries to capture a
+ // story content in text mode
+ System.err
+ .println("A new version of the program is available at https://github.com/nikiroo/fanfix/releases");
+ System.err.println("");
+ for (Version v : updates.getNewer()) {
+ System.err.println("\tVersion " + v);
+ System.err.println("\t-------------");
+ System.err.println("");
+ for (String item : updates.getChanges().get(v)) {
+ System.err.println("\t- " + item);
+ }
+ System.err.println("");