Merge branch 'main' of https://github.com/Monochromish/Cider
This commit is contained in:
commit
5acbe64c0a
14 changed files with 135 additions and 148 deletions
|
@ -80,6 +80,12 @@ jobs:
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y wine32
|
sudo apt-get install -y wine32
|
||||||
|
- run:
|
||||||
|
name: Reinstall proper rust node module
|
||||||
|
command: |
|
||||||
|
cd ./node_modules/cider_utils
|
||||||
|
yarn run prebuild-downloads --platform=win32 --verbose
|
||||||
|
cd ../..
|
||||||
- run:
|
- run:
|
||||||
name: Generate Builds (Windows)
|
name: Generate Builds (Windows)
|
||||||
command: yarn electron-builder -w --x64 -p never
|
command: yarn electron-builder -w --x64 -p never
|
||||||
|
@ -105,6 +111,12 @@ jobs:
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y wine32
|
sudo apt-get install -y wine32
|
||||||
|
- run:
|
||||||
|
name: Reinstall proper rust node module
|
||||||
|
command: |
|
||||||
|
cd ./node_modules/cider_utils
|
||||||
|
yarn run prebuild-downloads --platform=win32 --verbose
|
||||||
|
cd ../..
|
||||||
- run:
|
- run:
|
||||||
name: Generate Builds (Winget)
|
name: Generate Builds (Winget)
|
||||||
command: yarn electron-builder --win -c winget.json -p never
|
command: yarn electron-builder --win -c winget.json -p never
|
||||||
|
|
1
.github/workflows/build-macos.yml
vendored
1
.github/workflows/build-macos.yml
vendored
|
@ -96,6 +96,7 @@ jobs:
|
||||||
cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js
|
cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js
|
||||||
rm -r node_modules/pouchdb-node/node_modules/leveldown
|
rm -r node_modules/pouchdb-node/node_modules/leveldown
|
||||||
rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown
|
rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown
|
||||||
|
rm -r /node_modules/leveldown/node_modules/node-gyp-build || true
|
||||||
yarn dist:universalNotWorking -p never
|
yarn dist:universalNotWorking -p never
|
||||||
# - name: Perform CodeQL Analysis
|
# - name: Perform CodeQL Analysis
|
||||||
# uses: github/codeql-action/analyze@v1
|
# uses: github/codeql-action/analyze@v1
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -330,3 +330,4 @@ savedconfig/config.json
|
||||||
savedconfig/session.json
|
savedconfig/session.json
|
||||||
savedconfig/window-state.json
|
savedconfig/window-state.json
|
||||||
src/main/base/sample.json
|
src/main/base/sample.json
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@
|
||||||
"wallpaper": "5.0.1",
|
"wallpaper": "5.0.1",
|
||||||
"ws": "^8.5.0",
|
"ws": "^8.5.0",
|
||||||
"xml2js": "^0.4.23",
|
"xml2js": "^0.4.23",
|
||||||
"youtube-search-without-api-key": "^1.0.7"
|
"youtube-search-without-api-key": "^1.0.7",
|
||||||
|
"cider_utils": "git+https://github.com/ciderapp/cider_utils"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/adm-zip": "^0.5.0",
|
"@types/adm-zip": "^0.5.0",
|
||||||
|
@ -121,9 +122,9 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build": {
|
"build": {
|
||||||
"electronVersion": "18.3.3",
|
"electronVersion": "18.3.5",
|
||||||
"electronDownload": {
|
"electronDownload": {
|
||||||
"version": "18.3.3+wvcus",
|
"version": "18.3.5+wvcus",
|
||||||
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
||||||
},
|
},
|
||||||
"appId": "cider",
|
"appId": "cider",
|
||||||
|
|
|
@ -24,8 +24,9 @@ exports.default = function(context) {
|
||||||
// execSync('python3 -m castlabs_evs.vmp -n sign-pkg dist/mac',{stdio: 'inherit'})
|
// execSync('python3 -m castlabs_evs.vmp -n sign-pkg dist/mac',{stdio: 'inherit'})
|
||||||
// if (fs.existsSync('dist/mac-arm64'))
|
// if (fs.existsSync('dist/mac-arm64'))
|
||||||
// execSync('python3 -m castlabs_evs.vmp -n sign-pkg dist/mac-arm64 -z',{stdio: 'inherit'})
|
// execSync('python3 -m castlabs_evs.vmp -n sign-pkg dist/mac-arm64 -z',{stdio: 'inherit'})
|
||||||
// if (fs.existsSync('dist/mac-x64'))
|
|
||||||
// execSync('python3 -m castlabs_evs.vmp -n sign-pkg dist/mac-x64',{stdio: 'inherit'})
|
if (fs.existsSync('dist/mac-x64') || fs.existsSync('dist/mac-universal--x64') )
|
||||||
|
execSync('cd ./node_modules/cider_utils; yarn run prebuild-downloads --platform=darwin --arch=arm64 --verbose; cd ../..',{stdio: 'inherit'})
|
||||||
|
|
||||||
// console.log('VMP signing complete')
|
// console.log('VMP signing complete')
|
||||||
|
|
||||||
|
|
|
@ -394,5 +394,10 @@
|
||||||
"action.cut": "Ausschneiden",
|
"action.cut": "Ausschneiden",
|
||||||
"action.paste": "Einfügen",
|
"action.paste": "Einfügen",
|
||||||
"action.selectAll": "Alles auswählen",
|
"action.selectAll": "Alles auswählen",
|
||||||
"action.delete": "Löschen"
|
"action.delete": "Löschen",
|
||||||
|
"home.syncFavorites": "Sync Favoriten",
|
||||||
|
"term.quit" : "Beenden",
|
||||||
|
"settings.option.connectivity.lastfmScrobble.filterLoop.description": "Verhindert, dass geloopte Titel gescrobbelt oder in der (Hört Gerade)-Liste auf Last.fm angezeigt werden",
|
||||||
|
"settings.option.connectivity.lastfmScrobble.filterTypes": "Medientypen filtern (Last.fm)",
|
||||||
|
"settings.option.connectivity.lastfmScrobble.manualToken": "Last.fm-Token manuell eingeben"
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
"term.confirmLogout": "Are you sure you want to logout?",
|
"term.confirmLogout": "Are you sure you want to logout?",
|
||||||
"term.creditDesignedBy": "Designed by ${authorUsername}",
|
"term.creditDesignedBy": "Designed by ${authorUsername}",
|
||||||
"term.discNumber": "Disc ${discNumber}",
|
"term.discNumber": "Disc ${discNumber}",
|
||||||
"term.reload" : "Reload Cider ?",
|
"term.reload" : "Reload Cider?",
|
||||||
"term.toggleprivate" : "Toggle Private Session",
|
"term.toggleprivate" : "Toggle Private Session",
|
||||||
"term.webremote" : "Web Remote",
|
"term.webremote" : "Web Remote",
|
||||||
"term.cast" : "Cast",
|
"term.cast" : "Cast",
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
"term.confirmLogout": "Are you sure you want to logout?",
|
"term.confirmLogout": "Are you sure you want to logout?",
|
||||||
"term.creditDesignedBy": "Designed by ${authorUsername}",
|
"term.creditDesignedBy": "Designed by ${authorUsername}",
|
||||||
"term.discNumber": "Disc ${discNumber}",
|
"term.discNumber": "Disc ${discNumber}",
|
||||||
"term.reload" : "Reload Cider ?",
|
"term.reload" : "Reload Cider?",
|
||||||
"term.toggleprivate" : "Toggle Private Session",
|
"term.toggleprivate" : "Toggle Private Session",
|
||||||
"term.webremote" : "Web Remote",
|
"term.webremote" : "Web Remote",
|
||||||
"term.cast" : "Cast",
|
"term.cast" : "Cast",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"i18n.languageName": "简体中文(中国)",
|
"i18n.languageName": "简体中文(中国)",
|
||||||
"i18n.languageNameEnglish": "Simp. Chinese (China)",
|
"i18n.languageNameEnglish": "Simp. Chinese (China)",
|
||||||
"i18n.category": "main",
|
"i18n.category": "main",
|
||||||
"i18n.authors": "@notmaikiwi @BillKerman @jay900604",
|
"i18n.authors": "@notmaikiwi @BillKerman @jay900604 @sakura0224",
|
||||||
"app.name": "Cider",
|
"app.name": "Cider",
|
||||||
"date.format": "${y}年${m}月${d}日",
|
"date.format": "${y}年${m}月${d}日",
|
||||||
"dialog.cancel": "取消",
|
"dialog.cancel": "取消",
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
"action.favorite":"喜爱",
|
"action.favorite":"喜爱",
|
||||||
"action.removeFavorite":"取消喜爱",
|
"action.removeFavorite":"取消喜爱",
|
||||||
"action.hideLibrary":"隐藏资料库",
|
"action.hideLibrary":"隐藏资料库",
|
||||||
"action.showLibrary":"显示资料可查",
|
"action.showLibrary":"显示资料库",
|
||||||
"action.cut":"剪切",
|
"action.cut":"剪切",
|
||||||
"action.paste":"粘贴",
|
"action.paste":"粘贴",
|
||||||
"action.selectAll":"全选",
|
"action.selectAll":"全选",
|
||||||
|
@ -404,8 +404,10 @@
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.E68_2": "宇治抹茶奶茶",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.E68_2": "宇治抹茶奶茶",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.E168_1": "春毫茉莉玛琪雅朵",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.E168_1": "春毫茉莉玛琪雅朵",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z3600": "北海道奶茶",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z3600": "北海道奶茶",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z8500": "月光软饼干",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z8500A": "月光软饼干",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.BSCBM":"布蕾黑糖鲜奶",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.BSCBM":"布蕾黑糖鲜奶",
|
||||||
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z8500B": "樱桃克拉芙缇",
|
||||||
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.Z8500C": "宇治抹茶麻糬",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.CUDDLE":"温暖抱抱",
|
"settings.option.audio.enableAdvancedFunctionality.atmosphereRealizerMode.CUDDLE":"温暖抱抱",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.ciderPPE": "Cider 数码增强音频处理™️",
|
"settings.option.audio.enableAdvancedFunctionality.ciderPPE": "Cider 数码增强音频处理™️",
|
||||||
"settings.option.audio.enableAdvancedFunctionality.ciderPPE.description": "通过人类的听力心理学模型和 AAC 编码特色的即时算法,强化 AAC 音频的感知音频质量。",
|
"settings.option.audio.enableAdvancedFunctionality.ciderPPE.description": "通过人类的听力心理学模型和 AAC 编码特色的即时算法,强化 AAC 音频的感知音频质量。",
|
||||||
|
@ -522,7 +524,7 @@
|
||||||
"settings.option.connectivity.lastfmScrobble.nowPlaying": "打开 Last.FM 正在聆听",
|
"settings.option.connectivity.lastfmScrobble.nowPlaying": "打开 Last.FM 正在聆听",
|
||||||
"settings.option.connectivity.lastfmScrobble.removeFeatured": "从歌名里去除合作者 (Last.FM)",
|
"settings.option.connectivity.lastfmScrobble.removeFeatured": "从歌名里去除合作者 (Last.FM)",
|
||||||
"settings.option.connectivity.lastfmScrobble.filterLoop": "不记录单曲循环 (Last.FM)",
|
"settings.option.connectivity.lastfmScrobble.filterLoop": "不记录单曲循环 (Last.FM)",
|
||||||
"settings.option.connectivity.lastfmScrobble.filterLoop.description": "防止循环单曲被打乱或展示在Last.FM 的正在播放列表中。",
|
"settings.option.connectivity.lastfmScrobble.filterLoop.description": "防止循环单曲被记录或展示在Last.FM 的正在播放列表中。",
|
||||||
"settings.option.connectivity.lastfmScrobble.filterTypes": "过滤媒体类型 (Last.fm)",
|
"settings.option.connectivity.lastfmScrobble.filterTypes": "过滤媒体类型 (Last.fm)",
|
||||||
"settings.option.connectivity.lastfmScrobble.manualToken": "手动输入 Last.fm 验证码",
|
"settings.option.connectivity.lastfmScrobble.manualToken": "手动输入 Last.fm 验证码",
|
||||||
"settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm 连接超时",
|
"settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm 连接超时",
|
||||||
|
@ -616,7 +618,7 @@
|
||||||
"oobe.visual.suggestingThemes.community1":"Groovy",
|
"oobe.visual.suggestingThemes.community1":"Groovy",
|
||||||
"oobe.visual.suggestingThemes.community1.text":"类 WinUI 主题。",
|
"oobe.visual.suggestingThemes.community1.text":"类 WinUI 主题。",
|
||||||
"oobe.visual.suggestingThemes.community2":"iTheme",
|
"oobe.visual.suggestingThemes.community2":"iTheme",
|
||||||
"oobe.visual.suggestingThemes.community2.text":"基于 MacOS Monterey 的 Apple Music bata 主题。",
|
"oobe.visual.suggestingThemes.community2.text":"基于 MacOS Monterey 的 Apple Music beta 主题。",
|
||||||
"oobe.visual.suggestingThemes.community3":"Dracula",
|
"oobe.visual.suggestingThemes.community3":"Dracula",
|
||||||
"oobe.visual.suggestingThemes.community3.text":"著名的德古拉吸血鬼主题。",
|
"oobe.visual.suggestingThemes.community3.text":"著名的德古拉吸血鬼主题。",
|
||||||
"oobe.amsignin.title": ""
|
"oobe.amsignin.title": ""
|
||||||
|
|
|
@ -52,22 +52,50 @@ export default class DiscordRPC {
|
||||||
const self = this
|
const self = this
|
||||||
this.connect();
|
this.connect();
|
||||||
console.debug(`[Plugin][${this.name}] Ready.`);
|
console.debug(`[Plugin][${this.name}] Ready.`);
|
||||||
ipcMain.on('updateRPCImage', (_event, imageurl) => {
|
ipcMain.on('updateRPCImage', async (_event, imageurl) => {
|
||||||
if (!this._utils.getStoreValue("general.privateEnabled")) {
|
if (!this._utils.getStoreValue("general.privateEnabled")) {
|
||||||
fetch('https://api.cider.sh/v1/images', {
|
let b64data = ""
|
||||||
|
let postbody = ""
|
||||||
|
if (imageurl.startsWith("/ciderlocalart")){
|
||||||
|
let port = await _win.webContents.executeJavaScript(
|
||||||
|
`app.clientPort`
|
||||||
|
);
|
||||||
|
console.log("http://localhost:"+port+imageurl)
|
||||||
|
const response = await fetch("http://localhost:"+port+imageurl)
|
||||||
|
b64data = (await response.buffer()).toString('base64');
|
||||||
|
postbody = JSON.stringify({data: b64data})
|
||||||
|
fetch('https://api.cider.sh/v1/images', {
|
||||||
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({url: imageurl}),
|
body: postbody,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'User-Agent': _win.webContents.getUserAgent()
|
'User-Agent': _win.webContents.getUserAgent()
|
||||||
},
|
},
|
||||||
})
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(function (json) {
|
|
||||||
self._attributes["artwork"]["url"] = json.url
|
|
||||||
self.setActivity(self._attributes)
|
|
||||||
})
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(function (json) {
|
||||||
|
self._attributes["artwork"]["url"] = json.url
|
||||||
|
self.setActivity(self._attributes)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
postbody = JSON.stringify({url: imageurl})
|
||||||
|
fetch('https://api.cider.sh/v1/images', {
|
||||||
|
|
||||||
|
method: 'POST',
|
||||||
|
body: postbody,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': _win.webContents.getUserAgent()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(function (json) {
|
||||||
|
self._attributes["artwork"]["url"] = json.url
|
||||||
|
self.setActivity(self._attributes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ipcMain.on("reloadRPC", () => {
|
ipcMain.on("reloadRPC", () => {
|
||||||
|
@ -88,6 +116,7 @@ export default class DiscordRPC {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs on app stop
|
* Runs on app stop
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,8 +6,7 @@ import * as mm from 'music-metadata';
|
||||||
import {Md5} from 'ts-md5/dist/md5';
|
import {Md5} from 'ts-md5/dist/md5';
|
||||||
import e from "express";
|
import e from "express";
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
import { parseFile } from 'cider_utils';
|
||||||
|
|
||||||
|
|
||||||
export class LocalFiles {
|
export class LocalFiles {
|
||||||
static localSongs: any = [];
|
static localSongs: any = [];
|
||||||
|
@ -43,18 +42,15 @@ export class LocalFiles {
|
||||||
// get files from the Music folder
|
// get files from the Music folder
|
||||||
files = files.concat(await LocalFiles.getFiles(folder))
|
files = files.concat(await LocalFiles.getFiles(folder))
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("cider.files", files2);
|
|
||||||
let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"]
|
let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"]
|
||||||
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
||||||
// console.log("cider.files2", audiofiles, audiofiles.length);
|
|
||||||
let metadatalist = []
|
let metadatalist = []
|
||||||
let metadatalistart = []
|
let metadatalistart = []
|
||||||
let numid = 0;
|
let numid = 0;
|
||||||
|
|
||||||
for (var audio of audiofiles) {
|
for (var audio of audiofiles) {
|
||||||
try {
|
try {
|
||||||
const metadata = await mm.parseFile(audio);
|
const metadata = await parseFile(audio);
|
||||||
let lochash = Md5.hashStr(audio) ?? numid;
|
let lochash = Md5.hashStr(audio) ?? numid;
|
||||||
if (metadata != null) {
|
if (metadata != null) {
|
||||||
let form = {
|
let form = {
|
||||||
|
@ -80,17 +76,17 @@ export class LocalFiles {
|
||||||
// "kind": "podcast",
|
// "kind": "podcast",
|
||||||
// "isLibrary": true,
|
// "isLibrary": true,
|
||||||
// "reporting": false },
|
// "reporting": false },
|
||||||
"trackNumber": metadata.common.track?.no ?? 0,
|
"trackNumber": metadata.track_number ?? 0,
|
||||||
"discNumber": metadata.common.disk?.no ?? 0,
|
"discNumber": metadata.disc_number ?? 0,
|
||||||
"name": metadata.common.title ?? audio.substring(audio.lastIndexOf('\\') + 1),
|
"name": metadata.title ?? audio.substring(audio.lastIndexOf('\\') + 1),
|
||||||
"albumName": metadata.common.album,
|
"albumName": metadata.album,
|
||||||
"artistName": metadata.common.artist,
|
"artistName": metadata.artist,
|
||||||
"copyright": metadata.common.copyright ?? "",
|
"copyright": metadata.copyright ?? "",
|
||||||
"assetUrl": "file:///" + audio,
|
"assetUrl": "file:///" + audio,
|
||||||
"contentAdvisory": "",
|
"contentAdvisory": "",
|
||||||
"releaseDateTime": `${metadata?.common?.year ?? '2022'}-05-13T00:23:00Z`,
|
"releaseDateTime": `${metadata.year ?? '2022'}-05-13T00:23:00Z`,
|
||||||
"durationInMillis": Math.floor((metadata.format.duration ?? 0) * 1000),
|
"durationInMillis": metadata.duration_in_ms ?? 0,
|
||||||
"bitrate": Math.floor((metadata.format?.bitrate ?? 0) / 1000),
|
"bitrate": metadata.bitrate ?? 0,
|
||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
"kind": "get",
|
"kind": "get",
|
||||||
|
@ -99,18 +95,18 @@ export class LocalFiles {
|
||||||
],
|
],
|
||||||
"contentRating": "clean"
|
"contentRating": "clean"
|
||||||
},
|
},
|
||||||
flavor: Math.floor((metadata.format?.bitrate ?? 0) / 1000),
|
flavor: metadata.bitrate,
|
||||||
localFilesMetadata: {
|
localFilesMetadata: {
|
||||||
lossless: metadata.format?.lossless,
|
lossless: metadata.lossless,
|
||||||
container: metadata.format?.container,
|
container: metadata.container,
|
||||||
bitDepth: metadata.format?.bitsPerSample ?? 0,
|
bitDepth: metadata.bit_depth,
|
||||||
sampleRate: metadata.format?.sampleRate ?? 0,
|
sampleRate: metadata.sample_rate ?? 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let art = {
|
let art = {
|
||||||
id: "ciderlocal" + lochash,
|
id: "ciderlocal" + lochash,
|
||||||
_id: "ciderlocalart" + lochash,
|
_id: "ciderlocalart" + lochash,
|
||||||
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
url: metadata.artwork != undefined ? metadata.artwork : "",
|
||||||
}
|
}
|
||||||
metadatalistart.push(art)
|
metadatalistart.push(art)
|
||||||
numid += 1;
|
numid += 1;
|
||||||
|
@ -121,7 +117,7 @@ export class LocalFiles {
|
||||||
if (this.localSongs.length === 0 && numid % 10 === 0) { // send updated chunks only if there is no previous database
|
if (this.localSongs.length === 0 && numid % 10 === 0) { // send updated chunks only if there is no previous database
|
||||||
this.eventEmitter.emit('newtracks', metadatalist)}
|
this.eventEmitter.emit('newtracks', metadatalist)}
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) {console.error("error:", e)}
|
||||||
}
|
}
|
||||||
this.localSongs = metadatalist;
|
this.localSongs = metadatalist;
|
||||||
this.localSongsArts = metadatalistart;
|
this.localSongsArts = metadatalistart;
|
||||||
|
|
|
@ -12,6 +12,7 @@ const app = new Vue({
|
||||||
ipcRenderer: ipcRenderer,
|
ipcRenderer: ipcRenderer,
|
||||||
cfg: ipcRenderer.sendSync("getStore"),
|
cfg: ipcRenderer.sendSync("getStore"),
|
||||||
isDev: ipcRenderer.sendSync("is-dev"),
|
isDev: ipcRenderer.sendSync("is-dev"),
|
||||||
|
clientPort: ipcRenderer.sendSync("get-port"),
|
||||||
drawertest: false,
|
drawertest: false,
|
||||||
platform: "",
|
platform: "",
|
||||||
mk: {},
|
mk: {},
|
||||||
|
@ -3038,7 +3039,10 @@ const app = new Vue({
|
||||||
const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ?? '' : '');
|
const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ?? '' : '');
|
||||||
const artist = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName ?? '' : '');
|
const artist = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName ?? '' : '');
|
||||||
const time = encodeURIComponent((this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] ?? -1000) / 1000) ?? -1) : -1);
|
const time = encodeURIComponent((this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] ?? -1000) / 1000) ?? -1) : -1);
|
||||||
const id = encodeURIComponent((this.mk.nowPlayingItem != null) ? app.mk.nowPlayingItem._songId ?? (app.mk.nowPlayingItem["songId"] ?? '') : '');
|
let id = null;
|
||||||
|
if (this.mk.nowPlayingItem != null && app.mk.nowPlayingItem.localFilesMetadata != null) {const id = encodeURIComponent('')}
|
||||||
|
else {id = encodeURIComponent((this.mk.nowPlayingItem != null) ? (app.mk.nowPlayingItem._songId) ?? (app.mk.nowPlayingItem["songId"] ?? '') : '');}
|
||||||
|
|
||||||
let lrcfile = "";
|
let lrcfile = "";
|
||||||
let richsync = [];
|
let richsync = [];
|
||||||
const lang = app.cfg.lyrics.mxm_language // translation language
|
const lang = app.cfg.lyrics.mxm_language // translation language
|
||||||
|
@ -3046,67 +3050,13 @@ const app = new Vue({
|
||||||
return Math.random().toString(36).replace(/[^a-z]+/g, '').slice(2, 10);
|
return Math.random().toString(36).replace(/[^a-z]+/g, '').slice(2, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get token */
|
|
||||||
function getToken(mode, track, artist, songid, lang, time, id) {
|
|
||||||
if (attempt > 2) {
|
|
||||||
app.loadNeteaseLyrics();
|
|
||||||
// app.loadAMLyrics();
|
|
||||||
} else {
|
|
||||||
attempt = attempt + 1;
|
|
||||||
let url = "https://apic-desktop.musixmatch.com/ws/1.1/token.get?app_id=web-desktop-app-v1.0&t=" + revisedRandId();
|
|
||||||
let req = new XMLHttpRequest();
|
|
||||||
req.overrideMimeType("application/json");
|
|
||||||
req.open('GET', url, true);
|
|
||||||
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
|
||||||
req.onload = function () {
|
|
||||||
try {
|
|
||||||
let jsonResponse = JSON.parse(this.responseText);
|
|
||||||
let status2 = jsonResponse["message"]["header"]["status_code"];
|
|
||||||
if (status2 == 200) {
|
|
||||||
let token = jsonResponse["message"]["body"]["user_token"] ?? '';
|
|
||||||
if (token != "" && token != "UpgradeOnlyUpgradeOnlyUpgradeOnlyUpgradeOnly") {
|
|
||||||
console.debug('200 token', mode);
|
|
||||||
// token good
|
|
||||||
app.mxmtoken = token;
|
|
||||||
|
|
||||||
if (mode == 1) {
|
function getMXMSubs(track, artist, lang, time, id) {
|
||||||
getMXMSubs(track, artist, app.mxmtoken, lang, time, id);
|
let richsyncQuery = app.cfg.lyrics.mxm_karaoke
|
||||||
} else {
|
let itunesid = (id && id != "") ? id : ''; // Mode 1 -> Subs
|
||||||
getMXMTrans(songid, lang, app.mxmtoken);
|
let url = "https://api.cider.sh/v1/lyrics?" + "mode=1" + "&richsyncQuery=" + richsyncQuery + "&track=" + track + "&artist=" + artist + "&songID=" + itunesid + "&source=mxm" + "&lang=" + lang + "&time=" + time;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.debug('fake 200 token');
|
|
||||||
getToken(mode, track, artist, songid, lang, time)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// console.log('token 4xx');
|
|
||||||
getToken(mode, track, artist, songid, lang, time)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error');
|
|
||||||
app.loadQQLyrics();
|
|
||||||
//app.loadAMLyrics();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
req.onerror = function () {
|
|
||||||
console.log('error');
|
|
||||||
app.loadQQLyrics();
|
|
||||||
// app.loadAMLyrics();
|
|
||||||
};
|
|
||||||
req.send();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMXMSubs(track, artist, token, lang, time, id) {
|
|
||||||
let usertoken = encodeURIComponent(token);
|
|
||||||
let richsyncQuery = (app.cfg.lyrics.mxm_karaoke) ? "&optional_calls=track.richsync" : ""
|
|
||||||
let timecustom = (!time || (time && time < 0)) ? '' : `&f_subtitle_length=${time}&q_duration=${time}&f_subtitle_length_max_deviation=40`;
|
|
||||||
let itunesid = (id && id != "") ? `&track_itunes_id=${id}` : '';
|
|
||||||
let url = "https://apic-desktop.musixmatch.com/ws/1.1/macro.subtitles.get?format=json&namespace=lyrics_richsynched" + richsyncQuery + "&subtitle_format=lrc&q_artist=" + artist + "&q_track=" + track + itunesid + "&usertoken=" + usertoken + timecustom + "&app_id=web-desktop-app-v1.0&t=" + revisedRandId();
|
|
||||||
let req = new XMLHttpRequest();
|
let req = new XMLHttpRequest();
|
||||||
req.overrideMimeType("application/json");
|
req.overrideMimeType("application/json");
|
||||||
req.open('GET', url, true);
|
|
||||||
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
|
||||||
req.onload = function () {
|
req.onload = function () {
|
||||||
try {
|
try {
|
||||||
let jsonResponse = JSON.parse(this.responseText);
|
let jsonResponse = JSON.parse(this.responseText);
|
||||||
|
@ -3133,7 +3083,7 @@ const app = new Vue({
|
||||||
// app.loadAMLyrics()
|
// app.loadAMLyrics()
|
||||||
} else {
|
} else {
|
||||||
if (richsync == [] || richsync.length == 0) {
|
if (richsync == [] || richsync.length == 0) {
|
||||||
console.log("ok");
|
console.log("musixmatch worki");
|
||||||
// process lrcfile to json here
|
// process lrcfile to json here
|
||||||
app.lyricsMediaItem = lrcfile
|
app.lyricsMediaItem = lrcfile
|
||||||
let u = app.lyricsMediaItem.split(/[\r\n]/);
|
let u = app.lyricsMediaItem.split(/[\r\n]/);
|
||||||
|
@ -3176,7 +3126,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
if (lrcfile != null && lrcfile != '') {
|
if (lrcfile != null && lrcfile != '') {
|
||||||
// load translation
|
// load translation
|
||||||
getMXMTrans(id, lang, token);
|
getMXMTrans(id, lang);
|
||||||
} else {
|
} else {
|
||||||
// app.loadAMLyrics()
|
// app.loadAMLyrics()
|
||||||
app.loadQQLyrics();
|
app.loadQQLyrics();
|
||||||
|
@ -3187,11 +3137,9 @@ const app = new Vue({
|
||||||
app.loadQQLyrics();
|
app.loadQQLyrics();
|
||||||
// app.loadAMLyrics()
|
// app.loadAMLyrics()
|
||||||
}
|
}
|
||||||
} else { //4xx rejected
|
|
||||||
getToken(1, track, artist, '', lang, time);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.error(e);
|
||||||
app.loadQQLyrics();
|
app.loadQQLyrics();
|
||||||
//app.loadAMLyrics()
|
//app.loadAMLyrics()
|
||||||
}
|
}
|
||||||
|
@ -3201,23 +3149,22 @@ const app = new Vue({
|
||||||
console.log('error');
|
console.log('error');
|
||||||
// app.loadAMLyrics();
|
// app.loadAMLyrics();
|
||||||
};
|
};
|
||||||
|
req.open('POST', url, true);
|
||||||
req.send();
|
req.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMXMTrans(id, lang, token) {
|
function getMXMTrans(id, lang) {
|
||||||
if (lang != "disabled" && id != '') {
|
if (lang != "disabled" && id != '') { // Mode 2 -> Trans
|
||||||
let usertoken = encodeURIComponent(token);
|
let url2 = "https://api.cider.sh/v1/lyrics?" + "mode=2" + "&richsyncQuery=" + richsyncQuery + "&track=" + track + "&artist=" + artist + "&songID=" + itunesid + "&source=mxm" + "&lang=" + lang + "&time=" + time;
|
||||||
let url2 = "https://apic-desktop.musixmatch.com/ws/1.1/crowd.track.translations.get?translation_fields_set=minimal&selected_language=" + lang + "&track_id=" + id + "&comment_format=text&part=user&format=json&usertoken=" + usertoken + "&app_id=web-desktop-app-v1.0&t=" + revisedRandId();
|
|
||||||
let req2 = new XMLHttpRequest();
|
let req2 = new XMLHttpRequest();
|
||||||
req2.overrideMimeType("application/json");
|
req2.overrideMimeType("application/json");
|
||||||
req2.open('GET', url2, true);
|
req2.open('POST', url2, true);
|
||||||
req2.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
|
||||||
req2.onload = function () {
|
req2.onload = function () {
|
||||||
try {
|
try {
|
||||||
let jsonResponse2 = JSON.parse(this.responseText);
|
let jsonResponse2 = JSON.parse(this.responseText);
|
||||||
console.log(jsonResponse2);
|
console.log(jsonResponse2);
|
||||||
let status2 = jsonResponse2["message"]["header"]["status_code"];
|
let status2 = jsonResponse2["message"]["header"]["status_code"];
|
||||||
if (status2 == 200) {
|
if (status2 === 200) {
|
||||||
try {
|
try {
|
||||||
let preTrans = []
|
let preTrans = []
|
||||||
let u = app.lyrics;
|
let u = app.lyrics;
|
||||||
|
@ -3249,11 +3196,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track != "" & track != "No Title Found") {
|
if (track != "" & track != "No Title Found") {
|
||||||
if (app.mxmtoken != null && app.mxmtoken != '') {
|
getMXMSubs(track, artist, lang, time, id)
|
||||||
getMXMSubs(track, artist, app.mxmtoken, lang, time, id)
|
|
||||||
} else {
|
|
||||||
getToken(1, track, artist, '', lang, time);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadNeteaseLyrics() {
|
loadNeteaseLyrics() {
|
||||||
|
|
|
@ -686,17 +686,15 @@
|
||||||
<span>{{$root.getLz('settings.header.lyrics')}}</span>
|
<span>{{$root.getLz('settings.header.lyrics')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-option-body">
|
<div class="settings-option-body">
|
||||||
<div style="opacity: 0.5; pointer-events: none;">
|
<div class="md-option-line">
|
||||||
<div class="md-option-line">
|
<div class="md-option-segment">
|
||||||
<div class="md-option-segment">
|
{{$root.getLz('settings.option.lyrics.enableMusixmatch')}}
|
||||||
{{$root.getLz('settings.option.lyrics.enableMusixmatch')}}
|
</div>
|
||||||
</div>
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<label>
|
||||||
<label>
|
<input type="checkbox" switch checked />
|
||||||
<input type="checkbox" switch checked />
|
</label>
|
||||||
</label>
|
<!-- <input type="checkbox" v-model="app.cfg.lyrics.enable_mxm" switch /> -->
|
||||||
<!-- <input type="checkbox" v-model="app.cfg.lyrics.enable_mxm" switch /> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-line">
|
<div class="md-option-line">
|
||||||
|
|
|
@ -614,17 +614,15 @@
|
||||||
<span>{{$root.getLz('settings.header.lyrics')}}</span>
|
<span>{{$root.getLz('settings.header.lyrics')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-option-body">
|
<div class="settings-option-body">
|
||||||
<div style="opacity: 0.5; pointer-events: none;">
|
<div class="md-option-line">
|
||||||
<div class="md-option-line">
|
<div class="md-option-segment">
|
||||||
<div class="md-option-segment">
|
{{$root.getLz('settings.option.lyrics.enableMusixmatch')}}
|
||||||
{{$root.getLz('settings.option.lyrics.enableMusixmatch')}}
|
</div>
|
||||||
</div>
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<label>
|
||||||
<label>
|
<input type="checkbox" switch checked/>
|
||||||
<input type="checkbox" switch checked/>
|
</label>
|
||||||
</label>
|
<!-- <input type="checkbox" v-model="app.cfg.lyrics.enable_mxm" switch /> -->
|
||||||
<!-- <input type="checkbox" v-model="app.cfg.lyrics.enable_mxm" switch /> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-line">
|
<div class="md-option-line">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue