Skip to content

Commit

Permalink
优化 #26 校正时间戳时可以使用缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed Jan 27, 2020
1 parent 82b42ed commit de56237
Show file tree
Hide file tree
Showing 7 changed files with 686 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Go go go, Bilibili Pikachu!
| retryIfLiveOff || 当目标不在直播时,是否继续重试。默认false |
| maxRetryIfLiveOff || 当目标不在直播时,继续重试的次数。默认0,此时会一直进行尝试,直到主播上线 |
| retryAfterMinutes || 当目标不在直播时,每次获取直播间信息的时间间隔,单位分钟。默认`5.0` |

| checkWithBuffer || 校准时间戳时是否使用缓存,默认true。测试功能,使用后性能有所提升 |

+ 各直播源解析情况

Expand All @@ -65,10 +65,12 @@ Go go go, Bilibili Pikachu!
| huajiao | 2019/06/02 | `flv`只支持默认清晰度(似乎只有一种清晰度) |

+ 校正某FLV文件的时间戳
+ `java -Dfile.encoding=utf-8 -cp BiliLiveRecorder.jar nicelee.bilibili.live.check.FlvCheckerWithBuffer "源文件路径"`
+ `java -Dfile.encoding=utf-8 -cp BiliLiveRecorder.jar nicelee.bilibili.live.FlvChecker "源文件路径"`
+ `java -Dfile.encoding=utf-8 -cp BiliLiveRecorder.jar nicelee.bilibili.live.FlvChecker "源文件路径" true`
+ `java -Dfile.encoding=utf-8 -cp BiliLiveRecorder.jar nicelee.bilibili.live.FlvChecker "源文件路径" true false "保存的文件夹路径"`
+ 第二个参数-布尔参数的意义是**当遇到某种特定情况时,是否分割文件**
+ 两个校验工具使用方法类似,仅入口类不一致。功能稳定后将一直使用缓存减少IO
+ 第二个参数-布尔参数的意义是**当遇到某种特定情况时,是否分割文件**
+ 第三个参数-布尔参数的意义是**是否输出debug信息**
+ 注意:这些操作**没法还原**,所以理论上原始文件最保真。 `不校验时间戳` ≈ `校验文件不分割` > `校验文件分割scripts tag`
+ 如果仍旧没办法满足需求的话,建议拿着各种版本都去ffmpeg处理一下
Expand Down
2 changes: 2 additions & 0 deletions UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 更新
+ V2.6.3
* 优化 #26 ,校正时间戳时可以使用缓存
+ V2.6.2
* 优化 #25 ,以FlvChecker的Main方法运行时,接受debug布尔开关
* 修复一个bug #22 ,以FlvChecker的Main方法运行时,解析传入的文件保存路径;
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/nicelee/bilibili/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@
import nicelee.bilibili.enums.StatusEnum;
import nicelee.bilibili.live.FlvChecker;
import nicelee.bilibili.live.RoomDealer;
import nicelee.bilibili.live.check.FlvCheckerWithBuffer;
import nicelee.bilibili.live.domain.RoomInfo;
import nicelee.bilibili.util.Logger;
import nicelee.bilibili.util.TrustAllCertSSLUtil;
import nicelee.bilibili.util.ZipUtil;

public class Main {

final static String version = "v2.6.2";
final static String version = "v2.6.3";
static boolean autoCheck;
static boolean splitScriptTagsIfCheck;
static boolean deleteOnchecked;
static boolean flvCheckWithBuffer;
static boolean flagZip;
static String liver;
static String shortId;
Expand Down Expand Up @@ -81,12 +83,17 @@ public static void main(String[] args) throws IOException {
retryIfLiveOff = false;
maxRetryIfLiveOff = 0;
retryAfterMinutes = 5;
flvCheckWithBuffer = true;
// 根据参数初始化值
if (args != null && args.length >= 1) {
String value = getValue(args[0], "check");
if ("false".equals(value)) {
autoCheck = false;
}
value = getValue(args[0], "checkWithBuffer");
if ("false".equals(value)) {
flvCheckWithBuffer = false;
}
value = getValue(args[0], "splitScriptTags");
if ("true".equals(value)) {
splitScriptTagsIfCheck = true;
Expand Down Expand Up @@ -331,7 +338,10 @@ public void run() {
try {
for (String path : fileList) {
System.out.println("校对时间戳开始...");
new FlvChecker().check(path, deleteOnchecked, splitScriptTagsIfCheck, saveFolderAfterCheck);
if(flvCheckWithBuffer)
new FlvCheckerWithBuffer().check(path, deleteOnchecked, splitScriptTagsIfCheck, saveFolderAfterCheck);
else
new FlvChecker().check(path, deleteOnchecked, splitScriptTagsIfCheck, saveFolderAfterCheck);
System.out.println("校对时间戳完毕。");
}
} catch (IOException e) {
Expand Down
Loading

0 comments on commit de56237

Please sign in to comment.