Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Jul 2, 2019
1 parent b425477 commit a6a522c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public static void getInfosOfRegex(String res, String[] regs, int index,
Debug.printLog(tag, "└详情预处理完成");

Debug.printLog(tag, "┌获取书籍名称");
if (!isEmpty(infoList[0])) bookInfoBean.setName(infoList[0]);
if (!isEmpty(infoList[0])) bookInfoBean.setName(StringUtils.formatHtml(infoList[0]));
Debug.printLog(tag, "└" + infoList[0]);

Debug.printLog(tag, "┌获取作者名称");
if (!isEmpty(infoList[1])) bookInfoBean.setAuthor(infoList[1]);
if (!isEmpty(infoList[1])) bookInfoBean.setAuthor(StringUtils.formatHtml(infoList[1]));
Debug.printLog(tag, "└" + infoList[1]);

Debug.printLog(tag, "┌获取分类信息");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.kunfei.bookshelf.bean.BookSourceBean;
import com.kunfei.bookshelf.model.analyzeRule.AnalyzeByRegex;
import com.kunfei.bookshelf.model.analyzeRule.AnalyzeRule;
import com.kunfei.bookshelf.utils.StringUtils;

import io.reactivex.Observable;

Expand Down Expand Up @@ -71,12 +72,12 @@ Observable<BookShelfBean> analyzeBookInfo(String s, final BookShelfBean bookShel
Debug.printLog(tag, "└详情预处理完成");

Debug.printLog(tag, "┌获取书名");
String bookName = analyzer.getString(bookSourceBean.getRuleBookName());
String bookName = StringUtils.formatHtml(analyzer.getString(bookSourceBean.getRuleBookName()));
if (!isEmpty(bookName)) bookInfoBean.setName(bookName);
Debug.printLog(tag, "└" + bookName);

Debug.printLog(tag, "┌获取作者");
String bookAuthor = analyzer.getString(bookSourceBean.getRuleBookAuthor());
String bookAuthor = StringUtils.formatHtml(analyzer.getString(bookSourceBean.getRuleBookAuthor()));
if (!isEmpty(bookAuthor)) bookInfoBean.setAuthor(bookAuthor);
Debug.printLog(tag, "└" + bookAuthor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ private SearchBookBean getItem(AnalyzeRule analyzer, String baseUrl) throws Exce
}
Debug.printLog(tag, ">书籍网址:" + baseUrl);
Debug.printLog(tag, "┌获取书名");
String bookName = analyzer.getString(bookSourceBean.getRuleBookName());
String bookName = StringUtils.formatHtml(analyzer.getString(bookSourceBean.getRuleBookName()));
Debug.printLog(tag, "└" + bookName);
if (!TextUtils.isEmpty(bookName)) {
item.setName(bookName);
Debug.printLog(tag, "┌获取作者");
item.setAuthor(analyzer.getString(bookSourceBean.getRuleBookAuthor()));
item.setAuthor(StringUtils.formatHtml(analyzer.getString(bookSourceBean.getRuleBookAuthor())));
Debug.printLog(tag, "└" + item.getAuthor());
Debug.printLog(tag, "┌获取封面");
item.setCoverUrl(analyzer.getString(bookSourceBean.getRuleCoverUrl(), true));
Expand All @@ -231,14 +231,14 @@ private SearchBookBean getItemAllInOne(AnalyzeRule analyzer, Object object, Stri
analyzer.setBook(item);
NativeObject nativeObject = (NativeObject) object;
Debug.printLog(tag, "┌获取书名", printLog);
String bookName = String.valueOf(nativeObject.get(ruleName));
String bookName = StringUtils.formatHtml(String.valueOf(nativeObject.get(ruleName)));
Debug.printLog(tag, "└" + bookName, printLog);
if (!isEmpty(bookName)) {
item.setTag(tag);
item.setOrigin(sourceName);
item.setName(bookName);
Debug.printLog(tag, "┌获取作者", printLog);
item.setAuthor(String.valueOf(nativeObject.get(ruleAuthor)));
item.setAuthor(StringUtils.formatHtml(String.valueOf(nativeObject.get(ruleAuthor))));
Debug.printLog(tag, "└" + item.getAuthor(), printLog);
Debug.printLog(tag, "┌获取分类", printLog);
item.setKind(StringUtils.join(",", String.valueOf(nativeObject.get(ruleKind))));
Expand Down Expand Up @@ -266,14 +266,14 @@ private SearchBookBean getItemInList(AnalyzeRule analyzer, String baseUrl, boole
SearchBookBean item = new SearchBookBean();
analyzer.setBook(item);
Debug.printLog(tag, "┌获取书名", printLog);
String bookName = analyzer.getString(ruleName);
String bookName = StringUtils.formatHtml(analyzer.getString(ruleName));
Debug.printLog(tag, "└" + bookName, printLog);
if (!TextUtils.isEmpty(bookName)) {
item.setTag(tag);
item.setOrigin(sourceName);
item.setName(bookName);
Debug.printLog(tag, "┌获取作者", printLog);
item.setAuthor(analyzer.getString(ruleAuthor));
item.setAuthor(StringUtils.formatHtml(analyzer.getString(ruleAuthor)));
Debug.printLog(tag, "└" + item.getAuthor(), printLog);
Debug.printLog(tag, "┌获取分类", printLog);
item.setKind(StringUtils.join(",", analyzer.getStringList(ruleKind)));
Expand Down Expand Up @@ -357,8 +357,8 @@ private List<SearchBookBean> getBooksOfRegex(String res, String[] regs, int inde
}
// 保存当前节点的书籍信息
item.setSearchInfo(
infoList[0], // 保存书名
infoList[1], // 保存作者
StringUtils.formatHtml(infoList[0]), // 保存书名
StringUtils.formatHtml(infoList[1]), // 保存作者
infoList[2], // 保存分类
infoList[3], // 保存终章
infoList[4], // 保存简介
Expand Down

0 comments on commit a6a522c

Please sign in to comment.