| | |
| | | package com.yeshi.buwan.util.factory; |
| | | |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.mogotv.entity.MogoTVClipInfo; |
| | | import com.yeshi.buwan.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo; |
| | | import com.yeshi.buwan.videos.bilibili.BilibiliUtil; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliVideo; |
| | | import com.yeshi.buwan.youku.entity.YouKuShowDetail; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | return video; |
| | | } |
| | | |
| | | public static InternetSearchVideo create(MogoTVClipInfo detail) { |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | | List<String> actors = new ArrayList<>(); |
| | | for (String st : detail.getLeader().split("/")) { |
| | | actors.add(st.trim()); |
| | | } |
| | | video.setActors(StringUtil.concat(actors, ",")); |
| | | video.setArea(detail.getArea()); |
| | | |
| | | |
| | | video.setDirector(detail.getDirector()); |
| | | video.setHpicture(detail.getHpicture()); |
| | | video.setVpicture(detail.getVpicture()); |
| | | video.setName(detail.getTitle()); |
| | | video.setNameStr(detail.getTitle()); |
| | | video.setResourceIds(26 + ""); |
| | | if (detail.getFstlvlType().equalsIgnoreCase("电影")) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DIANYING); |
| | | } else if (detail.getFstlvlType().equalsIgnoreCase("电视剧")) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DIANSHIJU); |
| | | } else if (detail.getFstlvlType().equalsIgnoreCase("动漫")) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DONGMAN); |
| | | } else if (detail.getFstlvlType().equalsIgnoreCase("综艺")) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_ZONGYI); |
| | | } |
| | | if (detail.getFstlvlType().equalsIgnoreCase("电影")) { |
| | | video.setTag("评分:6.8"); |
| | | } else |
| | | video.setTag(detail.getUpdateInfo().split(",")[detail.getUpdateInfo().split(",").length - 1]); |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(detail.getVideoCount()); |
| | | video.setYear(detail.getYear()); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | return video; |
| | | } |
| | | |
| | | |
| | | public static InternetSearchVideo create(TencentCoverInfo info) { |
| | | |
| | | int videoCount = 0; |
| | | for (TencentCoverInfo.VipIdsBean idsBean : info.getVip_ids()) { |
| | | if (idsBean.getF() == 2 || idsBean.getF() == 7) |
| | | videoCount++; |
| | | } |
| | | |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | | video.setActors(StringUtil.concat(info.getLeading_actor(), ",")); |
| | |
| | | } else |
| | | video.setTag(info.getEpisode_updated()); |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(info.getVip_ids().size()); |
| | | video.setVideoCount(videoCount); |
| | | video.setYear(info.getYear()); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | return video; |
| | | } |
| | | |
| | | |
| | | public static InternetSearchVideo create(BilibiliMediaInfo info) { |
| | | |
| | | int videoCount = info.getTotal(); |
| | | |
| | | Date pubTime = new Date(TimeUtil.convertGernalTime(info.getPubInfo().getPub_time(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | | video.setActors(""); |
| | | video.setArea(""); |
| | | video.setDirector(""); |
| | | video.setHpicture(null); |
| | | video.setVpicture(info.getCover()); |
| | | video.setName(info.getTitle()); |
| | | video.setNameStr(info.getTitle()); |
| | | video.setResourceIds(BilibiliUtil.RESOURCE_ID + ""); |
| | | if (info.getType() == BilibiliUtil.TYPE_DIANYING) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DIANYING); |
| | | video.setTag("评分:" + info.getMediaRating().getScore()); |
| | | } else if (info.getType() == BilibiliUtil.TYPE_DIANSHIJU) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DIANSHIJU); |
| | | if (info.getNewestEp().getDesc().contains("已完结")) { |
| | | video.setTag(info.getNewestEp().getTitle() + "集全"); |
| | | } else { |
| | | video.setTag("更新至" + info.getNewestEp().getTitle() + "集"); |
| | | } |
| | | } else if (info.getType() == BilibiliUtil.TYPE_GUOMAN || info.getType() == BilibiliUtil.TYPE_FANJU) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_DONGMAN); |
| | | if (info.getNewestEp().getDesc().contains("已完结")) { |
| | | video.setTag(info.getNewestEp().getTitle() + "集全"); |
| | | } else { |
| | | video.setTag("更新至" + info.getNewestEp().getTitle() + "集"); |
| | | } |
| | | } else if (info.getType() == BilibiliUtil.TYPE_JILUPIAN) { |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_JILUPIAN); |
| | | if (info.getNewestEp().getDesc().contains("已完结")) { |
| | | video.setTag(info.getNewestEp().getTitle() + "集全"); |
| | | } else { |
| | | video.setTag("更新至" + info.getNewestEp().getTitle() + "集"); |
| | | } |
| | | } |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(videoCount); |
| | | video.setYear(TimeUtil.getGernalTime(pubTime.getTime(), "yyyy")); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | if (info.getMediaRating() != null) |
| | | video.setScore(info.getMediaRating().getScore()); |
| | | return video; |
| | | } |
| | | |
| | | |
| | | public static InternetSearchVideo create(BilibiliVideo info, Integer videoType) { |
| | | int videoCount = 1; |
| | | Date pubTime = new Date(info.getPubdate()); |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | | video.setActors(null); |
| | | video.setArea(null); |
| | | video.setDirector(null); |
| | | video.setHpicture(null); |
| | | video.setVpicture(info.getPic()); |
| | | video.setName(info.getTitle()); |
| | | video.setNameStr(info.getTitle()); |
| | | video.setResourceIds(BilibiliUtil.RESOURCE_ID + ""); |
| | | video.setTag(""); |
| | | video.setRootType(videoType); |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(videoCount); |
| | | video.setYear(TimeUtil.getGernalTime(pubTime.getTime(), "yyyy")); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | return video; |
| | | } |
| | | |
| | | |
| | | } |