mediasnacks 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/vtrim.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { resolve, parse } from 'node:path'
2
2
  import { parseOptions } from './utils/parseOptions.js'
3
- import { ffmpeg, assertUserHasFFmpeg } from './utils/subprocess.js'
3
+ import { ffmpeg } from './utils/subprocess.js'
4
4
 
5
5
 
6
6
  const HELP = `
7
7
  SYNOPSIS
8
- mediasnacks vtrim [--start <time>] [--end <time>] <videos>
8
+ mediasnacks vtrim [options] <videos>
9
9
 
10
10
  DESCRIPTION
11
11
  Trims a video without re-encoding (fast, but approximate cuts).
@@ -16,25 +16,17 @@ OPTIONS
16
16
 
17
17
  SEE ALSO
18
18
  mediasnacks vsplit
19
- `.trim()
19
+ `
20
20
 
21
21
 
22
22
  export default async function main() {
23
- await assertUserHasFFmpeg()
24
-
25
- const { values, files } = await parseOptions({
26
- start: { short: 's', type: 'string', default: '' },
27
- end: { short: 'e', type: 'string', default: '' },
28
- help: { short: 'h', type: 'boolean' }
23
+ const { values, files } = await parseOptions(HELP, {
24
+ start: { short: 's', type: 'string' },
25
+ end: { short: 'e', type: 'string' },
29
26
  })
30
27
 
31
- if (values.help) {
32
- console.log(HELP)
33
- return
34
- }
35
-
36
28
  if (!files.length)
37
- throw new Error('No video specified. See mediasnacks vtrim --help')
29
+ throw 'No video specified.'
38
30
 
39
31
  for (const file of files)
40
32
  await vtrim({
package/src/gif.sh DELETED
@@ -1,44 +0,0 @@
1
- #!/bin/sh
2
-
3
- FPS=10
4
- WIDTH=600
5
-
6
- help() {
7
- /bin/cat << EOF
8
- SYNOPSIS
9
- mediasnacks gif [--fps <number>] [-w | --width <pixels>] <file>
10
-
11
- DESCRIPTION
12
- Converts video to GIF
13
-
14
- OPTIONS
15
- --fps Default: $FPS
16
- -w,--width Default: $WIDTH
17
- EOF
18
- exit "${1:-0}"
19
- }
20
-
21
- while [ $# -gt 0 ]; do
22
- case "$1" in
23
- --fps)
24
- FPS="$2";
25
- shift 2 ;;
26
-
27
- --width|-w)
28
- WIDTH="$2"
29
- shift 2 ;;
30
-
31
- --help|-h)
32
- help ;;
33
-
34
- *)
35
- file="$1"
36
- shift ;;
37
- esac
38
- done
39
-
40
- [ -z "$file" ] && help 1
41
-
42
- ffmpeg -v error -i "$file" \
43
- -vf "fps=${FPS},scale=${WIDTH}:-1" \
44
- "${file%.*}.gif"