mediasnacks 0.3.0 → 0.5.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/.zsh/completions/_mediasnacks +4 -1
- package/README.md +6 -1
- package/package.json +1 -1
- package/src/avif.js +2 -0
- package/src/cli.js +9 -10
- package/src/curltime.sh +14 -0
- package/src/dropdups.js +2 -0
- package/src/hev1tohvc1.js +2 -0
- package/src/moov2front.js +3 -1
- package/src/qdir.js +2 -0
- package/src/resize.js +2 -0
- package/src/rmcover.sh +8 -0
- package/src/seqcheck.js +2 -0
- package/src/unemoji.sh +26 -0
|
@@ -13,6 +13,9 @@ _mediasnacks_commands=(
|
|
|
13
13
|
'vconcat:Concatenates videos',
|
|
14
14
|
'dlaudio: yt-dlp best audio',
|
|
15
15
|
'dlvideo: yt-dlp best video',
|
|
16
|
+
'unemoji:Removes emojis from filenames'
|
|
17
|
+
'rmcover:Removes cover art'
|
|
18
|
+
'curltime:Measures request response timings'
|
|
16
19
|
)
|
|
17
20
|
|
|
18
21
|
_mediasnacks() {
|
|
@@ -23,7 +26,7 @@ _mediasnacks() {
|
|
|
23
26
|
|
|
24
27
|
local cmd="$words[2]"
|
|
25
28
|
case "$cmd" in
|
|
26
|
-
avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat)
|
|
29
|
+
avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat|dlaudio|dlvideo|unemoji|rmcover|curltime)
|
|
27
30
|
_files
|
|
28
31
|
;;
|
|
29
32
|
qdir)
|
package/README.md
CHANGED
|
@@ -22,9 +22,14 @@ Commands:
|
|
|
22
22
|
- `framediff`: Plays a video of adjacent frames diff
|
|
23
23
|
- `videodiff`: Plays a video with the difference of two videos
|
|
24
24
|
- `vconcat`: Concatenates videos
|
|
25
|
+
|
|
25
26
|
- `dlaudio`: yt-dlp best audio
|
|
26
27
|
- `dlvideo`: yt-dlp best video
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
- `unemoji`: Removes emojis from filenames
|
|
30
|
+
- `rmcover`: Removes cover art
|
|
31
|
+
|
|
32
|
+
- `curltime`: Measures request response timings
|
|
28
33
|
<br/>
|
|
29
34
|
|
|
30
35
|
### Converting Images to AVIF
|
package/package.json
CHANGED
package/src/avif.js
CHANGED
package/src/cli.js
CHANGED
|
@@ -17,11 +17,16 @@ const COMMANDS = {
|
|
|
17
17
|
|
|
18
18
|
framediff: ['framediff.sh', 'Plays a video of adjacent frames diff'],
|
|
19
19
|
videodiff: ['videodiff.sh', 'Plays a video with the difference of two videos'],
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
vconcat: ['vconcat.sh', 'Concatenates videos'],
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
dlaudio: ['dlaudio.sh', 'yt-dlp best audio'],
|
|
24
24
|
dlvideo: ['dlvideo.sh', 'yt-dlp best video'],
|
|
25
|
+
|
|
26
|
+
unemoji: ['unemoji.sh', 'Removes emojis from filenames'],
|
|
27
|
+
rmcover: ['rmcover.sh', 'Removes cover art'],
|
|
28
|
+
|
|
29
|
+
curltime: ['curltime.sh', 'Measures request response timings'],
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
const USAGE = `
|
|
@@ -39,7 +44,6 @@ if (opt === '-v' || opt === '--version') {
|
|
|
39
44
|
console.log(pkgJSON.version)
|
|
40
45
|
process.exit(0)
|
|
41
46
|
}
|
|
42
|
-
|
|
43
47
|
if (opt === '-h' || opt === '--help') {
|
|
44
48
|
console.log(USAGE)
|
|
45
49
|
process.exit(0)
|
|
@@ -49,16 +53,11 @@ if (!opt) {
|
|
|
49
53
|
console.log(USAGE)
|
|
50
54
|
process.exit(1)
|
|
51
55
|
}
|
|
52
|
-
|
|
53
56
|
if (!Object.hasOwn(COMMANDS, opt)) {
|
|
54
57
|
console.error(`'${opt}' is not a command. See npx mediasnacks --help\n`)
|
|
55
58
|
process.exit(1)
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
const cmd = join(import.meta.dirname, COMMANDS[opt][0])
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
isShellScript ? cmd : process.execPath,
|
|
62
|
-
isShellScript ? args : [cmd, ...args],
|
|
63
|
-
{ stdio: 'inherit' }
|
|
64
|
-
).on('exit', process.exit)
|
|
62
|
+
spawn(cmd, args, { stdio: 'inherit' })
|
|
63
|
+
.on('exit', process.exit)
|
package/src/curltime.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# https://stackoverflow.com/a/47944496
|
|
4
|
+
|
|
5
|
+
curl -so /dev/null -w "\
|
|
6
|
+
DNS Lookup %{time_namelookup}
|
|
7
|
+
TCP Handshake %{time_connect}
|
|
8
|
+
TLS Handshake %{time_appconnect}
|
|
9
|
+
Wait %{time_pretransfer}
|
|
10
|
+
Redirect %{time_redirect}
|
|
11
|
+
First Byte %{time_starttransfer}
|
|
12
|
+
───────────────────────
|
|
13
|
+
TOTAL %{time_total}
|
|
14
|
+
" "$@"
|
package/src/dropdups.js
CHANGED
package/src/hev1tohvc1.js
CHANGED
package/src/moov2front.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
1
3
|
import { parseArgs } from 'node:util'
|
|
2
4
|
import { unlink, rename } from 'node:fs/promises'
|
|
3
5
|
|
|
@@ -20,7 +22,7 @@ async function main() {
|
|
|
20
22
|
throw new Error(USAGE)
|
|
21
23
|
|
|
22
24
|
await assertUserHasFFmpeg()
|
|
23
|
-
console.log('Optimizing
|
|
25
|
+
console.log('Optimizing video for progressive download…')
|
|
24
26
|
|
|
25
27
|
for (const g of positionals)
|
|
26
28
|
for (const file of await glob(g))
|
package/src/qdir.js
CHANGED
package/src/resize.js
CHANGED
package/src/rmcover.sh
ADDED
package/src/seqcheck.js
CHANGED
package/src/unemoji.sh
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Removes emoji's from filenames
|
|
4
|
+
|
|
5
|
+
find . -depth | while IFS= read -r file; do
|
|
6
|
+
dir=$(dirname "$file")
|
|
7
|
+
base=$(basename "$file")
|
|
8
|
+
|
|
9
|
+
# Remove emojis using Perl's Unicode-aware regex
|
|
10
|
+
newbase=$(printf '%s' "$base" | perl -CSD -pe '
|
|
11
|
+
s/[\x{1F600}-\x{1F64F}]//g; # Emoticons
|
|
12
|
+
s/[\x{1F300}-\x{1F5FF}]//g; # Misc Symbols and Pictographs
|
|
13
|
+
s/[\x{1F680}-\x{1F6FF}]//g; # Transport and Map
|
|
14
|
+
s/[\x{2600}-\x{26FF}]//g; # Misc symbols
|
|
15
|
+
s/[\x{2700}-\x{27BF}]//g; # Dingbats
|
|
16
|
+
s/[\x{1F900}-\x{1F9FF}]//g; # Supplemental Symbols and Pictographs
|
|
17
|
+
s/[\x{1FA70}-\x{1FAFF}]//g; # Symbols and Pictographs Extended-A
|
|
18
|
+
s/[\x{1F1E6}-\x{1F1FF}]//g; # Regional Indicator Symbols
|
|
19
|
+
')
|
|
20
|
+
|
|
21
|
+
if [ "$base" != "$newbase" ]; then
|
|
22
|
+
newpath="$dir/$newbase"
|
|
23
|
+
echo "Renaming: $file -> $newpath"
|
|
24
|
+
mv -n "$file" "$newpath"
|
|
25
|
+
fi
|
|
26
|
+
done
|