|
|
@@ -667,14 +667,15 @@ export class Utility {
|
|
|
}
|
|
|
|
|
|
//获取音乐资源的属性值,
|
|
|
- static async uriGetMusicAssetsFromFile(context:Context,uri:string,type:number,autoParseMusicName?:boolean): Promise<VideoItem> {
|
|
|
+ static async uriGetMusicAssetsFromFile(context:Context,uri:string,type:number
|
|
|
+ ,autoParseMusicName?:boolean,originFileName?:string): Promise<VideoItem> {
|
|
|
await ReqPermissionUtil.persistPermission(uri);
|
|
|
if(StrUtil.isNotEmpty(uri)&&uri.toLowerCase().endsWith('.cue')){
|
|
|
const cueItem = new VideoItem(FileUtil.getFileName(uri),uri,uri,type,0,'')
|
|
|
cueItem.fileName = FileUtil.getFileName(uri)
|
|
|
return cueItem
|
|
|
}
|
|
|
- return Utility.readMetaInfoFFmpeg(context,uri,type,autoParseMusicName)
|
|
|
+ return Utility.readMetaInfoFFmpeg(context,uri,type,autoParseMusicName,originFileName)
|
|
|
|
|
|
//华为官方不支持的格式 不支持内嵌歌词Dsf,aif,aiff,wav 不支持内嵌封面dsf,aif,aiff
|
|
|
if(StrUtil.isNotEmpty(uri)){
|
|
|
@@ -852,7 +853,8 @@ export class Utility {
|
|
|
}
|
|
|
|
|
|
|
|
|
- static async readMetaInfoFFmpeg(context:Context,inputPath: string,type:number,autoParseMusicName?:boolean): Promise<VideoItem> {
|
|
|
+ static async readMetaInfoFFmpeg(context:Context,inputPath: string,type:number,
|
|
|
+ autoParseMusicName?:boolean,originFileName?:string): Promise<VideoItem> {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
inputPath = FileUtil.getFilePath(inputPath)
|
|
|
let commands = ["ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", inputPath];
|
|
|
@@ -920,16 +922,17 @@ export class Utility {
|
|
|
if(autoParseMusicName){
|
|
|
const musicData = parseMusicFileName(file.name);
|
|
|
if (musicData.isValid) {
|
|
|
- // console.log(`onecold 艺术家:${musicData.artist}`); // 输出:周杰伦
|
|
|
- // console.log(`onecold 歌曲名:${musicData.title}`); // 输出:七里香
|
|
|
+ console.log(`onecold 艺术家:${musicData.artist}`); // 输出:周杰伦
|
|
|
+ console.log(`onecold 歌曲名:${musicData.title}`); // 输出:七里香
|
|
|
title = musicData.title
|
|
|
if(artist==''||artist==undefined)
|
|
|
artist = musicData.artist
|
|
|
} else {
|
|
|
- title = file.name
|
|
|
+
|
|
|
+ title = originFileName||file.name
|
|
|
}
|
|
|
}else{
|
|
|
- title = file.name
|
|
|
+ title = originFileName||file.name
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1806,7 +1809,7 @@ export function parseMusicFileName(fileName: string): MusicInfo {
|
|
|
result.title.length > 0;
|
|
|
} else {
|
|
|
result.title = baseName;
|
|
|
- result.isValid = result.title.length > 0;
|
|
|
+ result.isValid = false;
|
|
|
}
|
|
|
|
|
|
return result;
|