Skip to content

Commit

Permalink
fix #81 修复弹幕内容为空的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed Nov 21, 2021
1 parent ad572e2 commit cdcc941
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nicelee/bilibili/util/danmuku/Xml2Ass.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import nicelee.bilibili.util.Logger;

public class Xml2Ass {

int width = 1920;
Expand Down Expand Up @@ -49,11 +51,12 @@ public List<Danmuku> readXml(File xmlFile) throws IOException{

BufferedReader reader = new BufferedReader(new FileReader(xmlFile));
List<Danmuku> danmuList = new ArrayList<Danmuku>();
Pattern danmukuPattern = Pattern.compile("<d p=\"([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([0-9]*)\">(.*?)</d>");
Pattern danmukuPattern = Pattern.compile("<d p=\"([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)(?:,[0-9]*)?\">(.*?)</d>");
String line = reader.readLine();
while(line != null) {
Matcher m = danmukuPattern.matcher(line);
while(m.find()) {
// Logger.println(m.group());
double time = Double.parseDouble(m.group(1));
int type = Integer.parseInt(m.group(2));
if(type >= 1 & type <=3)
Expand Down

0 comments on commit cdcc941

Please sign in to comment.