From bef4f6d51bff03c0512a75f43e79699b7296f1fa Mon Sep 17 00:00:00 2001
From: EricsHu <hrr145632>
Date: 星期四, 23 十一月 2023 18:00:53 +0800
Subject: [PATCH] 修改系统角色逻辑、和老师身份逻辑

---
 src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaVideoLivePlayBackService.java |   60 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaVideoLivePlayBackService.java b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaVideoLivePlayBackService.java
index 628cdd4..695706e 100644
--- a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaVideoLivePlayBackService.java
+++ b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaVideoLivePlayBackService.java
@@ -1,8 +1,8 @@
 /******************************************************************************
  * Copyright (C) 2015 Shenzhen Penguin Network Technology Co., Ltd
  * All Rights Reserved.
- * 本软件为深圳市企鹅网络科技有限公司开发研制。未经本公司正式书面同意,其他任何个人、团体
- * 不得使用、复制、修改或发布本软件.
+ * 鏈蒋浠朵负娣卞湷甯備紒楣呯綉缁滅鎶�鏈夐檺鍏徃寮�鍙戠爺鍒躲�傛湭缁忔湰鍏徃姝e紡涔﹂潰鍚屾剰锛屽叾浠栦换浣曚釜浜恒�佸洟浣�
+ * 涓嶅緱浣跨敤銆佸鍒躲�佷慨鏀规垨鍙戝竷鏈蒋浠�.
  *****************************************************************************/
 
 package com.qxueyou.scc.teach.live.service.impl;
@@ -43,10 +43,10 @@
 	
 	private static final Logger log = LogManager.getLogger(MediaVideoLivePlayBackService.class);
 	
-	//直播回放队列
+	//鐩存挱鍥炴斁闃熷垪
 	public static final String LIVE_PLAYBACK_LST = "LIVE_PLAYBACK_LST";
 	
-	//直播回放全局锁
+	//鐩存挱鍥炴斁鍏ㄥ眬閿�
 	public static final String  LIVE_PLAYBACK_LOCK = "LIVE_PLAYBACK_LOCK";
 	
 	@Autowired
@@ -68,7 +68,7 @@
 		return this.find(hql.toString(),params, MediaVideoLiveReplay.class);
 	}
 	
-	//生成回放(需修改为晚上2:00 开始执行)
+	//鐢熸垚鍥炴斁(闇�淇敼涓烘櫄涓�2:00 寮�濮嬫墽琛�)
 	@Scheduled(cron = " 0 0/2 * * * ?")
 	protected void doTimer(){
 		if(this.lock()){
@@ -80,7 +80,7 @@
 					return ;
 				}
 				
-				//判断是否是回放状态
+				//鍒ゆ柇鏄惁鏄洖鏀剧姸鎬�
 				MediaVideoLive live = this.read(MediaVideoLive.class, liveId);
 				
 				if(live.getStatus()==MediaVideoLive.STATUS_LIVE_DOWNLOAD){
@@ -89,12 +89,12 @@
 					
 					this.doVideoLivePlayBack(live);
 					
-					//更新状态
+					//鏇存柊鐘舵��
 					live.setStatus(MediaVideoLive.STATUS_LIVE_REVIEW);
 					this.save(live);
 				}	
 			} catch (Exception e) {
-				//重新处理
+				//閲嶆柊澶勭悊
 				if(StringUtils.isNotEmpty(liveId)){
 					cacheService.lstRightPush(LIVE_PLAYBACK_LST,liveId);
 				}
@@ -106,19 +106,19 @@
 	
 	@Override
 	public  void testPlayBack(String liveId){
-		//判断是否是回放状态
+		//鍒ゆ柇鏄惁鏄洖鏀剧姸鎬�
 		MediaVideoLive live = this.read(MediaVideoLive.class, liveId);
 		
 		if(live.getStatus()==MediaVideoLive.STATUS_LIVE_DOWNLOAD){
 			try {
 				this.doVideoLivePlayBack(live);
 				
-				//更新状态
+				//鏇存柊鐘舵��
 				live.setStatus(MediaVideoLive.STATUS_LIVE_REVIEW);
 				this.save(live);
 				
 			} catch (Exception e) {
-				//重新处理
+				//閲嶆柊澶勭悊
 				cacheService.lstRightPush(LIVE_PLAYBACK_LST,liveId);
 			}
 		}
@@ -126,7 +126,7 @@
 	
 	
 	public void doVideoLivePlayBack(MediaVideoLive videoLive) throws Exception{
-		//读取原文件
+		//璇诲彇鍘熸枃浠�
 		File srcRootFile = new File(cfg.getSrcLivePath());
 	    
 		String[] fileNames=  srcRootFile.list(new FilenameFilter(){
@@ -138,7 +138,7 @@
 		
 		 log.info("doVideoLivePlayBack fileNames: "+fileNames==null?"xxx":Arrays.toString(fileNames));
 		
-		//排序
+		//鎺掑簭
 		Arrays.sort(fileNames, new Comparator<String>(){
 			@Override
 			public int compare(String o1, String o2) {
@@ -149,47 +149,47 @@
 			}
 		});
 	   
-	   //读取
+	   //璇诲彇
 		if(fileNames!=null && fileNames.length>0){
 		   short order = 1 ;
 		   for(String srcFileName:fileNames){
 			   log.info("doCreateVideoLiveReplay srcFileName: "+srcFileName);
-			   doCreateVideoLiveReplay(videoLive,srcFileName,order++); //生成回放
+			   doCreateVideoLiveReplay(videoLive,srcFileName,order++); //鐢熸垚鍥炴斁
 		   }
 		}
 		
-		//清理源文件
+		//娓呯悊婧愭枃浠�
 		if(fileNames!=null && fileNames.length>0){
 			for(String srcFileName:fileNames){
-				log.info("删除原文件:filePath"+srcRootFile.getAbsolutePath().concat(File.separator).concat(srcFileName));
+				log.info("鍒犻櫎鍘熸枃浠讹細filePath"+srcRootFile.getAbsolutePath().concat(File.separator).concat(srcFileName));
 				FileUtils.deleteQuietly(new File(srcRootFile.getAbsolutePath().concat(File.separator).concat(srcFileName)));
 			}
 		}
 	}
 	
 	
-	//生成VideoLiveReplay信息
+	//鐢熸垚VideoLiveReplay淇℃伅
 	private String doCreateVideoLiveReplay(MediaVideoLive videoLive,String srcFileName,short order) throws Exception{
-		//视频文件后缀
+		//瑙嗛鏂囦欢鍚庣紑
 		String mediaSuffix = srcFileName.substring(srcFileName.lastIndexOf("."));
 		
-		//回放地址
+		//鍥炴斁鍦板潃
 		String dstPath =this.generateDstPath(videoLive.getVideoLiveId(), mediaSuffix);
 		
 		File srcFile = new File(cfg.getSrcLivePath() + srcFileName);
 		
 		File dstFileDir = new File(cfg.getResRootPath().concat(dstPath)).getParentFile();
 		
-		//创建目录
+		//鍒涘缓鐩綍
 		dstFileDir.mkdirs();
 		
-		log.info("开始生成  doCreateVideoLiveReplay:  srcFile"+srcFile.getAbsolutePath());
+		log.info("寮�濮嬬敓鎴�  doCreateVideoLiveReplay:  srcFile"+srcFile.getAbsolutePath());
 		
 		String dstFile =  this.convertFlvToMp4(srcFile, dstFileDir);	
 		
-		log.info("结束生成  doCreateVideoLiveReplay:  dstFile"+ dstFile);
+		log.info("缁撴潫鐢熸垚  doCreateVideoLiveReplay:  dstFile"+ dstFile);
 		
-		//获取视频时长
+		//鑾峰彇瑙嗛鏃堕暱
 		long playTime = this.getMediaPlayTime(srcFile.getAbsolutePath());
 		
 		MediaVideoLiveReplay liveReplay = new MediaVideoLiveReplay();
@@ -210,7 +210,7 @@
 	
 
 	/**
-	 * 获取文件目标路径
+	 * 鑾峰彇鏂囦欢鐩爣璺緞
 	 * 
 	 * @param name
 	 * @return
@@ -244,28 +244,28 @@
 	}
 	
 	private String convertFlvToMp4(File srcFile,File dstFile) throws Exception{
-		// 获取直播视频片段信息
+		// 鑾峰彇鐩存挱瑙嗛鐗囨淇℃伅
 		FfmpegFileVO videoFileVO = new FfmpegFileVO();
 		videoFileVO.setInputPath(srcFile.getPath());
 
-		// 转码视频
+		// 杞爜瑙嗛
 		videoFileVO.setOutputPath(dstFile.getPath() + File.separator);
 		
 		return FfmpegMediaHelper.converUploadVideoToLiveMp4(videoFileVO, new FfmpegVideoInfo());
 		
-		//copy备份原片段(暂不备份)
+		//copy澶囦唤鍘熺墖娈�(鏆備笉澶囦唤)
 //		FileUtils.copyFile(srcFile, dstFile); 
 	}	
 	
 	
-	//格式: d72de336c7ed45beb14641a79074f9bb-1541497652-rec ,  时间戳单位: 秒
+	//鏍煎紡锛� d72de336c7ed45beb14641a79074f9bb-1541497652-rec 锛�  鏃堕棿鎴冲崟浣�: 绉�
 	private Long getStartTime(String filePath){
 		return Long.valueOf(filePath.split("-")[1]);  
 	}	
 	
 	private boolean lock(){
 		 boolean lockResult = redisTemplate.opsForValue().setIfAbsent(LIVE_PLAYBACK_LOCK, "lock");
-		 //可能发生死锁,需要手动清除锁
+		 //鍙兘鍙戠敓姝婚攣锛岄渶瑕佹墜鍔ㄦ竻闄ら攣
 		 if(lockResult==true){
 			 redisTemplate.expire(LIVE_PLAYBACK_LOCK, 6, TimeUnit.HOURS);
 		 }		 

--
Gitblit v1.8.0