| | |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.domain.system.SystemConfig; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.iqiyi.entity.IqiyiAlbum2; |
| | |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.query.Iqiyi2AlbumQuery; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Service |
| | | public class Iqiyi2ServiceImpl implements Iqiyi2Service { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger("videoUpdate"); |
| | | |
| | | @Resource |
| | | private VideoIqiyi2Dao videoIqiyi2Dao; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | public List<VideoDetailInfo> getVideoDetailList(String videoId, int page, int pageSize) { |
| | | //查询专辑 |
| | |
| | | iqiyiAlbum2Dao.save(album); |
| | | } |
| | | |
| | | public boolean isUnNormalUpdateVideoName(String name) { |
| | | SystemConfig config = systemConfigService.getConfigByKeyCache("iqiyi_update_video_name"); |
| | | if (config != null) { |
| | | String[] sts = config.getValue().split(","); |
| | | List<String> list = new ArrayList<>(); |
| | | for (String st : sts) { |
| | | list.add(st.trim()); |
| | | } |
| | | return list.contains(name.trim()); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void addToVideoInfo(IqiyiAlbum2 album) { |
| | | if (album.getFeatureAlbumId() > 0L && album.getChannelId() != IqiYiNewAPI.TYPE_DIANYING) { |
| | |
| | | } |
| | | |
| | | |
| | | if (album.getChannelId() != 1 && !VideoConstant.iqiyiSpecialNames.contains(album.getName())) { |
| | | if (album.getChannelId() != 1 && !isUnNormalUpdateVideoName(album.getName())) { |
| | | //标题中只能包含中英文与数字 |
| | | String regx = "^[(\\u4e00-\\u9fa5)(:)( )a-zA-Z0-9]+$"; |
| | | if (!Pattern.matches(regx, album.getName())) { |
| | |
| | | } |
| | | |
| | | //过滤某些短片与影评 |
| | | if (album.getName().contains("《") && !VideoConstant.iqiyiSpecialNames.contains(album.getName())) |
| | | if (album.getName().contains("《") && !isUnNormalUpdateVideoName(album.getName())) |
| | | return; |
| | | |
| | | //空电视剧或者是空动漫则返回 |
| | |
| | | return; |
| | | } |
| | | |
| | | logger.info(VideoLogFactory.createAddToVideoLog(album)); |
| | | |
| | | VideoInfo newVideoInfo = convertAlbumToVideoInfo(album); |
| | | VideoIqiyi2 videoIqiyi2 = videoIqiyi2Dao.selectByIqiyiId(album.getId()); |
| | |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideo(newVideoInfo); |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | |
| | | |
| | | //加入专辑视频映射 |
| | | AlbumVideoMap map = new AlbumVideoMap(); |
| | | map.setId(newVideoInfo.getId()); |
| | | map.setCreateTime(new Date()); |
| | | map.setVideoId(newVideoInfo.getId()); |
| | | map.setRootVideoType(newVideoInfo.getVideoType().getId()); |