Remove Useless Information
This commit is contained in:
parent
3ee9f5d2d1
commit
0c0299d63a
@ -98,7 +98,7 @@
|
|||||||
let _rp_data = [data.title, data.artist, data.album];
|
let _rp_data = [data.title, data.artist, data.album];
|
||||||
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
|
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
|
||||||
} else {
|
} else {
|
||||||
this.showFail(data.message, data.rawFilename)
|
this.showFail(data.message, data.rawFilename + "." + data.rawExt)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showFail(errInfo, filename) {
|
showFail(errInfo, filename) {
|
||||||
|
@ -5,15 +5,13 @@ export function DownloadBlobMusic(data, format) {
|
|||||||
case "1":
|
case "1":
|
||||||
a.download = data.title + "." + data.ext;
|
a.download = data.title + "." + data.ext;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case "2":
|
case "2":
|
||||||
a.download = data.artist + " - " + data.title + "." + data.ext;
|
a.download = data.artist + " - " + data.title + "." + data.ext;
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
a.download = data.title + " - " + data.artist + "." + data.ext;
|
a.download = data.title + " - " + data.artist + "." + data.ext;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
a.download = data.filename;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
document.body.append(a);
|
document.body.append(a);
|
||||||
a.click();
|
a.click();
|
||||||
|
@ -25,22 +25,19 @@ async function Decrypt(file, raw_filename, raw_ext) {
|
|||||||
}
|
}
|
||||||
// 导出
|
// 导出
|
||||||
const musicData = new Blob([audioData], {type: "audio/flac"});
|
const musicData = new Blob([audioData], {type: "audio/flac"});
|
||||||
const musicUrl = URL.createObjectURL(musicData);
|
|
||||||
|
|
||||||
// 读取Meta
|
// 读取Meta
|
||||||
let tag = await musicMetadata.parseBlob(musicData);
|
let tag = await musicMetadata.parseBlob(musicData);
|
||||||
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, "flac");
|
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
|
||||||
let picUrl = util.GetCoverURL(tag);
|
|
||||||
// 返回
|
// 返回
|
||||||
return {
|
return {
|
||||||
status: true,
|
status: true,
|
||||||
filename: info.filename,
|
|
||||||
title: info.title,
|
title: info.title,
|
||||||
artist: info.artist,
|
artist: info.artist,
|
||||||
ext: 'flac',
|
ext: 'flac',
|
||||||
album: tag.common.album,
|
album: tag.common.album,
|
||||||
picture: picUrl,
|
picture: util.GetCoverURL(tag),
|
||||||
file: musicUrl,
|
file: URL.createObjectURL(musicData),
|
||||||
mime: "audio/flac"
|
mime: "audio/flac"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,17 +49,14 @@ async function Decrypt(file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const musicData = new Blob([audioData], {type: mime});
|
const musicData = new Blob([audioData], {type: mime});
|
||||||
const musicUrl = URL.createObjectURL(musicData);
|
|
||||||
const filename = artists.join(" & ") + " - " + musicMeta.musicName + "." + musicMeta.format;
|
|
||||||
return {
|
return {
|
||||||
status: true,
|
status: true,
|
||||||
filename: filename,
|
|
||||||
title: musicMeta.musicName,
|
title: musicMeta.musicName,
|
||||||
artist: artists.join(" & "),
|
artist: artists.join(" & "),
|
||||||
ext: musicMeta.format,
|
ext: musicMeta.format,
|
||||||
album: musicMeta.album,
|
album: musicMeta.album,
|
||||||
picture: musicMeta.albumPic,
|
picture: musicMeta.albumPic,
|
||||||
file: musicUrl,
|
file: URL.createObjectURL(musicData),
|
||||||
mime: mime
|
mime: mime
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
|
|||||||
if (!(raw_ext in OriginalExtMap)) {
|
if (!(raw_ext in OriginalExtMap)) {
|
||||||
return {status: false, message: "File type is incorrect!"}
|
return {status: false, message: "File type is incorrect!"}
|
||||||
}
|
}
|
||||||
let new_ext = OriginalExtMap[raw_ext];
|
const new_ext = OriginalExtMap[raw_ext];
|
||||||
const mime = util.AudioMimeType[new_ext];
|
const mime = util.AudioMimeType[new_ext];
|
||||||
// 读取文件
|
// 读取文件
|
||||||
const fileBuffer = await util.GetArrayBuffer(file);
|
const fileBuffer = await util.GetArrayBuffer(file);
|
||||||
@ -38,22 +38,19 @@ async function Decrypt(file, raw_filename, raw_ext) {
|
|||||||
}
|
}
|
||||||
// 导出
|
// 导出
|
||||||
const musicData = new Blob([audioData], {type: mime});
|
const musicData = new Blob([audioData], {type: mime});
|
||||||
const musicUrl = URL.createObjectURL(musicData);
|
|
||||||
// 读取Meta
|
// 读取Meta
|
||||||
let tag = await musicMetadata.parseBlob(musicData);
|
const tag = await musicMetadata.parseBlob(musicData);
|
||||||
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, new_ext);
|
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
|
||||||
let picUrl = util.GetCoverURL(tag);
|
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return {
|
return {
|
||||||
status: true,
|
status: true,
|
||||||
filename: info.filename,
|
|
||||||
title: info.title,
|
title: info.title,
|
||||||
artist: info.artist,
|
artist: info.artist,
|
||||||
ext: new_ext,
|
ext: new_ext,
|
||||||
album: tag.common.album,
|
album: tag.common.album,
|
||||||
picture: picUrl,
|
picture: util.GetCoverURL(tag),
|
||||||
file: musicUrl,
|
file: URL.createObjectURL(musicData),
|
||||||
mime: mime
|
mime: mime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,23 +4,16 @@ export {Decrypt}
|
|||||||
|
|
||||||
|
|
||||||
async function Decrypt(file, raw_filename, raw_ext) {
|
async function Decrypt(file, raw_filename, raw_ext) {
|
||||||
let tag = await musicMetadata.parseBlob(file);
|
const tag = await musicMetadata.parseBlob(file);
|
||||||
|
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
|
||||||
let fileUrl = URL.createObjectURL(file);
|
|
||||||
|
|
||||||
const picUrl = util.GetCoverURL(tag);
|
|
||||||
const mime = util.AudioMimeType[raw_ext];
|
|
||||||
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, raw_ext);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: true,
|
status: true,
|
||||||
filename: info.filename,
|
|
||||||
title: info.title,
|
title: info.title,
|
||||||
artist: info.artist,
|
artist: info.artist,
|
||||||
ext: raw_ext,
|
ext: raw_ext,
|
||||||
album: tag.common.album,
|
album: tag.common.album,
|
||||||
picture: picUrl,
|
picture: util.GetCoverURL(tag),
|
||||||
file: fileUrl,
|
file: URL.createObjectURL(file),
|
||||||
mime: mime
|
mime: util.AudioMimeType[raw_ext]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ const AudioMimeType = {
|
|||||||
ogg: "audio/ogg"
|
ogg: "audio/ogg"
|
||||||
};
|
};
|
||||||
|
|
||||||
function GetFileInfo(artist, title, filenameNoExt, ext) {
|
function GetFileInfo(artist, title, filenameNoExt) {
|
||||||
let newArtist = "", newTitle = "";
|
let newArtist = "", newTitle = "";
|
||||||
let filenameArray = filenameNoExt.split("-");
|
let filenameArray = filenameNoExt.split("-");
|
||||||
if (filenameArray.length > 1) {
|
if (filenameArray.length > 1) {
|
||||||
@ -34,8 +34,7 @@ function GetFileInfo(artist, title, filenameNoExt, ext) {
|
|||||||
if (typeof title == "string" && title !== "") {
|
if (typeof title == "string" && title !== "") {
|
||||||
newTitle = title;
|
newTitle = title;
|
||||||
}
|
}
|
||||||
let newFilename = newArtist + " - " + newTitle + "." + ext;
|
return {artist: newArtist, title: newTitle};
|
||||||
return {artist: newArtist, title: newTitle, filename: newFilename};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user