jibon57 / bbb-recorder

BigBlueButton recorder using puppeteer to export as webm or mp4 file & Live RTMP broadcasting
MIT License
260 stars 135 forks source link

Don't hardcode download directory location #92

Open burrscurr opened 3 years ago

burrscurr commented 3 years ago

Background

My downloads folder is not the default ~/Downloads, but (for reasons of personal preference) ~/personal/downloads. This customization is possible by setting XDG user directories (here: XDG_DOWNLOAD_DIR).

Problem

bbb-recorder assumes that files get downloaded to ~/Downloads (line in code). However, Chrome honors XDG_DOWNLOAD_DIR and does not download the file to the location expected by bbb-recorder. Therefore, running node export.js <bbb url> any.web 10 causes an error:

{ Error: ENOENT: no such file or directory, copyfile '/home/<user>/Downloads/any.webm' -> '<target path omitted>'
    at Object.copyFileSync (fs.js:1728:3)
    at copyOnly (<path omitted>/bbb-recorder/export.js:227:12)
    at main (<path omitted>/bbb-recorder/export.js:145:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  errno: -2,
  syscall: 'copyfile',
  code: 'ENOENT',
  path: '/home/<user>/Downloads/any.webm',
  dest: '<target path omitted>' }

(the omitted target path does exist and is writable)

Proposed Solution

bbb-recorder should look for downloaded recordings at the path chrome downloads them. Since chrome honors XDG customizations, bbb-recorder should also.

Maybe folder/xdg could be used for this.