|
@@ -91,8 +91,18 @@ import { showAddToPlaylistDialog } from '../dialog/AddToPlaylistDialog';
|
|
|
import { showCreatePlaylistDialog } from '../dialog/PlaylistDialog';
|
|
import { showCreatePlaylistDialog } from '../dialog/PlaylistDialog';
|
|
|
import { convertPlaylistSongsToVideoItems, emptyView,updateAllSongsSortOrder } from '../pages/PlaylistDetailPage';
|
|
import { convertPlaylistSongsToVideoItems, emptyView,updateAllSongsSortOrder } from '../pages/PlaylistDetailPage';
|
|
|
import { Playlist, PlaylistSong } from '../viewmodel/Playlist';
|
|
import { Playlist, PlaylistSong } from '../viewmodel/Playlist';
|
|
|
-import { WebdavManager, WebDavAuthItem} from '../common/util/WebdavManager';
|
|
|
|
|
-import { WebDavUrlUtil } from '../common/util/WebDavUrlUtil';
|
|
|
|
|
|
|
+import { Song } from '../viewmodel/Song';
|
|
|
|
|
+import { SongType } from '../common/enums/SongType';
|
|
|
|
|
+import { WebdavManager, WebDavAuthInfo as WebDavManagerAuthInfo,
|
|
|
|
|
+ buildHttpHeadersWithWebDav,
|
|
|
|
|
+ WebDavAuthItem} from '../common/util/WebdavManager';
|
|
|
|
|
+import PermissionUtil from '../common/util/PermissionUtil'
|
|
|
|
|
+import { EditAudio, setRingTone } from './EditAudio';
|
|
|
|
|
+import { ExtractAccompaniment } from './ExtractAccompaniment';
|
|
|
|
|
+import { ExtractAudioFromVideo } from './ExtractAudioFromVideo';
|
|
|
|
|
+import { AudioFormatConverter } from './AudioFormatConverter';
|
|
|
|
|
+import { MergeAudio } from './MergeAudio';
|
|
|
|
|
+import { AIVoiceSeparation } from './AIVoiceSeparation';
|
|
|
const TAG = 'LocalMusic';
|
|
const TAG = 'LocalMusic';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -204,6 +214,12 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
|
|
|
@Preview
|
|
@Preview
|
|
|
@Component
|
|
@Component
|
|
|
export struct LocalMusic {
|
|
export struct LocalMusic {
|
|
|
|
|
+ @State isEditAudio:boolean = false
|
|
|
|
|
+ @State isExtractAcc:boolean = false
|
|
|
|
|
+ @State isConverter:boolean = false
|
|
|
|
|
+ @State isAIVoiceSeparation:boolean = false
|
|
|
|
|
+ @State isExtractAudio:boolean = false
|
|
|
|
|
+ @State isMergeAudio:boolean = false
|
|
|
@State isCopyFileToDownLoad: boolean = false
|
|
@State isCopyFileToDownLoad: boolean = false
|
|
|
@State offHeight: number = 75
|
|
@State offHeight: number = 75
|
|
|
@State currentSongList: Array<VideoItem> = []//当前歌单
|
|
@State currentSongList: Array<VideoItem> = []//当前歌单
|
|
@@ -1120,6 +1136,7 @@ export struct LocalMusic {
|
|
|
const documentViewPicker = new picker.DocumentViewPicker()
|
|
const documentViewPicker = new picker.DocumentViewPicker()
|
|
|
let documentSaveResult = await documentViewPicker.save({ pickerMode: picker.DocumentPickerMode.DOWNLOAD })
|
|
let documentSaveResult = await documentViewPicker.save({ pickerMode: picker.DocumentPickerMode.DOWNLOAD })
|
|
|
this.rootPath = new fileUri.FileUri(documentSaveResult[0]).path
|
|
this.rootPath = new fileUri.FileUri(documentSaveResult[0]).path
|
|
|
|
|
+ PreferencesUtil.putSync('download_path', this.rootPath+'/')
|
|
|
this.currentPath = this.rootPath
|
|
this.currentPath = this.rootPath
|
|
|
this.lockPath = this.rootPath + '/' + LocalMusic.STR_LOCK_VIDEO
|
|
this.lockPath = this.rootPath + '/' + LocalMusic.STR_LOCK_VIDEO
|
|
|
this.favPath = this.rootPath + '/' + LocalMusic.STR_FAC_VIDEO
|
|
this.favPath = this.rootPath + '/' + LocalMusic.STR_FAC_VIDEO
|
|
@@ -1255,12 +1272,13 @@ export struct LocalMusic {
|
|
|
Logger.info('onecold cachedValue = ' + cachedValue)
|
|
Logger.info('onecold cachedValue = ' + cachedValue)
|
|
|
const cachedHash = this.findStringCache(curPath + '_hash');
|
|
const cachedHash = this.findStringCache(curPath + '_hash');
|
|
|
const cachedDirList = this.findCache(curPath + "_dirList");
|
|
const cachedDirList = this.findCache(curPath + "_dirList");
|
|
|
- if (cachedValue !== undefined) {
|
|
|
|
|
|
|
+ if (cachedValue !== undefined&&!this.isRefreshing) {
|
|
|
// this.videoLocalList = cachedValue;
|
|
// this.videoLocalList = cachedValue;
|
|
|
Logger.info('onecold 有缓存 cachedValue = ' + cachedValue)
|
|
Logger.info('onecold 有缓存 cachedValue = ' + cachedValue)
|
|
|
if (this.currentPath != this.rootPath) { //第一个封面赋值给currentTitleCover
|
|
if (this.currentPath != this.rootPath) { //第一个封面赋值给currentTitleCover
|
|
|
this.currentTitleCover = Utility.getFirstCoverFromList(cachedValue)
|
|
this.currentTitleCover = Utility.getFirstCoverFromList(cachedValue)
|
|
|
}
|
|
}
|
|
|
|
|
+ this.isRefreshing = false
|
|
|
this.updateListData(cachedValue)
|
|
this.updateListData(cachedValue)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1353,7 +1371,7 @@ export struct LocalMusic {
|
|
|
// this.setButtonStatus()
|
|
// this.setButtonStatus()
|
|
|
this.openMusic(isOpen, destPath)
|
|
this.openMusic(isOpen, destPath)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.isRefreshing = false
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -1810,22 +1828,47 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async showTips() {
|
|
async showTips() {
|
|
|
- DialogHelper.showTipsDialog({
|
|
|
|
|
- title: '使用提示:自动导入教程',
|
|
|
|
|
-
|
|
|
|
|
- content: '用系统自带的文件管理器将:\n\n1、音频文件放入' + '\n\n我的设备/Download/'
|
|
|
|
|
- + this.appName + '\n\n2、无需繁琐的勾选和分类步骤。\n\n3、每个子文件夹将被组成一个分组。' +
|
|
|
|
|
- '\n\n4、歌词文件的文件名必须和目标歌曲文件名相同(不包含后缀名)。\n\n5、歌词文件和目标歌曲文件必须同个目录。' +
|
|
|
|
|
- '\n\n6、电脑上Download的目录是\nDownload/' + this.packName + '。\n\n7、放好文件后如果没显示点击刷新按钮。\n',
|
|
|
|
|
- onAction: (action) => {
|
|
|
|
|
- if (action == DialogAction.TWO) {
|
|
|
|
|
- PreferencesUtil.putSync('isFirstMusic', false)
|
|
|
|
|
- router.pushUrl({
|
|
|
|
|
- url: 'pages/ScanFilePage'
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.getUIContext().getPromptAction().showDialog({
|
|
|
|
|
+ title: '导入指南',
|
|
|
|
|
+ message:'用系统自带的文件管理器将:\n\n1、音频文件放入' + '\n\n我的设备/Download/'
|
|
|
|
|
+ + this.appName + '\n\n2、无需繁琐的勾选和分类步骤。\n\n3、每个子文件夹将被组成一个分组。' +
|
|
|
|
|
+ '\n\n4、歌词文件的文件名必须和目标歌曲文件名相同(不包含后缀名)。\n\n5、歌词文件和目标歌曲文件必须同个目录。' +
|
|
|
|
|
+ '\n\n6、电脑上Download的目录是\nDownload/' + this.packName + '。\n\n7、放好文件后如果没显示点击刷新按钮。\n',
|
|
|
|
|
+ buttons: [
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '知道了',
|
|
|
|
|
+ color: '#000000'
|
|
|
|
|
+ },
|
|
|
|
|
+ ]
|
|
|
|
|
+ }, (err, data) => {
|
|
|
|
|
+ if (err) {
|
|
|
|
|
+ console.error('showDialog err: ' + err);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ console.info('showDialog success callback, click button: ' + data.index);
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ let message = (error as BusinessError).message;
|
|
|
|
|
+ let code = (error as BusinessError).code;
|
|
|
|
|
+ console.error(`showDialog args error code is ${code}, message is ${message}`);
|
|
|
|
|
+ };
|
|
|
|
|
+ // DialogHelper.showTipsDialog({
|
|
|
|
|
+ // title: '使用提示:自动导入教程',
|
|
|
|
|
+ //
|
|
|
|
|
+ // content: '用系统自带的文件管理器将:\n\n1、音频文件放入' + '\n\n我的设备/Download/'
|
|
|
|
|
+ // + this.appName + '\n\n2、无需繁琐的勾选和分类步骤。\n\n3、每个子文件夹将被组成一个分组。' +
|
|
|
|
|
+ // '\n\n4、歌词文件的文件名必须和目标歌曲文件名相同(不包含后缀名)。\n\n5、歌词文件和目标歌曲文件必须同个目录。' +
|
|
|
|
|
+ // '\n\n6、电脑上Download的目录是\nDownload/' + this.packName + '。\n\n7、放好文件后如果没显示点击刷新按钮。\n',
|
|
|
|
|
+ // onAction: (action) => {
|
|
|
|
|
+ // if (action == DialogAction.TWO) {
|
|
|
|
|
+ // PreferencesUtil.putSync('isFirstMusic', false)
|
|
|
|
|
+ // router.pushUrl({
|
|
|
|
|
+ // url: 'pages/ScanFilePage'
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2124,6 +2167,10 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
//重命名的对话框
|
|
//重命名的对话框
|
|
|
showReNameDialog(item: VideoItem, index: string, filePath: string) {
|
|
showReNameDialog(item: VideoItem, index: string, filePath: string) {
|
|
|
|
|
+ if(!item.filePath.includes(this.packName)){
|
|
|
|
|
+ ToastUtil.showToast('请把该音频导入到本应用的DownLoad文件下,其他路径音频无权限重命名')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
DialogHelper.showTextInputDialog({
|
|
DialogHelper.showTextInputDialog({
|
|
|
title: '重命名',
|
|
title: '重命名',
|
|
|
text: item.type === CommonConstants.TYPE_IS_DIR ? item.name : item.fileName,
|
|
text: item.type === CommonConstants.TYPE_IS_DIR ? item.name : item.fileName,
|
|
@@ -2453,7 +2500,7 @@ export struct LocalMusic {
|
|
|
emptyView(this.themeColor)
|
|
emptyView(this.themeColor)
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- .position({ top:this.isShowCoverHeader() ? 260 : 180 })
|
|
|
|
|
|
|
+ .position({ top:this.isShowCoverHeader() ? 300 : 180 })
|
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 })
|
|
.transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 })
|
|
|
.animation({ duration: 500 }),
|
|
.animation({ duration: 500 }),
|
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
TransitionEffect.scale({ x: 0, y: 0 })))
|
|
@@ -2507,22 +2554,46 @@ export struct LocalMusic {
|
|
|
transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
})
|
|
})
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
- this.isOneKeyTags = !this.isOneKeyTags
|
|
|
|
|
|
|
+ // if(ArrayUtil.isNotEmpty(this.selectedFiles)&&Utility.isMerge(this.selectedFiles,this.packName)){
|
|
|
|
|
+ this.isOneKeyTags = !this.isOneKeyTags
|
|
|
|
|
+ // }else{
|
|
|
|
|
+ // ToastUtil.showToast('选中的文件包含了不是本应用的DownLoad文件下,其他路径音频无权限批量内嵌')
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- Button('乱码修复', { type: ButtonType.Capsule, stateEffect: true })
|
|
|
|
|
- .width(90)
|
|
|
|
|
|
|
+ Button('合并', { type: ButtonType.Circle, stateEffect: true })
|
|
|
|
|
+ .width(50)
|
|
|
.height(50)
|
|
.height(50)
|
|
|
- .fontSize(13)
|
|
|
|
|
|
|
+ .fontSize(11)
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
.backgroundColor(this.themeColor)
|
|
.backgroundColor(this.themeColor)
|
|
|
- .bindContentCover($$this.isFixMessy, this.FixMessyViewBuilder(), {
|
|
|
|
|
|
|
+ .bindContentCover($$this.isMergeAudio, this.MergeAudioBuilder(), {
|
|
|
transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
})
|
|
})
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
- this.isFixMessy = !this.isFixMessy
|
|
|
|
|
|
|
+ if(ArrayUtil.isNotEmpty(this.selectedFiles)&&Utility.isMerge(this.selectedFiles,this.packName)){
|
|
|
|
|
+ this.isMergeAudio = !this.isMergeAudio
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('选中的文件包含了不是本应用的DownLoad文件下,其他路径音频无权限合并')
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // Button('乱码修复', { type: ButtonType.Capsule, stateEffect: true })
|
|
|
|
|
+ // .width(90)
|
|
|
|
|
+ // .height(50)
|
|
|
|
|
+ // .fontSize(13)
|
|
|
|
|
+ // .margin({ top: 10, bottom: 10, right: 6 })
|
|
|
|
|
+ // .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ // .backgroundColor(this.themeColor)
|
|
|
|
|
+ // .bindContentCover($$this.isFixMessy, this.FixMessyViewBuilder(), {
|
|
|
|
|
+ // transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .onClick(() => {
|
|
|
|
|
+ // this.isFixMessy = !this.isFixMessy
|
|
|
|
|
+ // })
|
|
|
// Button('剪切', { type: ButtonType.Circle, stateEffect: true })
|
|
// Button('剪切', { type: ButtonType.Circle, stateEffect: true })
|
|
|
// .width('35%')
|
|
// .width('35%')
|
|
|
// .height(60)
|
|
// .height(60)
|
|
@@ -2625,10 +2696,13 @@ export struct LocalMusic {
|
|
|
{
|
|
{
|
|
|
selectedFiles:this.selectedFiles,
|
|
selectedFiles:this.selectedFiles,
|
|
|
isOneKeyTags:this.isOneKeyTags,
|
|
isOneKeyTags:this.isOneKeyTags,
|
|
|
|
|
+ table:this.table,
|
|
|
onTagsResult:(result: boolean)=>{
|
|
onTagsResult:(result: boolean)=>{
|
|
|
this.isMultiSelect = false
|
|
this.isMultiSelect = false
|
|
|
if(result){//如果嵌入成功,更新数据
|
|
if(result){//如果嵌入成功,更新数据
|
|
|
- this.doUpdateData()
|
|
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ },500)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2651,7 +2725,382 @@ export struct LocalMusic {
|
|
|
onFixResult:(result: boolean)=>{
|
|
onFixResult:(result: boolean)=>{
|
|
|
this.isMultiSelect = false
|
|
this.isMultiSelect = false
|
|
|
if(result){//如果嵌入成功,更新数据
|
|
if(result){//如果嵌入成功,更新数据
|
|
|
|
|
+ this.deleteCache(this.currentPath)
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //剪辑音频
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ EditAudioBuilder(item:VideoItem) {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ EditAudio(
|
|
|
|
|
+ {
|
|
|
|
|
+ mVideoItem:item,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isEditAudio = !this.isEditAudio
|
|
|
|
|
+ },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isEditAudio = !this.isEditAudio
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayOrPause:()=>{
|
|
|
|
|
+ if(this.videoUrl==item.filePath){
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ this.doPlay(item,0,false,true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onSliderChange:(value:number)=>{
|
|
|
|
|
+ if(this.videoUrl!=item.filePath){
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
|
|
+ this.mDestroyPage = false;
|
|
|
|
|
+ this.showLoadIng();
|
|
|
|
|
+ LogUtils.getInstance().LOGI("slider-->seekValue start:" + value);
|
|
|
|
|
+ let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
+ this.seekTo(seekValue + "");
|
|
|
|
|
+ LogUtils.getInstance().LOGI("slider-->seekValue end:" + seekValue);
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果剪辑成功,更新数据
|
|
|
|
|
+
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('剪辑失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //提取伴奏
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ ConverterBuilder(item:VideoItem) {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ AudioFormatConverter(
|
|
|
|
|
+ {
|
|
|
|
|
+ mVideoItem:item,
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isConverter = !this.isConverter
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayOrPause:()=>{
|
|
|
|
|
+ if(this.videoUrl==item.filePath){
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ this.doPlay(item,0,false,true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isConverter = !this.isConverter
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onSliderChange:(value:number)=>{
|
|
|
|
|
+ if(this.videoUrl!=item.filePath){
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
|
|
+ this.mDestroyPage = false;
|
|
|
|
|
+ this.showLoadIng();
|
|
|
|
|
+ let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
+ this.seekTo(seekValue + "");
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果成功,更新数据
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('格式转化失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //提取伴奏
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ ExtractAccBuilder(item:VideoItem) {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ ExtractAccompaniment(
|
|
|
|
|
+ {
|
|
|
|
|
+ mVideoItem:item,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isExtractAcc = !this.isExtractAcc
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayOrPause:()=>{
|
|
|
|
|
+ if(this.videoUrl==item.filePath){
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ this.doPlay(item,0,false,true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isExtractAcc = !this.isExtractAcc
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onSliderChange:(value:number)=>{
|
|
|
|
|
+ if(this.videoUrl!=item.filePath){
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
|
|
+ this.mDestroyPage = false;
|
|
|
|
|
+ this.showLoadIng();
|
|
|
|
|
+ let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
+ this.seekTo(seekValue + "");
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果成功,更新数据
|
|
|
this.doUpdateData()
|
|
this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('提取伴奏失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //AI人声分离
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ AiBuilder(item:VideoItem) {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ AIVoiceSeparation(
|
|
|
|
|
+ {
|
|
|
|
|
+ mVideoItem:item,
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isAIVoiceSeparation = !this.isAIVoiceSeparation
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayOrPause:()=>{
|
|
|
|
|
+ if(this.videoUrl==item.filePath||this.isPlaying){
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ this.doPlay(item,0,false,true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayPath:(path:string)=>{
|
|
|
|
|
+ this.videoUrl==path
|
|
|
|
|
+ const itemP = Utility.getItemByFilePath(this.videoLocalList,path)
|
|
|
|
|
+ if(itemP)
|
|
|
|
|
+ this.doPlay(itemP,0,false,true)
|
|
|
|
|
+ },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isAIVoiceSeparation = !this.isAIVoiceSeparation
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onSliderChange:(value:number)=>{
|
|
|
|
|
+ if(this.videoUrl!=item.filePath){
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
|
|
+ this.mDestroyPage = false;
|
|
|
|
|
+ this.showLoadIng();
|
|
|
|
|
+ let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
+ this.seekTo(seekValue + "");
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果成功,更新数据
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('Ai人声分离失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //提取视频中的音频
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ extractAudioFromVideoBuilder(item:VideoItem) {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ ExtractAudioFromVideo(
|
|
|
|
|
+ {
|
|
|
|
|
+ mVideoItem:item,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isExtractAudio = !this.isExtractAudio
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ onPlayOrPause:()=>{
|
|
|
|
|
+ if(this.videoUrl==item.filePath){
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ this.doPlay(item,0,false,true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isExtractAudio = !this.isExtractAudio
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onSliderChange:(value:number)=>{
|
|
|
|
|
+ if(this.videoUrl!=item.filePath){
|
|
|
|
|
+ this.videoUrl==item.filePath
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
|
|
+ this.mDestroyPage = false;
|
|
|
|
|
+ this.showLoadIng();
|
|
|
|
|
+ let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
+ this.seekTo(seekValue + "");
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果成功,更新数据
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('提取音频失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //合并音频
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ MergeAudioBuilder() {
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ MergeAudio(
|
|
|
|
|
+ {
|
|
|
|
|
+ videoUrl:this.videoUrl,
|
|
|
|
|
+ CONTROL_PlayStatus:this.CONTROL_PlayStatus,
|
|
|
|
|
+ currentPath:this.currentPath,
|
|
|
|
|
+ selectedFiles:this.selectedFiles,
|
|
|
|
|
+ currentTime:this.currentTime,
|
|
|
|
|
+ progressValue:this.progressValue,
|
|
|
|
|
+ onBack:()=>{
|
|
|
|
|
+ this.isMergeAudio = !this.isMergeAudio
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ // onPlayPath:(path:string)=>{
|
|
|
|
|
+ // if(this.videoUrl==item.filePath){
|
|
|
|
|
+ // this.playOrPause()
|
|
|
|
|
+ // }else{//如果不是当前播放的,则播放该文件
|
|
|
|
|
+ // this.videoUrl==item.filePath
|
|
|
|
|
+ // this.doPlay(item,0,false,true)
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // },
|
|
|
|
|
+ onSeeOutputPath:(outPutPath:string)=>{
|
|
|
|
|
+ this.isMergeAudio = !this.isMergeAudio
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ this.modeType = 0
|
|
|
|
|
+ this.isShowFileName = true
|
|
|
|
|
+ this.getSortedFiles(FileUtil.getParentPath(outPutPath))
|
|
|
|
|
+ },
|
|
|
|
|
+ onResult:(result: boolean,outPath:string)=>{
|
|
|
|
|
+ if(result){//如果成功,更新数据
|
|
|
|
|
+ this.doUpdateData()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(this.selectedFiles.length>=3){
|
|
|
|
|
+ ToastUtil.showToast('合并数量太多导致失败')
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ToastUtil.showToast('合并失败')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -3088,8 +3537,13 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
}))
|
|
}))
|
|
|
.onClick(()=>{
|
|
.onClick(()=>{
|
|
|
- this.doPlay(item,index)
|
|
|
|
|
- this.isShowPlay = true
|
|
|
|
|
|
|
+ if (this.isMultiSelect) {
|
|
|
|
|
+ const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
|
|
|
|
|
+ this.handleFileSelection(item, !isChecked);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.doPlay(item,index)
|
|
|
|
|
+ this.isShowPlay = true
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4869,6 +5323,77 @@ export struct LocalMusic {
|
|
|
this.longItemFilePath = ''
|
|
this.longItemFilePath = ''
|
|
|
this.selectedFiles.push(item)
|
|
this.selectedFiles.push(item)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.cut')),
|
|
|
|
|
+ content: $r('app.string.edit_audio')
|
|
|
|
|
+ })
|
|
|
|
|
+ .bindContentCover($$this.isEditAudio, this.EditAudioBuilder(item), {
|
|
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.isEditAudio = !this.isEditAudio
|
|
|
|
|
+ })
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.music')),
|
|
|
|
|
+ content: $r('app.string.extract_accompaniment')
|
|
|
|
|
+ })
|
|
|
|
|
+ .bindContentCover($$this.isExtractAcc, this.ExtractAccBuilder(item), {
|
|
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.isExtractAcc = !this.isExtractAcc
|
|
|
|
|
+ })
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.repeat')),
|
|
|
|
|
+ content: $r('app.string.converter_audio')
|
|
|
|
|
+ })
|
|
|
|
|
+ .bindContentCover($$this.isConverter, this.ConverterBuilder(item), {
|
|
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.isConverter = !this.isConverter
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.ai_edit')),
|
|
|
|
|
+ content: $r('app.string.vocal_separation')
|
|
|
|
|
+ })
|
|
|
|
|
+ .bindContentCover($$this.isAIVoiceSeparation, this.AiBuilder(item), {
|
|
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.isAIVoiceSeparation = !this.isAIVoiceSeparation
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(Utility.isVideoByExtension(item.filePath)){
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.identify_song')),
|
|
|
|
|
+ content: $r('app.string.extract_audio')
|
|
|
|
|
+ })
|
|
|
|
|
+ .bindContentCover($$this.isExtractAudio, this.extractAudioFromVideoBuilder(item), {
|
|
|
|
|
+ transition: TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) })
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.isExtractAudio = !this.isExtractAudio
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem({
|
|
|
|
|
+ symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.phone')),
|
|
|
|
|
+ content: $r('app.string.set_ring')
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(async () => {
|
|
|
|
|
+ await PermissionUtil.activatePermission(item.filePath)
|
|
|
|
|
+ // if(item.filePath.includes(this.packName)){
|
|
|
|
|
+ setRingTone(this.context, item.filePath,item.name)
|
|
|
|
|
+ // }else{
|
|
|
|
|
+ // ToastUtil.showToast('请把该音频导入到本应用的DownLoad文件下,其他路径音频无权限设置铃声')
|
|
|
|
|
+ // }
|
|
|
|
|
+ this.longItemFilePath = ''
|
|
|
|
|
+ })
|
|
|
MenuItem({
|
|
MenuItem({
|
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.rename')),
|
|
symbolStartIcon: new SymbolGlyphModifier($r('sys.symbol.rename')),
|
|
|
content: $r('app.string.rename')
|
|
content: $r('app.string.rename')
|
|
@@ -5005,13 +5530,16 @@ export struct LocalMusic {
|
|
|
this.lockPath,PreferencesUtil.getStringSync('COVER_API',''));
|
|
this.lockPath,PreferencesUtil.getStringSync('COVER_API',''));
|
|
|
taskpool.execute(task, taskpool.Priority.HIGH).then(()=>{
|
|
taskpool.execute(task, taskpool.Priority.HIGH).then(()=>{
|
|
|
if(this.modeType==0){
|
|
if(this.modeType==0){
|
|
|
- this.getSortedFiles(this.currentPath)
|
|
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ this.isRefreshing =false
|
|
|
|
|
+ this.deleteCache(this.currentPath)
|
|
|
|
|
+ this.getSortedFiles(this.currentPath)
|
|
|
|
|
+ },500)
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.isRefreshing = false;
|
|
|
|
|
- }, 100)
|
|
|
|
|
}).catch((e:object)=>{
|
|
}).catch((e:object)=>{
|
|
|
- console.info("task1 catch e: " + e);
|
|
|
|
|
|
|
+ this.isRefreshing =false
|
|
|
|
|
+ console.info("onecold task1 catch e: " + e);
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -6034,11 +6562,18 @@ export struct LocalMusic {
|
|
|
ToastUtil.showToast('标题不能为空')
|
|
ToastUtil.showToast('标题不能为空')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ DialogHelper.showLoadingDialog()
|
|
|
|
|
+ await PermissionUtil.activatePermission(item.filePath)
|
|
|
|
|
+ let tempOutPath = ''
|
|
|
|
|
+ // 如果不是 packName 包下的文件,则直接路径用this.currentPath
|
|
|
|
|
+ if(!item.filePath.toLowerCase().includes(this.packName)){
|
|
|
|
|
+ tempOutPath = this.currentPath + '/' + item.fileName
|
|
|
|
|
+ }
|
|
|
|
|
+ console.info('onecold tempOutPath ='+tempOutPath)
|
|
|
//用户更改了封面,那就内嵌下封面
|
|
//用户更改了封面,那就内嵌下封面
|
|
|
if(StrUtil.isNotEmpty(this.imagePathStr)){
|
|
if(StrUtil.isNotEmpty(this.imagePathStr)){
|
|
|
const resultCover:boolean = await changeMusicCover(this.context,
|
|
const resultCover:boolean = await changeMusicCover(this.context,
|
|
|
- item.filePath,this.imagePathStr,true);
|
|
|
|
|
|
|
+ item.filePath,this.imagePathStr,true,tempOutPath);
|
|
|
this.imagePathStr = ''
|
|
this.imagePathStr = ''
|
|
|
if(resultCover){
|
|
if(resultCover){
|
|
|
ToastUtil.showToast('内嵌封面成功')
|
|
ToastUtil.showToast('内嵌封面成功')
|
|
@@ -6061,16 +6596,34 @@ export struct LocalMusic {
|
|
|
comment:this.commentStr,
|
|
comment:this.commentStr,
|
|
|
disc:this.discStr,
|
|
disc:this.discStr,
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+ let newInput = item.filePath
|
|
|
|
|
+ //内嵌标签歌路径如果不是包含包名,输入newInput要赋值tempOutPath,然后tempOutPath为空
|
|
|
|
|
+ if(!item.filePath.toLowerCase().includes(this.packName)&&FileUtil.accessSync(tempOutPath)){
|
|
|
|
|
+ newInput = tempOutPath
|
|
|
|
|
+ tempOutPath = ''
|
|
|
|
|
+ }
|
|
|
//内嵌下标签的值,设置overwrite为true会直接修改原文件
|
|
//内嵌下标签的值,设置overwrite为true会直接修改原文件
|
|
|
const result:boolean = await repairAudioMetadata(
|
|
const result:boolean = await repairAudioMetadata(
|
|
|
- item.filePath,
|
|
|
|
|
|
|
+ newInput,
|
|
|
this.lyricConStr,
|
|
this.lyricConStr,
|
|
|
metadata,
|
|
metadata,
|
|
|
- true
|
|
|
|
|
|
|
+ true,
|
|
|
|
|
+ tempOutPath
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (result) {
|
|
if (result) {
|
|
|
|
|
+ if(!item.filePath.includes(this.packName)){
|
|
|
|
|
+ //内嵌成功的歌路径如果不是包含包名,则要入库
|
|
|
|
|
+ let newItem: VideoItem = await Utility.uriGetMusicAssetsFromFile(this.context, newInput,
|
|
|
|
|
+ CommonConstants.TYPE_LOCAL, this.autoParseMusicName);
|
|
|
|
|
+ this.table.insert(newItem, (id: number) => {
|
|
|
|
|
+ //加入数据库
|
|
|
|
|
+ if(this.modeType==0){
|
|
|
|
|
+ this.deleteCache(this.currentPath)
|
|
|
|
|
+ this.getSortedFiles(this.currentPath)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
this.table.updateMediaInfo(item.filePath, this.titleStr, this.artistStr, this.ablumStr,this.lyricConStr,
|
|
this.table.updateMediaInfo(item.filePath, this.titleStr, this.artistStr, this.ablumStr,this.lyricConStr,
|
|
|
this.yearStr,this.genreStr,this.trackStr,this.albumArtistStr,this.composerStr, this.lyricistStr,this.commentStr,this.discStr,
|
|
this.yearStr,this.genreStr,this.trackStr,this.albumArtistStr,this.composerStr, this.lyricistStr,this.commentStr,this.discStr,
|
|
|
(success: boolean, error?: string) => {
|
|
(success: boolean, error?: string) => {
|
|
@@ -6104,12 +6657,15 @@ export struct LocalMusic {
|
|
|
console.error(" onecold 编辑信息数据库失败原因: " + error);
|
|
console.error(" onecold 编辑信息数据库失败原因: " + error);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 关闭进度条
|
|
|
|
|
+ DialogHelper.closeLoading();
|
|
|
});
|
|
});
|
|
|
console.log(' onecold 元数据标签更新成功,');
|
|
console.log(' onecold 元数据标签更新成功,');
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 关闭进度条
|
|
|
|
|
+ DialogHelper.closeLoading();
|
|
|
ToastUtil.showToast('内嵌音乐标签失败')
|
|
ToastUtil.showToast('内嵌音乐标签失败')
|
|
|
console.log('onecold 内嵌音乐标签失败');
|
|
console.log('onecold 内嵌音乐标签失败');
|
|
|
}
|
|
}
|
|
@@ -8104,7 +8660,7 @@ export struct LocalMusic {
|
|
|
@State videoHeight: string = '100%';
|
|
@State videoHeight: string = '100%';
|
|
|
@State initAspectRatio: number = 1;
|
|
@State initAspectRatio: number = 1;
|
|
|
@State videoAspectRatio: number = this.initAspectRatio;
|
|
@State videoAspectRatio: number = this.initAspectRatio;
|
|
|
- private videoUrl: string = '';
|
|
|
|
|
|
|
+ @State videoUrl: string = '';
|
|
|
private last: number = 0;
|
|
private last: number = 0;
|
|
|
@State videoParentAspectRatio: number = this.initAspectRatio;
|
|
@State videoParentAspectRatio: number = this.initAspectRatio;
|
|
|
private mIjkMediaPlayer = IjkMediaPlayer.getInstance();
|
|
private mIjkMediaPlayer = IjkMediaPlayer.getInstance();
|
|
@@ -9567,7 +10123,7 @@ export struct LocalMusic {
|
|
|
@Builder
|
|
@Builder
|
|
|
private musicNameInfo(isHidden: boolean) {
|
|
private musicNameInfo(isHidden: boolean) {
|
|
|
Column({ space: 8 }) {
|
|
Column({ space: 8 }) {
|
|
|
- Text(this.name)
|
|
|
|
|
|
|
+ Text(this.isShowFileName&&this.currentSong?this.currentSong.fileName :this.name)
|
|
|
.fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 22)
|
|
.fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 22)
|
|
|
.fontWeight(FontWeight.Bold)
|
|
.fontWeight(FontWeight.Bold)
|
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
@@ -9580,7 +10136,7 @@ export struct LocalMusic {
|
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
.textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
.fontColor(Color.White)
|
|
.fontColor(Color.White)
|
|
|
.textAlign(TextAlign.Center)
|
|
.textAlign(TextAlign.Center)
|
|
|
- .visibility(StrUtil.isEmpty(this.artist)?Visibility.None:Visibility.Visible)
|
|
|
|
|
|
|
+ .visibility(StrUtil.isEmpty(this.artist)||this.isShowFileName?Visibility.None:Visibility.Visible)
|
|
|
.width('99%')
|
|
.width('99%')
|
|
|
.maxLines(1)
|
|
.maxLines(1)
|
|
|
}
|
|
}
|
|
@@ -11813,6 +12369,20 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private async play(url: string,startOffset?:number) {
|
|
private async play(url: string,startOffset?:number) {
|
|
|
|
|
+ console.info('onecold this.url 1= '+url)
|
|
|
|
|
+ if(!url.toLowerCase().startsWith('http')){
|
|
|
|
|
+ let hasPermission = await PermissionUtil.activatePermission(url)
|
|
|
|
|
+ console.info('onecold this.hasPermission 1= '+hasPermission)
|
|
|
|
|
+ if(!url.includes(this.packName)){
|
|
|
|
|
+ const file = fs.openSync(url)
|
|
|
|
|
+ this.videoUrl = file.path
|
|
|
|
|
+ url= this.videoUrl
|
|
|
|
|
+ }
|
|
|
|
|
+ console.info('onecold this.hasPermission 1= '+hasPermission)
|
|
|
|
|
+ console.info('onecold this.videoUrl 1= '+this.videoUrl)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
let that = this;
|
|
let that = this;
|
|
|
that.showLoadIng();
|
|
that.showLoadIng();
|
|
|
this.isOpenAB = false
|
|
this.isOpenAB = false
|