|
@@ -75,6 +75,7 @@ import File from '@system.file';
|
|
|
import {deviceInfo } from '@kit.BasicServicesKit';
|
|
import {deviceInfo } from '@kit.BasicServicesKit';
|
|
|
|
|
|
|
|
import { HSBColorPicker, HSBColorPickerLayout } from '@keke/color-picker'
|
|
import { HSBColorPicker, HSBColorPickerLayout } from '@keke/color-picker'
|
|
|
|
|
+import { LrcParser } from '@sgaolei/lrc_parser';
|
|
|
|
|
|
|
|
const TAG = 'LocalMusic';
|
|
const TAG = 'LocalMusic';
|
|
|
|
|
|
|
@@ -4268,6 +4269,23 @@ export struct LocalMusic{
|
|
|
this.lyricController.setLyric(null)
|
|
this.lyricController.setLyric(null)
|
|
|
let jiaMilyricPath = lyricPath.substring(0,lyricPath.lastIndexOf('.'))+'.lrcc'
|
|
let jiaMilyricPath = lyricPath.substring(0,lyricPath.lastIndexOf('.'))+'.lrcc'
|
|
|
LogUtil.debug("onecold lyricPath =" + lyricPath)
|
|
LogUtil.debug("onecold lyricPath =" + lyricPath)
|
|
|
|
|
+
|
|
|
|
|
+ const neiqianLrc = LrcParser.getLyrics(this.videoUrl);
|
|
|
|
|
+ LogUtil.debug("onecold 找到内嵌歌词 neiqianLrc =" + neiqianLrc )
|
|
|
|
|
+ if(StrUtil.isNotEmpty(neiqianLrc)){
|
|
|
|
|
+ // 将文件内容按行分割成字符串数组
|
|
|
|
|
+ let lines = neiqianLrc.split('\n').map(line => line.trim());
|
|
|
|
|
+ // 3.解析歌词
|
|
|
|
|
+ let lyric = this.parser.parse(lines);
|
|
|
|
|
+ // 4.设置歌词
|
|
|
|
|
+ this.lyricController.setLyric(lyric);
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if(isToast||((!FileUtil.accessSync(lyricPath)&&!FileUtil.accessSync(jiaMilyricPath))
|
|
if(isToast||((!FileUtil.accessSync(lyricPath)&&!FileUtil.accessSync(jiaMilyricPath))
|
|
|
&&!Utility.isVideoByExtension(this.videoUrl))){
|
|
&&!Utility.isVideoByExtension(this.videoUrl))){
|
|
|
if(this.currentSong!==undefined){
|
|
if(this.currentSong!==undefined){
|
|
@@ -4697,10 +4715,7 @@ export struct LocalMusic{
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.margin({right:30})
|
|
.margin({right:30})
|
|
|
.onClick(()=>{
|
|
.onClick(()=>{
|
|
|
- // if(StrUtil.isNotEmpty(this.videoUrl)){
|
|
|
|
|
- // let lyricPath = this.videoUrl.substring(0,this.videoUrl.lastIndexOf('.'))+'.lrc'
|
|
|
|
|
- // this.initLyric(lyricPath);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+
|
|
|
this.isLyricSetting = !this.isLyricSetting;
|
|
this.isLyricSetting = !this.isLyricSetting;
|
|
|
})
|
|
})
|
|
|
.bindSheet($$this.isLyricSetting, this.lyricSettingSheet(), {
|
|
.bindSheet($$this.isLyricSetting, this.lyricSettingSheet(), {
|
|
@@ -5307,7 +5322,7 @@ export struct LocalMusic{
|
|
|
|
|
|
|
|
Row() {
|
|
Row() {
|
|
|
this.pushLyricButton($r('app.media.cut_current'), 0, '本地歌词')
|
|
this.pushLyricButton($r('app.media.cut_current'), 0, '本地歌词')
|
|
|
- // this.pushLyricButton($r('app.media.white_search'), 1, '内嵌歌词')
|
|
|
|
|
|
|
+ // this.pushLyricButton($r('app.media.white_search'), 1, '获取歌词')
|
|
|
// this.pushLyricButton($r('app.media.white_search'), 2, '获取歌词')
|
|
// this.pushLyricButton($r('app.media.white_search'), 2, '获取歌词')
|
|
|
|
|
|
|
|
|
|
|
|
@@ -6458,6 +6473,8 @@ export struct LocalMusic{
|
|
|
}else{
|
|
}else{
|
|
|
this.getImageColor();
|
|
this.getImageColor();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
let lyricPath = this.videoUrl.substring(0,this.videoUrl.lastIndexOf('.'))+'.lrc'
|
|
let lyricPath = this.videoUrl.substring(0,this.videoUrl.lastIndexOf('.'))+'.lrc'
|
|
|
await this.initLyric(lyricPath);
|
|
await this.initLyric(lyricPath);
|
|
|
|
|
|