trc and lrc It's all text format , The difference is that trc Among them <150><***> Separated the lyrics .
package com.util; import java.io.BufferedReader; import java.io.File; import
java.io.FileReader; import java.io.FileWriter; import java.io.IOException;
import java.io.Writer; import java.util.ArrayList; import java.util.HashSet;
import java.util.List; import java.util.Set; public class Turn { /** *
Get all the files in the folder recursively * @param path * @return */ public static List<File> files=new
ArrayList<File>(); public static List<File> getFiles(String path) { // Get file location
File file= new File(path); // Get file array File[] array = file.listFiles(); for (int i
= 0; i < array.length; i++) { if (array[i].isFile()) { // Save to collection files.add(array[
i]); } else if (array[i].isDirectory()) { getFiles(array[i].getPath()); } }
return files; } /** * read file * @param fileName * @return */ public static String
readFileContent(String fileName) { File file = new File(fileName);
BufferedReader reader= null; StringBuffer sbf = new StringBuffer(); try { reader
= new BufferedReader(new FileReader(file)); String tempStr; while ((tempStr =
reader.readLine()) != null) { sbf.append(tempStr+"\r\n"); } reader.close();
return sbf.toString(); } catch (IOException e) { e.printStackTrace(); } finally
{ if (reader != null) { try { reader.close(); } catch (IOException e1) { e1.
printStackTrace(); } } } return sbf.toString(); } /** * @ write file * @param fileName
file name * @param newPath Output path *@param file1 Output content */ public static boolean
writeFileContent(String fileName,String newPath,String file1){ boolean pd=true;
try{ File file =new File(newPath+"/"+fileName+".lrc"); Writer out =new
FileWriter(file); out.write(file1); out.close(); } catch (Exception e) { pd=
false; e.printStackTrace(); } return pd; } } package com.util; import java.io.
File; import java.util.List; import java.util.regex.Matcher; import java.util.
regex.Pattern; public class Servce { public static boolean ioUtil(String path,
String newPath){ // Get each file List<File> files = Turn.getFiles(path); // Document content String
file1=null; boolean pd=false; int i=0; for (; i < files.size(); i++) {
//files.get(i).toString()// Get full path //files.get(i).getName();// Get file name System.out.
println((i+1)+":"+files.get(i).getName()); // read file file1 = Turn.readFileContent(
files.get(i).toString()); System.out.println(" Reading :/n"+file1); // matching <***>
for example :<151> The rules of Pattern pattern = Pattern.compile("<(.*?)>"); Matcher matcher =
pattern.matcher(file1); while(matcher.find()){ //
System.out.println(matcher.group(1)); //
System.out.println(file1.replace("<"+matcher.group(1)+">", "")); // extract <***>
//System.out.println(matcher.group()); // hold <***> Replace with an empty string file1=file1.replace(
matcher.group(), ""); } //System.out.println(file1); // Get file name ,ti /** *
Get file title == file name */ Pattern pattern2 = Pattern.compile("(\\[[^\\]]*\\])"); Matcher
matcher2= pattern2.matcher(file1); String name=null; int t=0; while(matcher2.
find()){ t++; if(t<2){ name=matcher2.group(1); } } name=name.replace("[ti:", "")
; // name=name.replace("[ar:", ""); // name=name.replace("[al:", ""); name=name.
replace("]", ""); // write file . Turn.writeFileContent(name, newPath, file1); pd=true;
} System.out.println(" All in all "+i+" Files "); return pd; } } package com.util; import
java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.
Pattern; public class Test { public static void main(String[] args) { // Get basic information
Scanner s=new Scanner(System.in); System.out.println(" Please enter the path to read the folder "); String path
= s.next(); System.out.println(" Please enter the destination path of the output "); String newPath = s.next(); System.
out.println(Servce.ioUtil(path,newPath)==true?" Conversion successful ":" switch views "); } }
<>trc Lyrics format :
[ti: Back To The Future: The Game ] [ar:T-T / distinguished ] [al: night safari ] [ly:T-T / distinguished ] [mu:T-T / distinguished ] [ma: Shunde ] [pu:]
[by:ttpod] [total:134976] [offset:0] [00:00.264]<203> return <151> reach <150> not <152> come <151>-
<151>T-T / distinguished [00:01.222]<163> do <143> Words <151>:<201>T-T <152>/ <151> Zhuo <150> Zhuo
[00:02.333]<151> do <151> song <151>:<151>T-T <152>/ <150> Zhuo <154> Zhuo
[00:03.393]<150> Edit <151> song <203>:<151> along <201> virtue
[00:10.112]<151> I <151> upper <151> course <150> Lie down <150> stay <151> table <302> upper
[00:11.318]<152> use <151> ear <202> machine <150> steal <152> steal <150> Broadcast <251> discharge
[00:12.526]<150> that <151> Time <150> I <151> sleep <150> have to <153> exceed <252> Cool
[00:13.683]<150> no <151> understand <151> say <152> sing <201> Of <201> many <406> kind
[00:15.095]<152> all <201> matter <151> total <152> Think about it <202> try <151> try <303> see <151> then <151> open <151> beginning <150> since <201> Oneself <504> write
[00:17.715]<153> after <201> know <151> after <100> sleep <201> Yue <152> Sink in <151> Yue <152> deep <153> open <151> beginning <200> Boil <254> rise <503> night
[00:20.237]<153> to <152> yes <151> also <101> many <150> It's over <201> one <151> individual <151> Secret <152> dense
[00:21.471]<149> course <150> hall <150> upper <151> less <100> It's over <151> one <101> silk <150> power <151> gas
[00:22.724]<151> hold <100> since <152> Oneself <150> lock <101> room <152> between <150> dense <100> close <151> Pledge <151> rhyme <150> stay <152> heart <151> in
[00:24.535]<100> moment <151> lower <152> It's over <100> print <151> remember
<>lrc Lyrics format
- [ti: Back To The Future: The Game ] [ar:T-T / distinguished ] [al: night safari ] [ly:T-T / distinguished ] [mu:T-T / distinguished ] [ma: Shunde ] [pu:]
[by:ttpod] [total:134976] [offset:0] [00:00.264] Back To The Future: The Game - T-T / distinguished
[00:01.222] Composing words :T-T / distinguished [00:02.333] Composition :T-T / distinguished [00:03.393] Arrangement : Shunde
[00:10.112] I lie on the table in class [00:11.318] Play secretly with headphones [00:12.526] I thought it was cool [00:13.683] Don't understand the variety of rap
[00:15.095] I always want to have a try and start to write by myself [00:17.715] Later, later, the deeper and deeper, began to stay up at night [00:20.237] So there's another secret
[00:21.471] A little bit less energy in class [00:22.724] Lock your room and rhyme in your heart [00:24.535] It's made a mark

Technology