• 大小: 10KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-05-14
  • 语言: Java
  • 标签: java  解析  lrc  

资源简介

用java解析歌词文件,可用线程模拟播放。

资源截图

代码片段和文件信息

package com.yangxiutian.io;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.yangxiutian.lrc.LRC;
import com.yangxiutian.lrc.Lyrics;
import com.yangxiutian.tar.impl.time.Lyric;
import com.yangxiutian.tar.impl.time.Timetar;
import com.yangxiutian.util.Util;

public class ParseLRC {
public static Lyrics parseLRC(LRC lrc){
Lyrics lyrics = new Lyrics();
lyrics.setAl(lrc.getAl().getValue());
lyrics.setAr(lrc.getAr().getValue());
lyrics.setBy(lrc.getBy().getValue());
lyrics.setOffset(Integer.parseInt(lrc.getOffset().getValue())); 
lyrics.setTi(lrc.getTi().getValue()); 
lyrics.setLyrics(timetarToLyric(lrc.getTimetars()));
return lyrics;
}
static List timetarToLyric(Listtar> timetars){
List ls=new ArrayList();
for(Timetar t:timetars){
long time=Util.timeToMillis(t.getValue().substring(1 t.getValue().length()-1));
Lyric l=new Lyric();
l.setCurrent(time);
l.setTxt(t.getText());
ls.add(l);
}
Collections.sort(ls);
Util.addTimeSize(ls);
return ls;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-03-16 08:38  yangxiutian\
     目录           0  2012-03-16 08:38  yangxiutian\io\
     文件        1109  2012-03-16 00:13  yangxiutian\io\ParseLRC.java
     文件        3249  2012-03-16 00:55  yangxiutian\io\ReadLRC.java
     目录           0  2012-03-16 08:38  yangxiutian\lrc\
     文件        1147  2012-03-15 22:51  yangxiutian\lrc\LRC.java
     文件        1015  2012-03-15 23:16  yangxiutian\lrc\Lyrics.java
     目录           0  2012-03-16 08:38  yangxiutian\tar\
     目录           0  2012-03-16 08:38  yangxiutian\tar\impl\
     文件         502  2012-03-13 21:21  yangxiutian\tar\impl\AbstractTar.java
     目录           0  2012-03-16 08:38  yangxiutian\tar\impl\id\
     文件         303  2012-03-13 21:14  yangxiutian\tar\impl\id\Al.java
     文件         257  2012-03-13 21:12  yangxiutian\tar\impl\id\Ar.java
     文件         307  2012-03-13 21:11  yangxiutian\tar\impl\id\By.java
     文件         162  2012-03-14 21:14  yangxiutian\tar\impl\id\id_readme.txt
     文件         396  2012-03-13 21:29  yangxiutian\tar\impl\id\Offset.java
     文件         309  2012-03-13 21:12  yangxiutian\tar\impl\id\Ti.java
     文件         502  2012-03-13 21:28  yangxiutian\tar\impl\TarName.java
     目录           0  2012-03-16 08:38  yangxiutian\tar\impl\time\
     文件         929  2012-03-16 00:15  yangxiutian\tar\impl\time\Lyric.java
     文件         825  2012-03-13 21:43  yangxiutian\tar\impl\time\Timetar.java
     文件         742  2012-03-14 21:14  yangxiutian\tar\impl\time\time_readme.txt
     文件         323  2012-03-13 21:04  yangxiutian\tar\Tar.java
     目录           0  2012-03-16 08:38  yangxiutian\test\
     文件         869  2012-03-16 00:56  yangxiutian\test\Test.java
     目录           0  2012-03-16 08:38  yangxiutian\util\
     文件         944  2012-03-16 00:17  yangxiutian\util\Util.java

评论

共有 条评论