From 0a18a8cb0a7a57bf1f82df425251334c57f8c39a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 一月 2021 15:40:37 +0800 Subject: [PATCH] 新增手机号/qq/微信绑定 --- src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java | 733 ++++++++------------------------------------------------ 1 files changed, 106 insertions(+), 627 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java b/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java index ce25551..4b3c645 100644 --- a/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java +++ b/src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java @@ -1,652 +1,131 @@ package com.yeshi.buwan.pptv; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; - -import com.yeshi.buwan.dao.juhe.pptv.PPTVMovieVideoDao; import com.yeshi.buwan.domain.VideoInfo; -import com.yeshi.buwan.pptv.entity.PPTVCartoonDetail; -import com.yeshi.buwan.pptv.entity.PPTVCartoonVideo; -import com.yeshi.buwan.pptv.entity.PPTVMovieVideo; -import com.yeshi.buwan.pptv.entity.PPTVShortVideo; -import com.yeshi.buwan.pptv.entity.PPTVShowDetail; -import com.yeshi.buwan.pptv.entity.PPTVShowVideo; -import com.yeshi.buwan.pptv.entity.PPTVTVDetail; -import com.yeshi.buwan.pptv.entity.PPTVTVVideo; -import com.yeshi.buwan.service.imp.juhe.PPTVService; -import com.yeshi.buwan.util.HttpUtil; -import com.yeshi.buwan.util.NumberUtil; +import com.yeshi.buwan.domain.VideoType; +import com.yeshi.buwan.pptv.entity.PPTVProgram; +import com.yeshi.buwan.pptv.entity.PPTVSeries; import com.yeshi.buwan.util.StringUtil; -import com.yeshi.buwan.util.TimeUtil; +import com.yeshi.buwan.util.video.VideoConstant; +import com.yeshi.buwan.vo.AcceptData; -@Component public class PPTVUtil { - public final static int RESOURCE_ID = 16; - public final static String RESOURCE_NAME = "PPTV"; + public final static int RESOURCE_ID=25; - @Resource - private PPTVService pptvService; - @Resource - private PPTVMovieVideoDao pptvMovieVideoDao; + public final static int PLAY_NONE = 0;// 涓嶈兘鎾斁 + public final static int PLAY_HTML = 1;// 璺宠浆绉诲姩绔綉椤垫挱鏀� + public final static int PLAY_SDK = 2;// 鍐呭祵SDK鎾斁 + private static Long getVideoType(PPTVSeries series) { + String type = series.getProgramType(); + if (type.contains("VIP")) { + type = series.getProgramType2(); + } - // 瑙f瀽鐢靛奖 - public void startParseMovie() { - List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_MOVIE); - for (String url : urlList) { - List<PPTVMovieVideo> list = PPTVDataParseUtil.parseMovieListVideo(HttpUtil.get(url)); - for (PPTVMovieVideo pv : list) { - if (pv.getOp().equalsIgnoreCase("del")) {// 鍒犻櫎 - pptvService.deletePPTVMovie(pv); - } else {// 澧炲姞鎴栬�呮洿鏂� - Serializable id = pptvService.saveOrUpdatePPTVMovie(pv); - if (id != null) - pptvService.addPPTVMovieToVideoInfo(pv, false); - } - } - } - } + int videoType = 0; + switch (type) { + case "鐢靛奖": + videoType = VideoConstant.VIDEO_CATEGORY_DIANYING; + break; + case "鐢佃鍓�": + videoType = VideoConstant.VIDEO_CATEGORY_DIANSHIJU; + break; + case "缁艰壓": + videoType = VideoConstant.VIDEO_CATEGORY_ZONGYI; + break; + case "鍔ㄦ极": + videoType = VideoConstant.VIDEO_CATEGORY_DONGMAN; + break; + default: + } - // 瑙f瀽鐢佃鍓� - public void startParseTV() { - List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_TV); - for (int p = 0; p < urlList.size(); p++) { - String url = urlList.get(p); - List<PPTVTVVideo> list = PPTVDataParseUtil.parseTVListVideo(HttpUtil.get(url)); - System.out.println(list.size()); - for (int n = 0; n < list.size(); n++) { - PPTVTVVideo pv = list.get(n); - if (pv.getOp().equalsIgnoreCase("del")) {// 鍒犻櫎 - pptvService.deletePPTVTV(pv); - } else {// 澧炲姞鎴栬�呮洿鏂� - String videoid = pptvService.saveOrUpdatePPTVTV(pv) + ""; - boolean isUpdate = pptvService.hasTVUpdate(pv.getDetailList()); - for (PPTVTVDetail pd : pv.getDetailList()) { + return (long) videoType; + } - pd.setVideoId(pv.getAid()); - if (pd.getOp().equalsIgnoreCase("del")) { - pptvService.deletePPTVTVDetail(pd); - } else { - pptvService.saveOrUpdatePPTVTVDetail(pd); - } - } - if (!StringUtil.isNullOrEmpty(videoid)) - pptvService.addPPTVTVToVideoInfo(pv, isUpdate); - } - } - } - } - // 瑙f瀽缁艰壓 - public void startParseShow() { - List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_SHOW); - for (String url : urlList) { - List<PPTVShowVideo> list = PPTVDataParseUtil.parseShowListVideo(HttpUtil.get(url)); - for (PPTVShowVideo pv : list) { - if (pv.getOp().equalsIgnoreCase("del")) {// 鍒犻櫎 - pptvService.deletePPTVShow(pv); - } else {// 澧炲姞鎴栬�呮洿鏂� - String videoid = pptvService.saveOrUpdatePPTVShow(pv) + ""; - boolean isUpdate = pptvService.hasShowUpdate(pv.getDetailList()); - for (PPTVShowDetail pd : pv.getDetailList()) { - pd.setVideoId(pv.getAid()); - if (pd.getOp().equalsIgnoreCase("del")) { - pptvService.deletePPTVShowDetail(pd); - } else { - pptvService.saveOrUpdatePPTVShowDetail(pd); - } - } - if (!StringUtil.isNullOrEmpty(videoid)) - pptvService.addPPTVShowToVideoInfo(pv, isUpdate); - } - } - } - } + /** + * 瑙嗛杞崲 + * + * @param series + * @return + */ + public static VideoInfo convertToVideoInfo(PPTVSeries series) { + int year = Integer.parseInt(series.getReleaseYear()); + int month = 1; + int day = 1; + String director = series.getDirector(); + String mainActor = series.getActor(); - // 瑙f瀽鍗¢�� - public void startParseCartoon() { - List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_CARTON); - for (String url : urlList) { - List<PPTVCartoonVideo> list = PPTVDataParseUtil.parseCartoonListVideo(HttpUtil.get(url)); - for (PPTVCartoonVideo pv : list) { - if (pv.getOp().equalsIgnoreCase("del")) {// 鍒犻櫎 - pptvService.deletePPTVCartoon(pv); - } else {// 澧炲姞鎴栬�呮洿鏂� - String videoid = pptvService.saveOrUpdatePPTVCartoon(pv) + ""; - boolean isUpdate = pptvService.hasCartoonUpdate(pv.getDetailList()); - for (PPTVCartoonDetail pd : pv.getDetailList()) { - pd.setVideoId(pv.getAid()); - if (pd.getOp().equalsIgnoreCase("del")) { - pptvService.deletePPTVCartoonDetail(pd); - } else { - pptvService.saveOrUpdatePPTVCartoonDetail(pd); - } - } - if (!StringUtil.isNullOrEmpty(videoid)) - pptvService.addPPTVCartoonToVideoInfo(pv, isUpdate); - } - } - } - } + String score = series.getScore(); - // 瑙f瀽灏忚棰� - public void startParseShortVideo() { - List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_SHORTVIDEO); - for (String url : urlList) { - List<PPTVShortVideo> list = PPTVDataParseUtil.parseShortListVideo(HttpUtil.get(url)); - for (PPTVShortVideo pv : list) { - if (pv.getOp().equalsIgnoreCase("del")) {// 鍒犻櫎 - pptvService.deletePPTVShort(pv); - } else {// 澧炲姞鎴栬�呮洿鏂� - Serializable id = pptvService.saveOrUpdatePPTVShort(pv); - if (id != null) - pptvService.addPPTVShortToVideoInfo(pv, false); - } - } - } - } + String tag = ""; + VideoType videoType = new VideoType(getVideoType(series)); - // 鑾峰彇鍒嗙被 - public static List<Integer> getTypeList(String rc, String sc) { - List<Integer> list = new ArrayList<Integer>(); - if (rc.equalsIgnoreCase("鐢靛奖")) { - if ("棰勫憡".equalsIgnoreCase(sc)) { - list.add(281); - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - list.add(281); - } else { - list.add(151); - } + //鐢靛奖 + if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_DIANYING) { + tag = "璇勫垎锛�" + score; + } else if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_DIANSHIJU || videoType.getId() == VideoConstant.VIDEO_CATEGORY_DONGMAN) { + //鐢佃鍓э紝鍔ㄦ极 + if (series.getSeriesCount().trim().equalsIgnoreCase(series.getCurrentNum().trim())) { + tag = series.getSeriesCount() + "闆嗗叏"; + } else { + tag = "鏇存柊鑷�" + series.getCurrentNum() + "闆�"; + } + } else if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_ZONGYI) { + //缁艰壓 + if (!StringUtil.isNullOrEmpty(series.getCurrentNum())) { + tag = series.getCurrentNum().replace("鏈�", ""); + } else { + tag = series.getPublishTime().split(" ")[0]; + } + } - } else if (rc.equalsIgnoreCase("鐢佃鍓�")) { - if ("棰勫憡".equalsIgnoreCase(sc)) { - list.add(282); - } else if ("鍓у叓鍗�".equalsIgnoreCase(sc)) { - list.add(282); - } else - list.add(150); - } else if (rc.equalsIgnoreCase("鍗¢��")) {// 鐜板満 棰勫憡 MV 鍘熷垱 闊充箰 鑷埗 鐢ㄦ埛涓婁紶 - if ("鐜板満".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("棰勫憡".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("MV".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("鍘熷垱".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("闊充箰".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("鑷埗".equalsIgnoreCase(sc)) { - list.add(283); - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - list.add(283); - } else - list.add(153); + String latestHpicture = series.getSeries().get(series.getSeries().size() - 1).getSubHorCover(); - } else if (rc.equalsIgnoreCase("缁艰壓")) { - list.add(152); - } else if (rc.equalsIgnoreCase("鐢熸椿")) {// 缇庡懗椋熷埢 钀屽疇钀屽疂 鏂拌荆鐢熸椿 鍋ュ悍浼戦棽 鐢熸椿绐嶉棬 鐢ㄦ埛涓婁紶 - // 鐚庡瓒i椈 - if ("缇庡懗椋熷埢".equalsIgnoreCase(sc)) { - list.add(228); - } else if ("钀屽疇钀屽疂".equalsIgnoreCase(sc)) { - } else if ("鏂拌荆鐢熸椿".equalsIgnoreCase(sc)) { - list.add(230); - } else if ("鍋ュ悍浼戦棽".equalsIgnoreCase(sc)) { - list.add(230); - } else if ("鐢熸椿绐嶉棬".equalsIgnoreCase(sc)) { - list.add(230); - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - } else if ("鐚庡瓒i椈".equalsIgnoreCase(sc)) { - } + long updateTime = System.currentTimeMillis(); - } else if (rc.equalsIgnoreCase("鏃跺皻")) {// 绉�鍦轰紶鐪� 濯掍綋涓撳尯 缇庝附璇惧爞 瑙嗚澶ц祻 鐢ㄦ埛涓婁紶 椋庡皻蹇姤 - // 娼祦鍏抽敭璇� 鏃跺皻浜虹墿 鍝佺墝椋庡悜鏍� - if ("绉�鍦轰紶鐪�".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("濯掍綋涓撳尯".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("缇庝附璇惧爞".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("瑙嗚澶ц祻".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - } else if ("椋庡皻蹇姤".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("娼祦鍏抽敭璇�".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("鏃跺皻浜虹墿".equalsIgnoreCase(sc)) { - list.add(232); - } else if ("鍝佺墝椋庡悜鏍�".equalsIgnoreCase(sc)) { - list.add(232); - } + VideoInfo vi = new VideoInfo(); + vi.setVideoType(videoType); + vi.setArea(series.getCountry()); + vi.setBaseurl(""); + vi.setCanSave(false); + vi.setCommentCount(0); + vi.setContentType(1); + vi.setCreatetime(System.currentTimeMillis()); + vi.setDay(day + ""); + vi.setDirector(director); + vi.setFocus(""); + vi.setHpicture(series.getHorCover()); + vi.setIntroduction(series.getDescription()); + vi.setLatestHpicture(latestHpicture); + vi.setLatestVpicture(""); + vi.setMainActor(mainActor); + vi.setMonth(month + ""); + vi.setName(series.getName()); + vi.setNowNumber(0 + ""); + vi.setOrderby("0"); + vi.setPicture(series.getCover()); + vi.setScore(score); + vi.setShare("0"); + vi.setShow(1 + ""); + vi.setTag(tag); + vi.setVpicture(series.getCover()); + vi.setWatchCount(0 + ""); + vi.setYear(year + ""); + vi.setUpdatetime(updateTime + ""); + vi.setVideocount(series.getSeries().size()); + return vi; + } - } else if (rc.equalsIgnoreCase("闊充箰")) {// 鑸炶箞 涓嶈 闊充箰鑺� 鐢ㄦ埛涓婁紶 棰佸绀� 缈诲敱鐚庡 鑷埗闊充箰 - // 涔愪汉鏃犳暟 鎴忔洸 鏂版瓕棣栧彂 闊充箰璧勮 鍐呭湴 娓彴 鍙版咕闊充箰 - // 鏃ユ湰 闊╁浗 娆х編 鐜板満 鍚堜綔姣旇禌 褰辫鍘熷0 鍏朵粬 - if ("鑸炶箞".equalsIgnoreCase(sc)) { - list.add(303); - } else if ("涓嶈".equalsIgnoreCase(sc)) { - } else if ("闊充箰鑺�".equalsIgnoreCase(sc)) { - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - } else if ("棰佸绀�".equalsIgnoreCase(sc)) { - } else if ("缈诲敱鐚庡".equalsIgnoreCase(sc)) { - list.add(304); - } else if ("鑷埗闊充箰".equalsIgnoreCase(sc)) { - } else if ("涔愪汉鏃犳暟".equalsIgnoreCase(sc)) { - } else if ("鎴忔洸".equalsIgnoreCase(sc)) { - } else if ("鏂版瓕棣栧彂".equalsIgnoreCase(sc)) { - } else if ("闊充箰璧勮".equalsIgnoreCase(sc)) { - list.add(280); - } else if ("鍐呭湴".equalsIgnoreCase(sc)) { - } else if ("娓彴".equalsIgnoreCase(sc)) { - } else if ("鍙版咕闊充箰".equalsIgnoreCase(sc)) { - } else if ("鏃ユ湰".equalsIgnoreCase(sc)) { - } else if ("闊╁浗".equalsIgnoreCase(sc)) { - } else if ("娆х編".equalsIgnoreCase(sc)) { - } else if ("鐜板満".equalsIgnoreCase(sc)) { - list.add(303); - } else if ("鍚堜綔姣旇禌".equalsIgnoreCase(sc)) { - } else if ("褰辫鍘熷0".equalsIgnoreCase(sc)) { - list.add(279); - } else if ("鍏朵粬".equalsIgnoreCase(sc)) { - list.add(280); - } - } else if (rc.equalsIgnoreCase("鏃呮父")) {// 閰掑簵涔嬮�� 鏋佽嚧鏃呮父 鏃蜂笘缇庢櫙 鑸屽皷缇庨 鐢ㄦ埛涓婁紶 璧伴亶涓浗 - // 棣欒壋涔嬫梾 鐜悆鐣呮父 鍑哄娓革紙娓境鍙帮級 鐑偣鎺ㄨ崘 鎴峰鐚庡 - // 娌块�旀槬鑹� 浜烘枃椋庣墿 鏃呮父鐒︾偣 缃戝弸鏀荤暐 - list.add(229); - if ("閰掑簵涔嬮��".equalsIgnoreCase(sc)) { - } else if ("鏋佽嚧鏃呮父".equalsIgnoreCase(sc)) { - } else if ("鏃蜂笘缇庢櫙".equalsIgnoreCase(sc)) { - } else if ("鑸屽皷缇庨".equalsIgnoreCase(sc)) { - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - } else if ("璧伴亶涓浗".equalsIgnoreCase(sc)) { - } else if ("棣欒壋涔嬫梾".equalsIgnoreCase(sc)) { - } else if ("鐜悆鐣呮父".equalsIgnoreCase(sc)) { - } else if ("鍑哄娓革紙娓境鍙帮級".equalsIgnoreCase(sc)) { - } else if ("鐑偣鎺ㄨ崘".equalsIgnoreCase(sc)) { - } else if ("鎴峰鐚庡".equalsIgnoreCase(sc)) { - } else if ("娌块�旀槬鑹�".equalsIgnoreCase(sc)) { - } else if ("浜烘枃椋庣墿".equalsIgnoreCase(sc)) { - } else if ("鏃呮父鐒︾偣".equalsIgnoreCase(sc)) { - } else if ("缃戝弸鏀荤暐".equalsIgnoreCase(sc)) { - } - - } else if (rc.equalsIgnoreCase("鎼炵瑧")) {// 閮痉绾蹭笓鍦� 鐖嗙瑧绉�鍦� 鍛ㄧ珛娉笓鍦� 鍥т汉鍥х墖 鐢ㄦ埛涓婁紶 - // 鎭舵悶鏁磋泭 鎼炵瑧鑷媿 鐩稿0灏忓搧 瓒呰悓绯诲垪 鍔ㄧ墿濂囪叮 寮�蹇冨箍鍛� - if ("閮痉绾蹭笓鍦�".equalsIgnoreCase(sc)) { - list.add(217); - } else if ("鐖嗙瑧绉�鍦�".equalsIgnoreCase(sc)) { - list.add(216); - } else if ("鍛ㄧ珛娉笓鍦�".equalsIgnoreCase(sc)) { - list.add(217); - } else if ("鍥т汉鍥х墖".equalsIgnoreCase(sc)) { - list.add(216); - } else if ("鐢ㄦ埛涓婁紶".equalsIgnoreCase(sc)) { - } else if ("鎭舵悶鏁磋泭".equalsIgnoreCase(sc)) { - list.add(216); - } else if ("鎼炵瑧鑷媿".equalsIgnoreCase(sc)) { - list.add(216); - } else if ("鐩稿0灏忓搧".equalsIgnoreCase(sc)) { - list.add(217); - } else if ("瓒呰悓绯诲垪".equalsIgnoreCase(sc)) { - list.add(220); - } else if ("鍔ㄧ墿濂囪叮".equalsIgnoreCase(sc)) { - list.add(220); - } else if ("寮�蹇冨箍鍛�".equalsIgnoreCase(sc)) { - list.add(216); - } - } - return list; - } - - private static String getScore(String vid) { - String result = HttpUtil - .get("http://epg.api.pptv.com/detail.api?auth=d410fafad87e7bbf6c6dd62434345818&canal=17&userLevel=0&ppi=AgACAAAABwAABOUAAAAHAAAAAFf5GACAuIIVSMh5Qi0t_zR3NmUpIHR91aabBP6RHKxiYkX3RBkET2s_BTUB5ewNFjXCLeUkiUqMCreGl70MnKLhRpth&appid=com.pplive.androidphone&appver=6.1.5&appplt=aph&vid=" - + vid - + "&series=1&virtual=1&ver=4&platform=android3&contentType=Preview&vr=3d%2Cvr360%2Cvr180"); - String score = PPTVDataParseUtil.parseScore(result); - return score; - } - - public static VideoInfo convertMovieToVideoInfo(PPTVMovieVideo pptv) { - String score = getScore(pptv.getVid()); - String showTime = pptv.getShowTime(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeUtil.convertGernalTime(showTime, "yyyy-MM-dd")); - String year = calendar.get(Calendar.YEAR) + ""; - String month = calendar.get(Calendar.MONTH) + ""; - String day = calendar.get(Calendar.DAY_OF_MONTH) + ""; - - VideoInfo video = new VideoInfo(); - String area = ""; - for (String st : pptv.getRegion().split("\\$\\$")) - area += st + " "; - video.setArea(area); - video.setBaseurl(""); - video.setCanSave(false); - video.setCommentCount(0); - video.setContentType(1); - video.setCreatetime(System.currentTimeMillis()); - video.setDay(day); - String director = ""; - for (String st : pptv.getDirector().split("\\$\\$")) - director += st + " "; - - video.setDirector(director); - video.setHpicture(pptv.getHorizontalPoster()); - video.setIntroduction(pptv.getIntroduction()); - video.setLatestHpicture(pptv.getHorizontalPoster()); - video.setLatestVpicture(pptv.getNewPoster()); - video.setLatestWatchCount(0); - String mainActor = ""; - for (String st : pptv.getStarring().split("\\$\\$")) - mainActor += st + " "; - video.setMainActor(mainActor); - video.setMonth(month); - video.setName(pptv.getWorkName()); - video.setNowNumber(0 + ""); - video.setOrderby(0 + ""); - video.setPicture(pptv.getNewPoster()); - video.setPlayPicture(pptv.getHorizontalPoster()); - video.setScore(score); - video.setShare("0"); - video.setShow("1"); - video.setTag("璇勫垎锛�" + score); - video.setThirdType("0"); - video.setTotalNumber("0"); - video.setUpdatetime(calendar.getTimeInMillis() + ""); - video.setVideocount(1); - video.setVpicture(pptv.getNewPoster()); - video.setWatchCount(0 + ""); - video.setYear(year); - return video; - } - - public static VideoInfo convertTVToVideoInfo(PPTVTVVideo pptv) { - Comparator<PPTVTVDetail> cm = new Comparator<PPTVTVDetail>() { - public int compare(PPTVTVDetail o1, PPTVTVDetail o2) { - return (int) (Long.parseLong(o1.getSeq()) - Long.parseLong(o2.getSeq())); - } - }; - - Collections.sort(pptv.getDetailList(), cm); - - String score = getScore(pptv.getDetailList().get(0).getVid()); - String showTime = pptv.getDetailList().get(pptv.getDetailList().size() - 1).getResourceTime(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeUtil.convertGernalTime(showTime, "yyyy-MM-dd HH:mm:ss")); - String year = calendar.get(Calendar.YEAR) + ""; - String month = calendar.get(Calendar.MONTH) + ""; - String day = calendar.get(Calendar.DAY_OF_MONTH) + ""; - - VideoInfo video = new VideoInfo(); - String area = ""; - for (String st : pptv.getRegion().split("\\$\\$")) - area += st + " "; - video.setArea(area); - video.setBaseurl(""); - video.setCanSave(false); - video.setCommentCount(0); - video.setContentType(1); - video.setCreatetime(System.currentTimeMillis()); - video.setDay(day); - String director = ""; - for (String st : pptv.getDirector().split("\\$\\$")) - director += st + " "; - - video.setDirector(director); - video.setHpicture(pptv.getHorizontalPoster()); - video.setIntroduction(pptv.getIntroduction()); - video.setLatestHpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getSingleThumbnails()); - video.setLatestVpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getPoster()); - video.setLatestWatchCount(0); - String mainActor = ""; - for (String st : pptv.getStarring().split("\\$\\$")) - mainActor += st + " "; - video.setMainActor(mainActor); - video.setMonth(month); - video.setName(pptv.getWorkName()); - video.setNowNumber(0 + ""); - video.setOrderby(0 + ""); - video.setPicture(pptv.getNewPoster()); - video.setPlayPicture(pptv.getHorizontalPoster()); - video.setScore(score); - video.setShare("0"); - video.setShow("1"); - if (Integer.parseInt(pptv.getNewUpdate()) == pptv.getTotalnumber()) - video.setTag(pptv.getNewUpdate() + "闆嗗叏"); - else - video.setTag("鏇存柊鑷�" + pptv.getNewUpdate() + "闆�"); - video.setThirdType("0"); - video.setTotalNumber(pptv.getTotalnumber() + ""); - video.setUpdatetime(calendar.getTimeInMillis() + ""); - video.setVideocount(pptv.getDetailList().size()); - video.setVpicture(pptv.getNewPoster()); - video.setWatchCount(0 + ""); - video.setYear(year); - return video; - } - - public static VideoInfo convertShowToVideoInfo(PPTVShowVideo pptv) { - Comparator<PPTVShowDetail> cm = new Comparator<PPTVShowDetail>() { - public int compare(PPTVShowDetail o1, PPTVShowDetail o2) { - return (int) (Long.parseLong(o1.getSeq()) - Long.parseLong(o2.getSeq())); - } - }; - - Collections.sort(pptv.getDetailList(), cm); - - String score = getScore(pptv.getDetailList().get(0).getVid()); - String showTime = pptv.getShowTime(); - Calendar calendar = Calendar.getInstance(); - long time = TimeUtil.convertGernalTime(showTime, "yyyy-MM-dd"); - if (time < 0) - time = TimeUtil.convertGernalTime(pptv.getDetailList().get(0).getDate(), "yyyyMMdd"); - - calendar.setTimeInMillis(TimeUtil.convertGernalTime(showTime, "yyyy-MM-dd")); - String year = calendar.get(Calendar.YEAR) + ""; - String month = calendar.get(Calendar.MONTH) + ""; - String day = calendar.get(Calendar.DAY_OF_MONTH) + ""; - - VideoInfo video = new VideoInfo(); - String area = ""; - for (String st : pptv.getRegion().split("\\$\\$")) - area += st + " "; - video.setArea(area); - video.setBaseurl(""); - video.setCanSave(false); - video.setCommentCount(0); - video.setContentType(1); - video.setCreatetime(System.currentTimeMillis()); - video.setDay(day); - String director = ""; - for (String st : pptv.getHost().split("\\$\\$")) - director += st + " "; - - video.setDirector(director); - video.setHpicture(pptv.getHorizontalPoster()); - video.setIntroduction(pptv.getIntroduction()); - video.setLatestHpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getSingleThumbnails()); - video.setLatestVpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getPoster()); - video.setLatestWatchCount(0); - String mainActor = ""; - - video.setMainActor(mainActor); - video.setMonth(month); - video.setName(pptv.getWorkName()); - video.setNowNumber(0 + ""); - video.setOrderby(0 + ""); - video.setPicture(pptv.getNewPoster()); - video.setPlayPicture(pptv.getHorizontalPoster()); - video.setScore(score); - video.setShare("0"); - video.setShow("1"); - video.setTag("鏇存柊鑷�" - + TimeUtil.getGernalTime(TimeUtil.convertGernalTime(pptv.getNewUpdate(), "yyyyMMdd"), "yyyy-MM-dd")); - video.setThirdType("0"); - video.setTotalNumber(pptv.getTotalNumber() + ""); - video.setUpdatetime(TimeUtil.convertGernalTime(pptv.getNewUpdate(), "yyyyMMdd") + ""); - video.setVideocount(pptv.getDetailList().size()); - video.setVpicture(pptv.getNewPoster()); - video.setWatchCount(0 + ""); - video.setYear(year); - return video; - } - - public static VideoInfo convertCartoonToVideoInfo(PPTVCartoonVideo pptv) { - Comparator<PPTVCartoonDetail> cm = new Comparator<PPTVCartoonDetail>() { - public int compare(PPTVCartoonDetail o1, PPTVCartoonDetail o2) { - return (int) (Long.parseLong(o1.getSeq()) - Long.parseLong(o2.getSeq())); - } - }; - - Collections.sort(pptv.getDetailList(), cm); - - String score = getScore(pptv.getDetailList().get(0).getVid()); - String showTime = pptv.getShowTime(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeUtil.convertGernalTime(showTime, "yyyy")); - String year = calendar.get(Calendar.YEAR) + ""; - String month = calendar.get(Calendar.MONTH) + ""; - String day = calendar.get(Calendar.DAY_OF_MONTH) + ""; - - VideoInfo video = new VideoInfo(); - String area = ""; - for (String st : pptv.getRegion().split("\\$\\$")) - area += st + " "; - video.setArea(area); - video.setBaseurl(""); - video.setCanSave(false); - video.setCommentCount(0); - video.setContentType(1); - video.setCreatetime(System.currentTimeMillis()); - video.setDay(day); - String director = ""; - - video.setDirector(director); - video.setHpicture(pptv.getHorizontalPoster()); - video.setIntroduction(pptv.getIntroduction()); - video.setLatestHpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getSingleThumbnails()); - video.setLatestVpicture(pptv.getDetailList().get(pptv.getDetailList().size() - 1).getPoster()); - video.setLatestWatchCount(0); - String mainActor = ""; - - video.setMainActor(mainActor); - video.setMonth(month); - video.setName(pptv.getWorkName()); - video.setNowNumber(0 + ""); - video.setOrderby(0 + ""); - video.setPicture(pptv.getNewPoster()); - video.setPlayPicture(pptv.getHorizontalPoster()); - video.setScore(score); - video.setShare("0"); - video.setShow("1"); - if (Integer.parseInt(pptv.getNewUpdate()) == pptv.getTotalNumber()) - video.setTag(pptv.getNewUpdate() + "闆嗗叏"); - else - video.setTag("鏇存柊鑷�" + pptv.getNewUpdate() + "闆�"); - video.setThirdType("0"); - video.setTotalNumber(pptv.getTotalNumber() + ""); - video.setUpdatetime(calendar.getTimeInMillis() + ""); - video.setVideocount(pptv.getDetailList().size()); - video.setVpicture(pptv.getNewPoster()); - video.setWatchCount(0 + ""); - video.setYear(year); - return video; - } - - public static VideoInfo convertShortToVideoInfo(PPTVShortVideo pptv) { - String showTime = pptv.getPublish(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeUtil.convertGernalTime(showTime, "yyyy-MM-dd HH:mm:ss")); - String year = calendar.get(Calendar.YEAR) + ""; - String month = calendar.get(Calendar.MONTH) + ""; - String day = calendar.get(Calendar.DAY_OF_MONTH) + ""; - - String[] sts = pptv.getDuration().split(":"); - int t = 0; - if (sts.length == 3) - t = Integer.parseInt(sts[0]) * 3600 + Integer.parseInt(sts[1]) * 60 + Integer.parseInt(sts[2]); - else if (sts.length == 2) - t = Integer.parseInt(sts[0]) * 60 + Integer.parseInt(sts[1]); - else if (sts.length == 1) - t = Integer.parseInt(sts[0]); - - String tag = NumberUtil.convertSecondToString(t); - VideoInfo video = new VideoInfo(); - String area = ""; - - video.setArea(area); - video.setBaseurl(""); - video.setCanSave(false); - video.setCommentCount(0); - video.setContentType(1); - video.setCreatetime(System.currentTimeMillis()); - video.setDay(day); - String director = ""; - video.setDirector(t + ""); - video.setHpicture(pptv.getHorizontalPoster()); - video.setIntroduction(pptv.getIntroduction()); - video.setLatestHpicture(""); - video.setLatestVpicture(""); - video.setLatestWatchCount(0); - String mainActor = ""; - - video.setMainActor(mainActor); - video.setMonth(month); - video.setName(pptv.getSingleTitle()); - video.setNowNumber(0 + ""); - video.setOrderby(0 + ""); - video.setPicture(pptv.getHorizontalPoster()); - video.setPlayPicture(pptv.getHorizontalPoster()); - video.setScore("9.0"); - video.setShare("0"); - video.setShow("1"); - video.setTag(tag); - video.setThirdType("0"); - video.setTotalNumber("1"); - video.setUpdatetime(calendar.getTimeInMillis() + ""); - video.setVideocount(1); - video.setVpicture(""); - video.setWatchCount(0 + ""); - video.setYear(year); - return video; - } - - public static List<Integer> getVideoTypeList(String ft, String typeStr) { - List<Integer> typeList = new ArrayList<Integer>(); - String[] types = (typeStr + "").split("\\$\\$"); - Set<Integer> set = new TreeSet<Integer>(); - for (String tp : types) { - List<Integer> typeL = PPTVUtil.getTypeList(ft, tp); - for (Integer i : typeL) - set.add(i); - } - Iterator<Integer> its = set.iterator(); - while (its.hasNext()) { - typeList.add(its.next()); - } - if (typeList.size() == 0) - typeList.add(299); - - return typeList; - } + public static int getPlayType(AcceptData acceptData, PPTVProgram pptvProgram) { + if (!pptvProgram.getStatus().equalsIgnoreCase("del")) { + return PLAY_SDK; + } else { + return PLAY_NONE; + } + } } -- Gitblit v1.8.0