|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.frank.ffmpeg.tool |
|
|
|
package com.frank.ffmpeg.tool |
|
|
|
|
|
|
|
|
|
|
|
import com.frank.ffmpeg.model.LrcLine |
|
|
|
import com.frank.ffmpeg.model.LrcLine |
|
|
|
|
|
|
|
import com.frank.ffmpeg.util.TimeUtil |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList |
|
|
|
import java.util.ArrayList |
|
|
|
import java.util.Collections |
|
|
|
import java.util.Collections |
|
|
@ -28,7 +29,7 @@ object LrcLineTool { |
|
|
|
val mLrcLine = LrcLine() |
|
|
|
val mLrcLine = LrcLine() |
|
|
|
mLrcLine.content = content |
|
|
|
mLrcLine.content = content |
|
|
|
mLrcLine.timeString = temp |
|
|
|
mLrcLine.timeString = temp |
|
|
|
val startTime = timeConvert(temp) |
|
|
|
val startTime = TimeUtil.timeConvert(temp) |
|
|
|
mLrcLine.startTime = startTime |
|
|
|
mLrcLine.startTime = startTime |
|
|
|
listTimes.add(mLrcLine) |
|
|
|
listTimes.add(mLrcLine) |
|
|
|
} |
|
|
|
} |
|
|
@ -40,18 +41,6 @@ object LrcLineTool { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* string time to milliseconds |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private fun timeConvert(timeStr: String): Long { |
|
|
|
|
|
|
|
var timeString = timeStr |
|
|
|
|
|
|
|
timeString = timeString.replace('.', ':') |
|
|
|
|
|
|
|
val times = timeString.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() |
|
|
|
|
|
|
|
return (Integer.valueOf(times[0]) * 60 * 1000 + |
|
|
|
|
|
|
|
Integer.valueOf(times[1]) * 1000 + |
|
|
|
|
|
|
|
Integer.valueOf(times[2])).toLong() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getLrcLine(line: String?): List<LrcLine>? { |
|
|
|
fun getLrcLine(line: String?): List<LrcLine>? { |
|
|
|
if (line == null || line.isEmpty()) { |
|
|
|
if (line == null || line.isEmpty()) { |
|
|
|
return null |
|
|
|
return null |
|
|
|