From 77e28d38d47dbfcf29030ee388854d59df3ef1d0 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 9 Aug 2017 19:50:33 +0200 Subject: [PATCH] Some fixes: - Fix woopsie compile error - Fix delete not working on GUI if not cached - Fix FimFictionApi to accept new API format for _html --- src/be/nikiroo/fanfix/reader/GuiReader.java | 4 +++- .../nikiroo/fanfix/reader/TuiReaderApplication.java | 2 +- src/be/nikiroo/fanfix/supported/FimfictionApi.java | 12 ++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/GuiReader.java b/src/be/nikiroo/fanfix/reader/GuiReader.java index 2f1b339..73df7fb 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/GuiReader.java @@ -205,7 +205,9 @@ class GuiReader extends BasicReader { // delete from main library void delete(String luid) { try { - localLibrary.delete(luid); + if (localLibrary.getInfo(luid) != null) { + localLibrary.delete(luid); + } getLibrary().delete(luid); } catch (IOException e) { Instance.syserr(e); diff --git a/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java b/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java index 384919a..fd58509 100644 --- a/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java +++ b/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java @@ -188,7 +188,7 @@ class TuiReaderApplication extends TApplication implements Reader { case MENU_EXIT: if (messageBox("Confirmation", "(TODO: i18n) Exit application?", TMessageBox.Type.YESNO).getResult() == TMessageBox.Result.YES) { - exit(false); + //exit(false); } return true; diff --git a/src/be/nikiroo/fanfix/supported/FimfictionApi.java b/src/be/nikiroo/fanfix/supported/FimfictionApi.java index b2d75df..9c3e71d 100644 --- a/src/be/nikiroo/fanfix/supported/FimfictionApi.java +++ b/src/be/nikiroo/fanfix/supported/FimfictionApi.java @@ -87,19 +87,15 @@ class FimfictionApi extends BasicSupport { // Selectors, so to download all I need and only what I need String storyContent = "fields[story]=title,description,date_published,cover_image"; String authorContent = "fields[author]=name"; - String chapterContent = "fields[chapter]=chapter_number,title,content,authors_note"; - String contentContent = "fields[content]=html"; - String authorsNoteContent = "fields[authors_note]=html"; + String chapterContent = "fields[chapter]=chapter_number,title,content_html,authors_note_html"; String includes = "author,chapters,tags"; String urlString = String.format( "https://www.fimfiction.net/api/v2/stories/%s?" // - + "%s&%s&"// + "%s&%s&%s&" // + "include=%s", // storyId, // - storyContent, authorContent, // - chapterContent, contentContent, authorsNoteContent,// + storyContent, authorContent, chapterContent,// includes); // URL params must be URL-encoded: "[ ]" <-> "%5B %5D" @@ -180,8 +176,8 @@ class FimfictionApi extends BasicSupport { final int number = Integer.parseInt(json.substring(posNumber, posComa).trim()); final String title = getKeyJson(json, pos, "title"); - String notes = getKeyJson(json, pos, "authors_note", "html"); - String content = getKeyJson(json, pos, "content", "html"); + String notes = getKeyJson(json, pos, "authors_note_html"); + String content = getKeyJson(json, pos, "content_html"); chapterNames.put(number, title); chapterContents -- 2.27.0