dsh-reminder-notify 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -37,7 +37,7 @@ window.__ModuleLoader__.load({
37
37
  doneAudio: '完成(done)提示音文件',
38
38
  decideAudio: '需要决定(decide)提示音文件',
39
39
  rawAudio: '通用(raw)提示音文件',
40
- audioHint: '填文件名,在下面的提示音目录里找;留空表示静音。',
40
+ audioHint: '填文件名(wav / mp3,ogg 取决于系统解码器),在下面的提示音目录里找;留空表示静音。',
41
41
  audioDir: '提示音目录',
42
42
  audioDirHint: '留空 = 用插件自带的 assets/提示音导入/。',
43
43
  accentDone: '完成强调色',
@@ -84,7 +84,7 @@ window.__ModuleLoader__.load({
84
84
  doneAudio: 'Done sound file',
85
85
  decideAudio: 'Decide sound file',
86
86
  rawAudio: 'Raw sound file',
87
- audioHint: 'A file name resolved inside the sound directory; empty means silent.',
87
+ audioHint: 'A file name resolved inside the sound directory (wav / mp3; ogg depends on system codecs); empty means silent.',
88
88
  audioDir: 'Sound directory',
89
89
  audioDirHint: 'Empty uses the bundled assets/提示音导入/.',
90
90
  accentDone: 'Done accent',
@@ -245,14 +245,26 @@ $form.Add_Click({
245
245
  })
246
246
 
247
247
  # ---- 声音(异步,窗口先出) -------------------------------------------------
248
+ # wav 用 SoundPlayer(零依赖、异步);其余格式(mp3/wma…)走 Windows Media Player COM。
249
+ # ogg 是否可播取决于系统是否装了对应解码器,播不了只记日志、不影响弹卡。
248
250
  $script:player = $null
251
+ $script:wmp = $null
249
252
  if (-not $NoSound -and -not [string]::IsNullOrEmpty($Audio) -and (Test-Path -LiteralPath $Audio)) {
253
+ $ext = [System.IO.Path]::GetExtension($Audio).ToLowerInvariant()
250
254
  try {
251
- $script:player = New-Object System.Media.SoundPlayer $Audio
252
- $script:player.Play()
253
- Write-Log ('audio ' + $Audio)
255
+ if ($ext -eq '.wav') {
256
+ $script:player = New-Object System.Media.SoundPlayer $Audio
257
+ $script:player.Play()
258
+ Write-Log ('audio wav ' + $Audio)
259
+ } else {
260
+ $script:wmp = New-Object -ComObject WMPlayer.OCX
261
+ $script:wmp.settings.volume = 100
262
+ $script:wmp.URL = $Audio
263
+ $script:wmp.controls.play()
264
+ Write-Log ('audio media ' + $ext + ' ' + $Audio)
265
+ }
254
266
  } catch {
255
- Write-Log ('audio-failed ' + $_.Exception.Message)
267
+ Write-Log ('audio-failed ' + $ext + ' ' + $_.Exception.Message)
256
268
  }
257
269
  }
258
270
 
@@ -264,6 +276,10 @@ $timer.Start()
264
276
  [System.Windows.Forms.Application]::Run()
265
277
 
266
278
  if ($script:player -ne $null) { $script:player.Dispose() }
279
+ if ($script:wmp -ne $null) {
280
+ try { $script:wmp.controls.stop(); $script:wmp.close() } catch { }
281
+ try { [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($script:wmp) } catch { }
282
+ }
267
283
  $titleFont.Dispose()
268
284
  $bodyFont.Dispose()
269
285
  $hintFont.Dispose()
package/index.js CHANGED
@@ -35,9 +35,9 @@ export const Config = z === null ? undefined : z.object({
35
35
  seconds: z.number().min(2).max(600).step(1).default(60).description('弹窗停留秒数(2–600)'),
36
36
  position: z.union(['br', 'center', 'tr']).default('br').description('弹窗位置:br 右下、center 居中、tr 右上'),
37
37
  sound: z.boolean().default(true).description('是否播放提示音'),
38
- doneAudio: z.string().default('完成提醒语音.wav').description('done 档位的提示音文件名(在提示音目录下)'),
39
- decideAudio: z.string().default('需要你来决定.wav').description('decide 档位的提示音文件名'),
40
- rawAudio: z.string().default('').description('raw 档位的提示音文件名,留空 = 静音'),
38
+ doneAudio: z.string().default('完成提醒语音.wav').description('done 档位的提示音文件名(wav / mp3,在提示音目录下)'),
39
+ decideAudio: z.string().default('需要你来决定.wav').description('decide 档位的提示音文件名(wav / mp3)'),
40
+ rawAudio: z.string().default('').description('raw 档位的提示音文件名(wav / mp3),留空 = 静音'),
41
41
  accentDone: z.string().default('#2ECC71').description('done 档位卡片强调色(#RRGGBB)'),
42
42
  accentDecide: z.string().default('#F5A623').description('decide 档位卡片强调色'),
43
43
  accentRaw: z.string().default('#4C8DFF').description('raw 档位卡片强调色'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reminder-notify",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "DSH 桌面提醒插件:把「完成/需要决定」提醒变成 notify_user 工具(浮动卡片 + 提示音,不抢焦点,纯 PowerShell 源码宿主,仓库零 exe)",
5
5
  "author": "Jiangshuaiye1203",
6
6
  "type": "module",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "versions": [
50
50
  {
51
- "version": "0.3.0",
52
- "publishTimestamp": 1795058390,
51
+ "version": "0.3.1",
52
+ "publishTimestamp": 1795061779,
53
53
  "source": {
54
54
  "type": "npm"
55
55
  },