From 7de079f11e29028d226132d84b4fef3870453599 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 12 Feb 2017 12:01:10 +0100 Subject: [PATCH] Some quick fixes --- src/be/nikiroo/fanfix/Instance.java | 2 +- src/be/nikiroo/fanfix/Main.java | 11 +++-------- src/be/nikiroo/fanfix/supported/InfoText.java | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 4e4705b..71f42dd 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -48,7 +48,7 @@ public class Instance { tmp = new File(tmpDir, "fanfic-tmp"); } if (readerTmp == null) { - tmp = new File(tmpDir, "fanfic-reader"); + readerTmp = new File(tmpDir, "fanfic-reader"); } } else { syserr(new IOException( diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index 10bccec..bb9aee5 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -62,7 +62,6 @@ public class Main { String typeString = null; String chapString = null; String target = null; - String readerTypeString = null; MainAction action = null; Boolean plusInfo = null; @@ -153,11 +152,7 @@ public class Main { exitCode = 255; break; case SET_READER: - if (readerTypeString == null) { - readerTypeString = args[i]; - } else { - exitCode = 255; - } + exitCode = setReaderType(args[i]); break; } } @@ -188,7 +183,6 @@ public class Main { exitCode = 0; break; case SET_READER: - exitCode = setReaderType(readerTypeString); break; } } @@ -474,7 +468,8 @@ public class Main { */ private static int setReaderType(String readerTypeString) { try { - ReaderType readerType = ReaderType.valueOf(readerTypeString); + ReaderType readerType = ReaderType.valueOf(readerTypeString + .toUpperCase()); BasicReader.setDefaultReaderType(readerType); return 0; } catch (IllegalArgumentException e) { diff --git a/src/be/nikiroo/fanfix/supported/InfoText.java b/src/be/nikiroo/fanfix/supported/InfoText.java index 021b8c0..365c51a 100644 --- a/src/be/nikiroo/fanfix/supported/InfoText.java +++ b/src/be/nikiroo/fanfix/supported/InfoText.java @@ -230,12 +230,12 @@ class InfoText extends Text { try { String value = getLine(infoIn, key, 0); if (value != null && !value.isEmpty()) { - value = value.trim().substring(key.length()).trim(); + value = value.trim().substring(key.length() - 1).trim(); if (value.startsWith("'") && value.endsWith("'") || value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1).trim(); } - + return value; } } finally { -- 2.27.0