perf: 💄 Normalize control window titles and generated file names

This commit is contained in:
viarotel 2024-10-31 16:37:11 +08:00
parent 952b2a7250
commit ccc7f0e734
2 changed files with 5 additions and 7 deletions

View File

@ -11,16 +11,19 @@ const recordModel = {
excludes: [],
commands: [],
extname: config => config['--record-format'] || 'mp4',
label: 'Recording',
},
audio: {
excludes: ['--video-source', '--no-audio', '--mouse'],
commands: ['--no-video', '--mouse=disabled'],
extname: config => config['--audio-record-format'] || 'opus',
label: 'RecordingAudio',
},
camera: {
excludes: ['--video-source', '--turn-screen-off', '--show-touches', '--no-power-on', '--stay-awake', '--power-off-on-close'],
commands: ['--video-source=camera'],
extname: config => config['--record-format'] || 'mp4',
label: 'RecordingCamera',
},
}
@ -81,7 +84,7 @@ export default {
try {
const recording = this.$scrcpy.record(row.id, {
title: this.$store.device.getLabel(row, 'recording'),
title: this.$store.device.getLabel(row, ({ appName, deviceName }) => `${appName}${this.activeModel.label}-${deviceName}`),
savePath,
args,
})
@ -114,10 +117,7 @@ export default {
const extension = this.activeModel.extname(deviceConfig)
const fileName = `${this.$store.device.getLabel(
row,
'recorded',
)}.${extension}`
const fileName = this.$store.device.getLabel(row, ({ currentTime, deviceName }) => `${this.activeModel.label}-${deviceName}-${currentTime}.${extension}`)
const filePath = this.$path.join(savePath, fileName)

View File

@ -49,14 +49,12 @@ export const useDeviceStore = defineStore({
'mirror',
'camera',
'custom',
'recording',
'synergy',
]
.reduce((obj, type) => {
obj[type] = createPreset(type)
return obj
}, {}),
recorded: `Record-${deviceName}-${currentTime}`,
screenshot: `Screenshot-${deviceName}-${currentTime}`,
}