| | |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | import java.util.regex.Matcher; |
| | |
| | | // System.out.println("++++++++++++>>"+data); |
| | | /*text = text.replace("[","");//将前面的替换成后面的 |
| | | text = text.replace("]","@"); |
| | | String splitdata[] = text.split("@");//分隔*/ |
| | | String splitdata[] = text.split("@");//分隔 |
| | | String regex = "(?<=\\])"; |
| | | Pattern compile = Pattern.compile(regex); |
| | | String[] splitdata = compile.split(text,2);//分隔 |
| | | if(text.endsWith("]") || splitdata.length == 1){ |
| | | |
| | | String str = text; |
| | | str = str.replace("[",""); |
| | | str = str.replace("]",""); |
| | | str = str.replace(":","."); |
| | | str = str.replace(".","@"); |
| | | String timedata[] =str.split("@"); |
| | | String[] splitdata = compile.split(text,2);//分隔*/ |
| | | int index = text.indexOf("]"); |
| | | String[] splitdata; |
| | | if(text.length()-1 == index){ |
| | | splitdata = new String[]{text}; |
| | | }else{ |
| | | splitdata = new String[]{text.substring(0,index),text.substring(index+1)}; |
| | | } |
| | | String tmpstr = splitdata[0].replace("[","").replace("]",""); |
| | | if(splitdata.length == 1){ |
| | | tmpstr = tmpstr.replace(":","."); |
| | | tmpstr = tmpstr.replace(".","@"); |
| | | String timedata[] =tmpstr.split("@"); |
| | | Matcher matcher = pattern.matcher(timedata[0]); |
| | | if(timedata.length==3 && matcher.matches()){ |
| | | int m = Integer.parseInt(timedata[0]); //分 |
| | |
| | | } |
| | | } else{ |
| | | String lrcContenet = splitdata[1]; |
| | | String tmpstr = splitdata[0]; |
| | | tmpstr = tmpstr.replace("[",""); |
| | | tmpstr = tmpstr.replace("]",""); |
| | | tmpstr = tmpstr.replace(":","."); |
| | | tmpstr = tmpstr.replace(".","@"); |
| | | String timedata[] =tmpstr.split("@"); |
| | |
| | | */ |
| | | private static void initLrc(TreeMap<Integer, LyricObject> lrc_read){ |
| | | lrc_map.clear(); |
| | | Iterator<Integer> iterator = lrc_read.keySet().iterator(); |
| | | LyricObject oldval = null; |
| | | int i =0; |
| | | for(Integer key : lrc_read.keySet()){ |
| | |
| | | if (oldval == null) { |
| | | oldval = val; |
| | | } else { |
| | | LyricObject item1= new LyricObject(); |
| | | item1 = oldval; |
| | | LyricObject item1 = oldval; |
| | | item1.timeline = val.begintime-oldval.begintime; |
| | | lrc_map.put(new Integer(i), item1); |
| | | i++; |