@@ -14,7 +14,6 @@ import {
14
14
addAudioSourceToFrontmatter ,
15
15
addSummaryToNote ,
16
16
addTranscriptToNote ,
17
- createBaseFileName ,
18
17
createNewNote ,
19
18
renameFile ,
20
19
saveAudioRecording ,
@@ -31,6 +30,7 @@ import {
31
30
} from './util/mimeType' ;
32
31
import { extractMermaidChart } from './util/textUtil' ;
33
32
import { transcribeAudioWithAssemblyAi } from './util/assemblyAiUtil' ;
33
+ import { formatFilenamePrefix } from './util/filenameUtils' ;
34
34
35
35
export interface ScribeState {
36
36
isOpen : boolean ;
@@ -128,13 +128,15 @@ export default class ScribePlugin extends Plugin {
128
128
129
129
async scribe ( scribeOptions : ScribeOptions = { } ) {
130
130
try {
131
- const baseFileName = createBaseFileName ( ) ;
131
+ const baseFileName = formatFilenamePrefix (
132
+ this . settings . recordingFilenamePrefix ,
133
+ this . settings . dateFilenameFormat ,
134
+ ) ;
132
135
133
136
const { recordingBuffer, recordingFile } =
134
137
await this . handleStopAndSaveRecording ( baseFileName ) ;
135
138
136
139
await this . handleScribeFile ( {
137
- baseNoteAndAudioFileName : baseFileName ,
138
140
audioRecordingFile : recordingFile ,
139
141
audioRecordingBuffer : recordingBuffer ,
140
142
scribeOptions : scribeOptions ,
@@ -157,12 +159,10 @@ export default class ScribePlugin extends Plugin {
157
159
new Notice ( 'Scribe: ⚠️ This file type is not supported.' ) ;
158
160
return ;
159
161
}
160
- const baseFileName = createBaseFileName ( ) ;
161
162
162
163
const audioFileBuffer = await this . app . vault . readBinary ( audioFile ) ;
163
164
164
165
await this . handleScribeFile ( {
165
- baseNoteAndAudioFileName : baseFileName ,
166
166
audioRecordingFile : audioFile ,
167
167
audioRecordingBuffer : audioFileBuffer ,
168
168
} ) ;
@@ -227,18 +227,19 @@ export default class ScribePlugin extends Plugin {
227
227
}
228
228
229
229
async handleScribeFile ( {
230
- baseNoteAndAudioFileName,
231
230
audioRecordingFile,
232
231
audioRecordingBuffer,
233
232
scribeOptions = { } ,
234
233
} : {
235
- baseNoteAndAudioFileName : string ;
236
234
audioRecordingFile : TFile ;
237
235
audioRecordingBuffer : ArrayBuffer ;
238
236
scribeOptions ?: ScribeOptions ;
239
237
} ) {
240
238
const { isAppendToActiveFile, isOnlyTranscribeActive } = scribeOptions ;
241
- const scribeNoteFilename = `scribe-${ baseNoteAndAudioFileName } ` ;
239
+ const scribeNoteFilename = `${ formatFilenamePrefix (
240
+ this . settings . noteFilenamePrefix ,
241
+ this . settings . dateFilenameFormat ,
242
+ ) } `;
242
243
243
244
let note = isAppendToActiveFile
244
245
? this . app . workspace . getActiveFile ( )
@@ -271,7 +272,11 @@ export default class ScribePlugin extends Plugin {
271
272
272
273
const shouldRenameNote = ! isAppendToActiveFile ;
273
274
if ( shouldRenameNote ) {
274
- const llmFileName = `scribe-${ moment ( ) . format ( 'YYYY-MM-DD' ) } -${ normalizePath ( llmSummary . title ) } ` ;
275
+ const llmFileName = `${ formatFilenamePrefix (
276
+ this . settings . noteFilenamePrefix ,
277
+ this . settings . dateFilenameFormat ,
278
+ ) } ${ normalizePath ( llmSummary . title ) } `;
279
+
275
280
await renameFile ( this , note , llmFileName ) ;
276
281
}
277
282
}
@@ -298,7 +303,9 @@ export default class ScribePlugin extends Plugin {
298
303
return transcript ;
299
304
} catch ( error ) {
300
305
new Notice (
301
- `Scribe: 🎧 🛑 Something went wrong trying to Transcribe w/ ${ this . settings . transcriptPlatform }
306
+ `Scribe: 🎧 🛑 Something went wrong trying to Transcribe w/ ${
307
+ this . settings . transcriptPlatform
308
+ }
302
309
${ error . toString ( ) } ` ,
303
310
) ;
304
311
0 commit comments