From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 24 九月 2021 15:22:03 +0800
Subject: [PATCH] 接入视频直播

---
 src/main/java/com/yeshi/buwan/job/JuHeVideoUpdateJob.java |  207 +++++++++++++--------------------------------------
 1 files changed, 55 insertions(+), 152 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/job/JuHeVideoUpdateJob.java b/src/main/java/com/yeshi/buwan/job/JuHeVideoUpdateJob.java
index efa0309..3676468 100644
--- a/src/main/java/com/yeshi/buwan/job/JuHeVideoUpdateJob.java
+++ b/src/main/java/com/yeshi/buwan/job/JuHeVideoUpdateJob.java
@@ -4,175 +4,78 @@
 
 import javax.annotation.Resource;
 
-import com.yeshi.buwan.iqiyi.IqiYiNewAPI;
+import com.yeshi.buwan.videos.iqiyi.IqiYiNewAPI;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
-import com.yeshi.buwan.acFun.AcFunUtil;
-import com.yeshi.buwan.acFun.AcfunVideoNew;
-import com.yeshi.buwan.acFun.AcfunVideoResult;
-import com.yeshi.buwan.funtv.FunTVUtil;
-import com.yeshi.buwan.iqiyi.entity.IqiyiUpdateQueue;
-import com.yeshi.buwan.iqiyi.util.IqiyiUtil;
+import com.yeshi.buwan.videos.iqiyi.entity.IqiyiUpdateQueue;
+import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil;
 import com.yeshi.buwan.log.LogHelper;
-import com.yeshi.buwan.service.imp.juhe.AcfunVideoNewService;
 import com.yeshi.buwan.service.imp.juhe.IqiyiQueueService;
-import com.yeshi.buwan.sohu.SoHuUtil;
 import com.yeshi.buwan.util.Constant;
 import com.yeshi.buwan.util.StringUtil;
-import com.yeshi.buwan.util.video.AcfunApiUtil;
 
 /**
- * 
- * 
  * @author Administrator
- *
  */
 @Component
 public class JuHeVideoUpdateJob {
-	@Resource
-	private IqiyiUtil iqiyiUtil;
-	@Resource
-	private SoHuUtil soHuUtil;
+    @Resource
+    private IqiyiUtil iqiyiUtil;
 
-	@Resource
-	private FunTVUtil funTVUtil;
+    @Resource
+    private IqiyiQueueService iqiyiQueueService;
 
-	@Resource
-	private AcFunUtil acFunUtil;
+    private static int c = 1;
 
-	@Resource
-	private IqiyiQueueService iqiyiQueueService;
+    public JuHeVideoUpdateJob() {
+        System.out.println("============================================瀹炰緥鍖栨鏁�:" + c);
+        ++c;
+    }
 
-	@Resource
-	private AcfunVideoNewService acfunVideoNewService;
+    // @Scheduled(cron = "0 25 17 * * ?")
+    // 鏆傛椂娉ㄩ噴鎺�
+    @Scheduled(cron = "0 0 0,9,14,20 * * ?")
+    public void doJob() {
+        if (!Constant.JobTasker)
+            return;
+        System.out.println("VideoUpdateJob-doJob");
+        new Thread(new Runnable() {
+            public void run() {
+                LogHelper.iqiyi("鏇存柊iaiyi銆傘�傘�傘�傘�傘��");
+                iqiyiUtil.updateAll("");
+            }
+        }).start();
+    }
 
-	private static int c = 1;
-
-	public JuHeVideoUpdateJob() {
-		System.out.println("============================================瀹炰緥鍖栨鏁�:" + c);
-		++c;
-	}
-
-	// @Scheduled(cron = "0 25 17 * * ?")
-	// 鏆傛椂娉ㄩ噴鎺�
-	@Scheduled(cron = "0 0 0,9,14,20 * * ?")
-	public void doJob() {
-		if (!Constant.JobTasker)
-			return;
-		System.out.println("VideoUpdateJob-doJob");
-		new Thread(new Runnable() {
-			public void run() {
-				LogHelper.iqiyi("鏇存柊iaiyi銆傘�傘�傘�傘�傘��");
-				iqiyiUtil.updateAll("");
-			}
-		}).start();
-
-		// new Thread(new Runnable() {
-		//
-		// public void run() {
-		// soHuUtil.parseAll();
-		// }
-		// }).start();
-
-		// new Thread(new Runnable() {
-		//
-		// public void run() {
-		// YouKuDJUtil.startParseUpdate();
-		// }
-		// }).start();
-		//
-		// new Thread(new Runnable() {
-		//
-		// public void run() {
-		// YouKuDJUtil.startParseDelete();
-		// }
-		// }).start();
-
-		// new Thread(new Runnable() {
-		//
-		// public void run() {
-		// pptvUtil.startParseTV();
-		// }
-		// }).start();
-		//
-		// new Thread(new Runnable() {
-		//
-		// public void run() {
-		// pptvUtil.startParseMovie();
-		// pptvUtil.startParseShow();
-		// pptvUtil.startParseCartoon();
-		// pptvUtil.startParseShortVideo();
-		// }
-		// }).start();
-	}
-
-	@Scheduled(cron = "0 0 2 * * ?")
-	public void updateAcFun() {
-		if (!Constant.JobTasker)
-			return;
-
-		AcfunVideoResult result = AcfunApiUtil.videoList("");
-		while (result != null && result.pcursor != null && !result.pcursor.equalsIgnoreCase("no_more")) {
-			if (result.videoList != null) {
-				acfunVideoNewService.save(result.videoList);
-				for (AcfunVideoNew video : result.videoList)
-					try {
-						acFunUtil.addVideo(video);
-					} catch (Exception e) {
-					}
-			}
-			result = AcfunApiUtil.videoList(result.pcursor);
-		}
-	}
-
-	@Scheduled(cron = "0 0 3,4 * * ? ")
-	// @Scheduled(cron = "0 52 * * * ? ")
-	public void updateFuntvAll() {
-		if (!Constant.JobTasker)
-			return;
-		synchronized (funTVUtil) {
-			funTVUtil.startUpdate();
-		}
-	}
-
-	@Scheduled(cron = "0 0 0/1 * * ? ")
-	public void updateFuntv() {
-		if (!Constant.JobTasker)
-			return;
-		synchronized (funTVUtil) {
-			funTVUtil.startUpdate();
-		}
-	}
-
-	@Scheduled(cron = "0 5 0,12,20 * * ? ")
-	public void updateIqiyiQueue() {
-		if (!Constant.JobTasker)
-			return;
-		synchronized (iqiyiQueueService) {
-			List<IqiyiUpdateQueue> queueList = iqiyiQueueService.listUpdateQueue();
-			for (IqiyiUpdateQueue queue : queueList) {
-				String aid = null;
-				int count = 0;
-				while (StringUtil.isNullOrEmpty(aid) && count < 3) {
-					if (StringUtil.isNullOrEmpty(queue.getAid())) {
-						aid = IqiYiNewAPI.getAidByUrl(queue.getUrl());
-						count++;
-						try {
-							Thread.sleep(1000 * 2);
-						} catch (InterruptedException e) {
-							e.printStackTrace();
-						}
-					} else
-						aid = queue.getAid();
-				}
-				if (!StringUtil.isNullOrEmpty(aid)) {
-					queue.setAid(aid);
-					iqiyiQueueService.updateUpdateQueue(queue);
-					iqiyiUtil.updateAlbum(aid);
-				}
-			}
-		}
-	}
+    @Scheduled(cron = "0 5 0,12,20 * * ? ")
+    public void updateIqiyiQueue() {
+        if (!Constant.JobTasker)
+            return;
+        synchronized (iqiyiQueueService) {
+            List<IqiyiUpdateQueue> queueList = iqiyiQueueService.listUpdateQueue();
+            for (IqiyiUpdateQueue queue : queueList) {
+                String aid = null;
+                int count = 0;
+                while (StringUtil.isNullOrEmpty(aid) && count < 3) {
+                    if (StringUtil.isNullOrEmpty(queue.getAid())) {
+                        aid = IqiYiNewAPI.getAidByUrl(queue.getUrl());
+                        count++;
+                        try {
+                            Thread.sleep(1000 * 2);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                    } else
+                        aid = queue.getAid();
+                }
+                if (!StringUtil.isNullOrEmpty(aid)) {
+                    queue.setAid(aid);
+                    iqiyiQueueService.updateUpdateQueue(queue);
+                    iqiyiUtil.updateAlbum(aid);
+                }
+            }
+        }
+    }
 
 }

--
Gitblit v1.8.0