Beispiel #1
0
 public static String getConfigPath(Issue issue) {
   String savePath = Helper.getBookDirectory() + "/" + issue.path; // issue.path = folder name
   if (!Helper.fileExits(savePath)) {
     Helper.createDirectory(savePath);
   }
   return savePath + "/" + issue.path + ".json";
 }
Beispiel #2
0
 public static String getFileEPubPath(Issue issue) {
   String jsonData = readFile(getConfigPath(issue));
   try {
     JSONObject jobj = new JSONObject(jsonData);
     JSONObject detail = jobj.getJSONObject("detail");
     if (detail.getString("content_type").equals("epub")) {
       JSONArray pages = jobj.getJSONArray("pages");
       JSONObject page = pages.getJSONObject(0);
       String path = page.getString("link");
       String lastPath = path.substring(path.lastIndexOf('/') + 1);
       String filePath = Helper.getBookDirectory() + "/" + issue.path + "/" + lastPath;
       return filePath;
     }
   } catch (JSONException e) {
     e.printStackTrace();
     return null;
   }
   return null;
 }