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

View File

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