Skip to content

Commit

Permalink
perf: 💄 Normalize control window titles and generated file names
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Oct 31, 2024
1 parent 952b2a7 commit ccc7f0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
}
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/store/device/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
}

Expand Down

0 comments on commit ccc7f0e

Please sign in to comment.