Skip to content

Commit 53b697f

Browse files
Merge branch 'dev' into dev-feat
2 parents 7ae4ae7 + 6e9992a commit 53b697f

14 files changed

Lines changed: 127 additions & 127 deletions

File tree

components.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ declare module 'vue' {
3939
FullPlayer: typeof import('./src/components/Player/FullPlayer.vue')['default']
4040
FullPlayerMobile: typeof import('./src/components/Player/FullPlayerMobile.vue')['default']
4141
FullscreenPlayerManager: typeof import('./src/components/Modal/Setting/FullscreenPlayerManager.vue')['default']
42-
GlobalErrorHandler: typeof import('./src/components/Global/GlobalErrorHandler.vue')['default']
4342
HomePageSectionManager: typeof import('./src/components/Modal/Setting/HomePageSectionManager.vue')['default']
4443
JumpArtist: typeof import('./src/components/Modal/JumpArtist.vue')['default']
4544
ListComment: typeof import('./src/components/List/ListComment.vue')['default']

electron/main/ipc/ipc-file.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { SongMetadata } from "@native/tools";
12
import { app, BrowserWindow, dialog, ipcMain, shell } from "electron";
23
import FastGlob from "fast-glob";
34
import type { Options as GlobOptions } from "fast-glob/out/settings";
@@ -12,30 +13,8 @@ import { useStore } from "../store";
1213
import { getFileID, getFileMD5, metaDataLyricsArrayToLrc } from "../utils/helper";
1314
import { loadNativeModule } from "../utils/native-loader";
1415

15-
interface SongMetadata {
16-
title: string;
17-
artist: string;
18-
album: string;
19-
coverUrl?: string;
20-
lyric?: string;
21-
description?: string;
22-
}
23-
24-
interface ToolsModule {
25-
downloadFile(
26-
id: number,
27-
url: string,
28-
filePath: string,
29-
metadata: SongMetadata | undefined | null,
30-
threadCount: number,
31-
referer: string | undefined | null,
32-
onProgress: (err: any, progressJson: string) => void,
33-
): Promise<void>;
34-
cancelDownload(id: number): void;
35-
writeMusicMetadata(filePath: string, metadata: SongMetadata, coverPath?: string): Promise<void>;
36-
}
37-
38-
const tools = loadNativeModule("tools.node", "tools") as ToolsModule;
16+
type toolModule = typeof import("@native/tools");
17+
const tools: toolModule = loadNativeModule("tools.node", "tools");
3918

4019
interface DownloadProgress {
4120
percent: number;

electron/main/services/MusicCacheService.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
import { existsSync } from "fs";
2-
import { unlink, rename, stat } from "fs/promises";
3-
import { CacheService } from "./CacheService";
2+
import { rename, stat, unlink } from "fs/promises";
43
import { cacheLog } from "../logger";
54
import { loadNativeModule } from "../utils/native-loader";
5+
import { CacheService } from "./CacheService";
66

7-
interface ToolsModule {
8-
downloadFile(
9-
id: number,
10-
url: string,
11-
filePath: string,
12-
metadata: any,
13-
threadCount: number,
14-
onProgress: (err: any, progressJson: string) => void
15-
): Promise<void>;
16-
}
17-
18-
const tools = loadNativeModule("tools.node", "tools") as ToolsModule;
7+
type toolModule = typeof import("@native/tools");
8+
const tools: toolModule = loadNativeModule("tools.node", "tools");
199

2010
export class MusicCacheService {
2111
private static instance: MusicCacheService;
@@ -102,14 +92,14 @@ export class MusicCacheService {
10292
// 使用 Rust 下载器
10393
// 这里的 id 仅用于进度或取消,缓存下载暂时传入 0 或尝试转换
10494
const numericId = typeof id === "number" ? id : 0;
105-
95+
10696
await tools.downloadFile(
107-
numericId,
108-
url,
109-
tempPath,
97+
numericId,
98+
url,
99+
tempPath,
110100
null, // No metadata for cache
111-
4, // Thread count
112-
() => {} // No progress callback needed for cache currently
101+
4, // Thread count
102+
() => {}, // No progress callback needed for cache currently
113103
);
114104

115105
// 检查临时文件是否存在

native/tools/src/lib.rs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1-
#[cfg(target_os = "linux")]
2-
mod linux;
3-
#[cfg(target_os = "macos")]
4-
mod macos;
5-
#[cfg(target_os = "windows")]
6-
mod windows;
7-
mod download;
1+
//! 适用于 `SPlayer` 的工具原生模块
2+
//!
3+
//! 你可以在这里添加代码量不那么多的单个功能,如果代码量非常多,请新开一个原生模块
4+
//!
5+
//! 注意:若使用了针对特点平台的条件编译,必须在这里重新导出一个在全平台下可用的函数,
6+
//! 即使它在其他平台是空操作以防止 JS 端在其他平台编译时找不到对应的函数声明
87
8+
mod download;
99
mod scanner;
1010

11+
pub use download::*;
12+
use napi_derive::napi;
1113
pub use scanner::scan_music_library;
1214
#[cfg(target_os = "windows")]
13-
pub use windows::get_taskbar_created_message_id;
15+
use windows::{
16+
core::w,
17+
Win32::UI::WindowsAndMessaging::RegisterWindowMessageW,
18+
};
1419

15-
pub use download::*;
20+
#[napi]
21+
pub fn get_taskbar_created_message_id() -> u32 {
22+
#[cfg(target_os = "windows")]
23+
{
24+
unsafe { RegisterWindowMessageW(w!("TaskbarCreated")) }
25+
}
26+
27+
#[cfg(not(target_os = "windows"))]
28+
{
29+
0
30+
}
31+
}

native/tools/src/linux.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

native/tools/src/macos.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

native/tools/src/scanner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use std::{
1515

1616
use anyhow::Result;
1717
use crossbeam_channel::{
18-
Receiver,
1918
bounded,
19+
Receiver,
2020
};
2121
use jwalk::WalkDir;
2222
use lofty::{

native/tools/src/windows.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/assets/data/lyricConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const config: LyricConfig = {
1616
textBackgroundMask: false,
1717
backgroundMaskColor: "rgba(0, 0, 0, 0.5)",
1818
alwaysShowPlayInfo: false,
19+
animation: true,
1920
};
2021

2122
export default config;

src/components/Setting/config/lyric.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,19 @@ export const useLyricSettings = (): SettingConfig => {
637637
},
638638
}),
639639
},
640+
{
641+
key: "desktopLyricAnimation",
642+
label: "歌词切换动画",
643+
type: "switch",
644+
description: "开启后歌词切换时会有动画过渡效果",
645+
value: computed({
646+
get: () => desktopLyricConfig.animation,
647+
set: (v) => {
648+
desktopLyricConfig.animation = v;
649+
saveDesktopLyricConfig();
650+
},
651+
}),
652+
},
640653
{
641654
key: "desktopLyricFontWeight",
642655
label: "文字字重",

0 commit comments

Comments
 (0)