use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class DownloadVideoService method updateNotification.
private void updateNotification(BaseDownloadTask task, int soFarBytes, int totalBytes) {
int progress = (int) (((float) soFarBytes / totalBytes) * 100);
String fileSize = Formatter.formatFileSize(DownloadVideoService.this, soFarBytes).replace("MB", "") + "/ " + Formatter.formatFileSize(DownloadVideoService.this, totalBytes);
UnLimit91PornItem unLimit91PornItem = dataManager.findUnLimit91PornItemByDownloadId(task.getId());
if (unLimit91PornItem != null) {
if (task.getStatus() == FileDownloadStatus.completed) {
List<UnLimit91PornItem> unLimit91PornItemList = dataManager.findUnLimit91PornItemsByDownloadStatus(FileDownloadStatus.progress);
if (unLimit91PornItemList.size() == 0) {
stopForeground(true);
}
} else {
startNotification(unLimit91PornItem.getTitle(), progress, fileSize, task.getSpeed());
}
} else {
List<UnLimit91PornItem> unLimit91PornItemList = dataManager.loadDownloadingData();
if (unLimit91PornItemList.size() == 0) {
stopForeground(true);
}
}
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class AppApiHelper method loadPorn91MyFavoriteVideos.
@Override
public Observable<BaseResult<List<UnLimit91PornItem>>> loadPorn91MyFavoriteVideos(String userName, int page, boolean cleanCache) {
Observable<String> favoriteObservable = noLimit91PornServiceApi.myFavoriteVideo(page, HeaderUtils.getIndexHeader(addressHelper));
DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(userName, page);
EvictDynamicKey evictDynamicKey = new EvictDynamicKey(cleanCache);
return cacheProviders.getFavorite(favoriteObservable, dynamicKeyGroup, evictDynamicKey).map(new Function<Reply<String>, String>() {
@Override
public String apply(Reply<String> responseBody) throws Exception {
return responseBody.getData();
}
}).map(new Function<String, BaseResult<List<UnLimit91PornItem>>>() {
@Override
public BaseResult<List<UnLimit91PornItem>> apply(String s) throws Exception {
return Parse91PronVideo.parseMyFavorite(s);
}
});
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class Parse91PronVideo method parseIndex.
/**
* 解析主页
*
* @param html 主页html
* @return 视频列表
*/
public static List<UnLimit91PornItem> parseIndex(String html) {
List<UnLimit91PornItem> unLimit91PornItemList = new ArrayList<>();
Document doc = Jsoup.parse(html);
Element body = doc.getElementById("tab-featured");
Elements itms = body.select("p");
for (Element element : itms) {
UnLimit91PornItem unLimit91PornItem = new UnLimit91PornItem();
String title = element.getElementsByClass("title").first().text();
unLimit91PornItem.setTitle(title);
// Logger.d(title);
String imgUrl = element.select("img").first().attr("src");
unLimit91PornItem.setImgUrl(imgUrl);
// Logger.d(imgUrl);
String duration = element.getElementsByClass("duration").first().text();
unLimit91PornItem.setDuration(duration);
// Logger.d(duration);
String contentUrl = element.select("a").first().attr("href");
String viewKey = contentUrl.substring(contentUrl.indexOf("=") + 1);
unLimit91PornItem.setViewKey(viewKey);
// Logger.d(viewKey);
String allInfo = element.text();
int start = allInfo.indexOf("添加时间");
String info = allInfo.substring(start);
unLimit91PornItem.setInfo(info);
// Logger.d(info);
unLimit91PornItemList.add(unLimit91PornItem);
}
return unLimit91PornItemList;
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class Parse91PronVideo method parseMyFavorite.
/**
* 解析我的收藏
*
* @param html html
* @return list
*/
public static BaseResult<List<UnLimit91PornItem>> parseMyFavorite(String html) {
int totalPage = 1;
List<UnLimit91PornItem> unLimit91PornItemList = new ArrayList<>();
Document doc = Jsoup.parse(html);
Element body = doc.getElementById("leftside");
Elements videos = doc.select("div.myvideo");
for (Element element : videos) {
UnLimit91PornItem unLimit91PornItem = new UnLimit91PornItem();
String contentUrl = element.select("a").first().attr("href");
String viewKey = contentUrl.substring(contentUrl.indexOf("=") + 1, contentUrl.length());
unLimit91PornItem.setViewKey(viewKey);
Logger.t(TAG).d(viewKey);
String title = element.select("strong").first().text();
unLimit91PornItem.setTitle(title);
Logger.t(TAG).d(title);
String imgUrl = element.select("img").first().attr("src");
unLimit91PornItem.setImgUrl(imgUrl);
Logger.t(TAG).d(imgUrl);
String allInfo = element.text();
Logger.t(TAG).d(allInfo);
String duration = allInfo.substring(allInfo.indexOf("时长") + 3, allInfo.indexOf("Views") - 3);
unLimit91PornItem.setDuration(duration);
Logger.t(TAG).d(duration);
String info = allInfo.substring(allInfo.indexOf("添加时间"), allInfo.length());
unLimit91PornItem.setInfo(info);
Logger.t(TAG).d(info);
String rvid = element.select("input").first().attr("value");
Logger.t(TAG).d("rvid::" + rvid);
VideoResult videoResult = new VideoResult();
videoResult.setId(VideoResult.OUT_OF_WATCH_TIMES);
videoResult.setVideoId(rvid);
unLimit91PornItem.setVideoResult(videoResult);
unLimit91PornItemList.add(unLimit91PornItem);
}
// 总页数
Element pagingnav = body.getElementById("paging");
Elements a = pagingnav.select("a");
if (a.size() >= 2) {
String ppp = a.get(a.size() - 2).text();
if (TextUtils.isDigitsOnly(ppp)) {
totalPage = Integer.parseInt(ppp);
Logger.d("总页数:" + totalPage);
}
}
BaseResult<List<UnLimit91PornItem>> baseResult = new BaseResult<>();
// 尝试解析删除信息
Elements msgElements = doc.select("div.msgbox");
if (msgElements != null) {
String msgInfo = msgElements.text();
if (!TextUtils.isEmpty(msgInfo)) {
baseResult.setCode(BaseResult.SUCCESS_CODE);
baseResult.setMessage(msgInfo);
}
} else {
String errorMsg = parseErrorInfo(html);
if (!TextUtils.isEmpty(errorMsg)) {
baseResult.setMessage(errorMsg);
baseResult.setCode(BaseResult.ERROR_CODE);
}
}
baseResult.setTotalPage(totalPage);
baseResult.setData(unLimit91PornItemList);
return baseResult;
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class Parse91PronVideo method parseSearchVideos.
public static BaseResult<List<UnLimit91PornItem>> parseSearchVideos(String html) {
int totalPage = 1;
List<UnLimit91PornItem> unLimit91PornItemList = new ArrayList<>();
Document doc = Jsoup.parse(html);
Element body = doc.getElementById("fullside");
if (body == null) {
String errorMsg = parseErrorInfo(html);
Logger.t(TAG).d(errorMsg);
BaseResult baseResult = new BaseResult();
baseResult.setCode(BaseResult.ERROR_CODE);
baseResult.setMessage(errorMsg);
return baseResult;
}
Elements listchannel = body.getElementsByClass("listchannel");
for (Element element : listchannel) {
UnLimit91PornItem unLimit91PornItem = new UnLimit91PornItem();
String contentUrl = element.select("a").first().attr("href");
// Logger.d(contentUrl);
contentUrl = contentUrl.substring(0, contentUrl.indexOf("&"));
// Logger.d(contentUrl);
String viewKey = contentUrl.substring(contentUrl.indexOf("=") + 1);
unLimit91PornItem.setViewKey(viewKey);
// Logger.d(viewKey);
String imgUrl = element.select("a").first().select("img").first().attr("src");
// Logger.d(imgUrl);
unLimit91PornItem.setImgUrl(imgUrl);
String title = element.select("span.title").text();
// Logger.d(title);
unLimit91PornItem.setTitle(title);
String duration = element.select("span.duration").text();
unLimit91PornItem.setDuration(duration);
String allInfo = element.text();
int start = allInfo.indexOf("添加时间");
String info = allInfo.substring(start);
unLimit91PornItem.setInfo(info.replace("还未被评分", ""));
// Logger.d(info);
unLimit91PornItemList.add(unLimit91PornItem);
}
// 总页数
Element pagingnav = body.getElementById("paging");
Elements a = pagingnav.select("a");
if (a.size() > 2) {
String ppp = a.get(a.size() - 2).text();
if (TextUtils.isDigitsOnly(ppp)) {
totalPage = Integer.parseInt(ppp);
// Logger.d("总页数:" + totalPage);
}
}
BaseResult<List<UnLimit91PornItem>> baseResult = new BaseResult<>();
baseResult.setTotalPage(totalPage);
baseResult.setData(unLimit91PornItemList);
return baseResult;
}
Aggregations