mediasnacks 0.2.0 → 0.4.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.
@@ -10,7 +10,11 @@ _mediasnacks_commands=(
10
10
  'hev1tohvc1:Fixes video thumbnails not rendering in macOS Finder'
11
11
  'framediff:ffplay with a filter for diffing adjacent frames'
12
12
  'videodiff:Plays a video with the difference of two videos'
13
- 'vconcat:Concatenates videos'
13
+ 'vconcat:Concatenates videos',
14
+ 'dlaudio: yt-dlp best audio',
15
+ 'dlvideo: yt-dlp best video',
16
+ 'unemoji:Removes emojis from filenames'
17
+ 'rmcover:Removes cover art'
14
18
  )
15
19
 
16
20
  _mediasnacks() {
@@ -21,7 +25,7 @@ _mediasnacks() {
21
25
 
22
26
  local cmd="$words[2]"
23
27
  case "$cmd" in
24
- avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat)
28
+ avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat|dlaudio|dlvideo|unemoji|rmcover)
25
29
  _files
26
30
  ;;
27
31
  qdir)
package/README.md CHANGED
@@ -21,8 +21,14 @@ Commands:
21
21
 
22
22
  - `framediff`: Plays a video of adjacent frames diff
23
23
  - `videodiff`: Plays a video with the difference of two videos
24
- -
25
24
  - `vconcat`: Concatenates videos
25
+
26
+ - `dlaudio`: yt-dlp best audio
27
+ - `dlvideo`: yt-dlp best video
28
+
29
+ - `unemoji`: Removes emojis from filenames
30
+ - `rmcover`: Removes cover art
31
+
26
32
  <br/>
27
33
 
28
34
  ### Converting Images to AVIF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasnacks",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Utilities for preparing videos, images, and audio for the web",
5
5
  "license": "MIT",
6
6
  "author": "Eric Fortis",
package/src/cli.js CHANGED
@@ -19,6 +19,12 @@ const COMMANDS = {
19
19
  videodiff: ['videodiff.sh', 'Plays a video with the difference of two videos'],
20
20
 
21
21
  vconcat: ['vconcat.sh', 'Concatenates videos'],
22
+
23
+ dlaudio: ['dlaudio.sh', 'yt-dlp best audio'],
24
+ dlvideo: ['dlvideo.sh', 'yt-dlp best video'],
25
+
26
+ unemoji: ['unemoji.sh', 'Removes emojis from filenames'],
27
+ rmcover: ['rmcover.sh', 'Removes cover art'],
22
28
  }
23
29
 
24
30
  const USAGE = `
package/src/dlaudio.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ yt-dlp -o '%(title)s.%(ext)s' \
4
+ -f 'bestaudio[ext=m4a]/bestaudio' "$1"
package/src/dlvideo.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ yt-dlp -o '%(title)s.%(ext)s' \
4
+ -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' "$1"
package/src/rmcover.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+
3
+ file="$1"
4
+
5
+ tmp="_no_cover_$file"
6
+ ffmpeg -v error -i "$file" -vn -c:a copy "$tmp"
7
+ mv "$file" "$file.bak"
8
+ mv "$tmp" "$file"
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