diff --git a/manifest.json b/manifest.json index 645157d..183a99c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "sonicnote-sync", "name": "SonicNote Sync", - "version": "1.0.0", + "version": "1.1.0", "minAppVersion": "0.15.0", "description": "Sync recordings from SonicNote to Obsidian as Markdown files", "author": "EasyLinkIn", diff --git a/package.json b/package.json index e33087a..31ea199 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sonicnote-sync", - "version": "1.0.0", + "version": "1.1.0", "description": "Sync recordings from SonicNote to Obsidian as Markdown files", "main": "main.js", "scripts": { diff --git a/release/obsidian-plugin.html b/release/obsidian-plugin.html index 86db441..4cac3a0 100644 --- a/release/obsidian-plugin.html +++ b/release/obsidian-plugin.html @@ -133,10 +133,10 @@
-
v1.0.0
+
v1.1.0

SonicNote Sync

将 SonicNote 妙记的录音、转录、总结同步到 Obsidian,以 Markdown 文件管理。

- + 下载插件 @@ -144,6 +144,18 @@
+
+

更新记录

+

v1.1.0

+
    +
  • 修复录音进行中重复创建文件的问题
  • +
  • AI 总结移至转录内容之前,优先阅读
  • +
  • 新增"包含转录内容"开关,可按需关闭
  • +
  • 文件名去除日期前缀,直接使用录音原始名称
  • +
  • 切换为 HTTPS 接口
  • +
+
+

前置要求

    @@ -155,7 +167,7 @@

    安装

      -
    1. 点击上方按钮下载 sonicnote-sync.zip
    2. +
    3. 点击上方按钮下载 sonicnote-sync-v1.1.0.zip
    4. 解压 zip 文件,得到以下文件:
      • main.js
      • @@ -204,8 +216,8 @@ Frontmatter录音元数据(ID、时间、时长、设备名、标签等) 笔记你在 App 中手写的笔记内容 - 转录内容AI 转写文本(含说话人、时间戳) AI 总结智能总结内容(要点、行动项等) + 转录内容AI 转写文本(含说话人、时间戳,可在设置中关闭)
    @@ -216,6 +228,7 @@ 设置默认值说明 同步文件夹SonicNoteSyncMarkdown 文件存放目录 + 包含转录内容开启关闭后同步文件中不包含逐字转录
diff --git a/release/sonicnote-sync-v1.1.0.zip b/release/sonicnote-sync-v1.1.0.zip new file mode 100644 index 0000000..9cf9285 Binary files /dev/null and b/release/sonicnote-sync-v1.1.0.zip differ diff --git a/release/sonicnote-sync.zip b/release/sonicnote-sync.zip deleted file mode 100644 index 903b12b..0000000 Binary files a/release/sonicnote-sync.zip and /dev/null differ diff --git a/src/formatter.ts b/src/formatter.ts index 8101b8a..22242c9 100644 --- a/src/formatter.ts +++ b/src/formatter.ts @@ -11,10 +11,7 @@ export function sanitizeFileName(name: string): string { export function formatFileName(recording: Recording): string { const displayName = recording.recordNickName || recording.recordName || '未命名录音'; - const date = recording.recordTime - ? recording.recordTime.substring(0, 10) - : new Date().toISOString().substring(0, 10); - return `${date}-${sanitizeFileName(displayName)}`; + return sanitizeFileName(displayName); } function formatDuration(seconds: string | number): string { @@ -96,6 +93,14 @@ export function toMarkdown( parts.push(''); } + // Summary section (before transcript) + if (summary && summary.summaryContent) { + parts.push('## AI 总结'); + parts.push(''); + parts.push(summary.summaryContent.trim()); + parts.push(''); + } + // Transcript section if (transcript && transcript.length > 0) { parts.push('## 转录内容'); @@ -104,13 +109,5 @@ export function toMarkdown( parts.push(''); } - // Summary section - if (summary && summary.summaryContent) { - parts.push('## AI 总结'); - parts.push(''); - parts.push(summary.summaryContent.trim()); - parts.push(''); - } - return parts.join('\n'); } diff --git a/src/settings.ts b/src/settings.ts index d625f74..102cd68 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -39,6 +39,17 @@ export class SonicNoteSettingTab extends PluginSettingTab { await this.saveSettings(); })); + // Include transcript + new Setting(containerEl) + .setName('包含转录内容') + .setDesc('关闭后同步的文件中不包含逐字转录内容') + .addToggle(toggle => toggle + .setValue(settings.includeTranscript) + .onChange(async (value) => { + settings.includeTranscript = value; + await this.saveSettings(); + })); + // Login status & actions const loginSection = containerEl.createDiv(); loginSection.createEl('h3', { text: '账号' }); diff --git a/src/sync.ts b/src/sync.ts index 5c9356b..49d6bda 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -116,20 +116,20 @@ export class SyncService { private async processRecording(recording: Recording, localIndex: Map, settings: SonicNotePluginSettings): Promise { const syncTime = new Date().toISOString(); - // Check if we need to update const local = localIndex.get(recording.audioId); - if (local && local.syncTime && recording.updateTime) { - if (recording.updateTime <= local.syncTime) { - // No update needed + + // Found existing file for this audioId — update it + if (local && local.path) { + // Skip if no update needed (has updateTime and it's older than syncTime) + if (local.syncTime && recording.updateTime && recording.updateTime <= local.syncTime) { return; } - // Check for conflict (user edited file locally after sync) const file = this.app.vault.getAbstractFileByPath(local.path); if (file instanceof TFile) { + // Check for conflict (user edited file locally after sync) const fileMtime = new Date(file.stat.mtime).toISOString(); - if (fileMtime > local.syncTime) { - // Conflict — write to a new file instead + if (local.syncTime && fileMtime > local.syncTime) { await this.writeRecordingToNewFile(recording, syncTime, settings, local.path); return; } @@ -172,11 +172,12 @@ export class SyncService { } private async buildRecordingContent(recording: Recording, syncTime: string): Promise { + const settings = this.getSettings(); const tasks: [string, Promise][] = []; - // Fetch transcript if available (status 2 = completed) + // Fetch transcript if enabled and available (status 2 = completed) let transcript: TranscriptSegment[] | null = null; - if (recording.transcriptStatus === 2) { + if (settings.includeTranscript && recording.transcriptStatus === 2) { tasks.push(['transcript', this.api.fetchTranscriptResult(recording.audioId).catch(() => null)]); } diff --git a/src/types.ts b/src/types.ts index bd4e727..4035b32 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,6 +4,7 @@ export interface SonicNotePluginSettings { serverUrl: string; syncFolder: string; pageSize: number; + includeTranscript: boolean; token: string; phoneNumber: string; lastSyncTime: string; @@ -13,6 +14,7 @@ export const DEFAULT_SETTINGS: SonicNotePluginSettings = { serverUrl: 'https://ainote.easylinkin.com:18048/prod-api', syncFolder: 'SonicNoteSync', pageSize: 50, + includeTranscript: true, token: '', phoneNumber: '', lastSyncTime: '', diff --git a/versions.json b/versions.json index af9a39e..4cf9870 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,4 @@ { - "1.0.0": "0.15.0" + "1.0.0": "0.15.0", + "1.1.0": "0.15.0" }