| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVAlbum2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.dao.juhe.funtv.*; |
| | | import com.yeshi.buwan.domain.ResourceVideo; |
| | | import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg; |
| | | import com.yeshi.buwan.funtv.FunTVNewApi; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.funtv.entity.*; |
| | | import com.yeshi.buwan.iqiyi.entity.VideoIqiyi; |
| | | import com.yeshi.buwan.job.video.FunTV2VideoUpdate; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.util.HtmlToolUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO; |
| | | import net.sf.json.JSONArray; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | |
| | | @Resource |
| | | private FunTV2VideoUpdate funTV2VideoUpdate; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private VideoFunTV2Dao videoFunTV2Dao; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | long now = System.currentTimeMillis(); |
| | |
| | | |
| | | @Test |
| | | public void syncAlbum() { |
| | | Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, 5, 1); |
| | | //1-电影 2-电视剧 3-动漫 4-综艺 5-少儿 |
| | | int channelId = 5; |
| | | Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, channelId, 1); |
| | | int totalCount = vo.getCount(); |
| | | int pageSize = 20; |
| | | int totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1; |
| | | for (int p = 0; p < totalPage; p++) { |
| | | Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, 5, 1); |
| | | Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, channelId, 1); |
| | | if (result != null) |
| | | for (Serializable a : result.getList()) { |
| | | FunTVAlbum2 album2 = (FunTVAlbum2) a; |
| | |
| | | |
| | | @Test |
| | | public void addToVideoInfo() { |
| | | List<FunTVAlbum2> album2List = funTVAlbum2Dao.listByChannelId(1, 300, 500); |
| | | List<FunTVAlbum2> album2List = funTVAlbum2Dao.listByChannelId(2, 0, 1000); |
| | | for (FunTVAlbum2 album2 : album2List) { |
| | | System.out.println(album2.getName()); |
| | | List<FunTVVideo2> list = funTVVideo2Dao.listByMediaId(album2.getId(), 0, 2000); |
| | | album2.setEpisodes(list); |
| | | funTV2Service.addToVideoInfo(album2); |
| | | try { |
| | | funTV2Service.processAlbum(album2); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void addToVideoInfo1() { |
| | | videoInfoService.statisticVideoExtraInfo(179210 + ""); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @Test |
| | | public void test() { |
| | | FunTVVideo2 video = funTVVideo2Dao.get(34027 + ""); |
| | | System.out.println(video); |
| | | public void addResource() { |
| | | // List<String> videoIds = new ArrayList<>(); |
| | | // List<VideoFunTV2> list = videoFunTV2Dao.listAll(0, 5000); |
| | | // for (VideoFunTV2 funTV2 : list) { |
| | | // long count = resourceVideoService.countByVideoIdAndResourceId(funTV2.getVideoId() + "", FunTVUtil2.RESOURCE_ID); |
| | | // if (count == 0L) { |
| | | // videoIds.add(funTV2.getVideoId() + ""); |
| | | // } |
| | | // } |
| | | // System.out.println(new Gson().toJson(videoIds)); |
| | | |
| | | // String json = "[\"7993076\",\"7993077\",\"7993078\"]"; |
| | | // JSONArray array = JSONArray.fromObject(json); |
| | | // for (int i = 0; i < array.size(); i++) { |
| | | // resourceVideoService.addVideoResource(array.optString(i), FunTVUtil2.RESOURCE_ID + ""); |
| | | // } |
| | | // |
| | | // CMQManager.getInstance().addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_RESOURCE, "7993076", VideoExtraInfoChangeMQMsg.ACTION_ADD)); |
| | | |
| | | // resourceVideoService.addVideoResource("7993076", FunTVUtil2.RESOURCE_ID + ""); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void offLine() { |
| | | funTV2Service.offLineAlbum("565"); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private VideoFunTVNewDao videoFunTVNewDao; |
| | | |
| | | @Test |
| | | public void deleteOldFunTVVideo() { |
| | | List<String[]> list = HtmlToolUtil.parseSQLYogExportHtmData("C:\\Users\\Administrator\\Desktop\\风行老版正片.htm", 3); |
| | | for (String[] sts : list) { |
| | | String videoId = sts[0]; |
| | | resourceVideoService.delete(videoId, FunTVUtil.RESOURCE_ID+""); |
| | | // List<VideoFunTV> list1 = videoFunTVNewDao.listByVideoId(Long.parseLong(videoId)); |
| | | // |
| | | // if (list1 != null) |
| | | // for (VideoFunTV videoIqiyi : list1) |
| | | // videoFunTVNewDao.delete(videoIqiyi.getId()); |
| | | } |
| | | } |
| | | |
| | | } |