mediasnacks 0.3.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.
@@ -13,6 +13,8 @@ _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'
16
18
  )
17
19
 
18
20
  _mediasnacks() {
@@ -23,7 +25,7 @@ _mediasnacks() {
23
25
 
24
26
  local cmd="$words[2]"
25
27
  case "$cmd" in
26
- avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat)
28
+ avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat|dlaudio|dlvideo|unemoji|rmcover)
27
29
  _files
28
30
  ;;
29
31
  qdir)
package/README.md CHANGED
@@ -22,8 +22,12 @@ 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
28
+
29
+ - `unemoji`: Removes emojis from filenames
30
+ - `rmcover`: Removes cover art
27
31
 
28
32
  <br/>
29
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasnacks",
3
- "version": "0.3.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
@@ -22,6 +22,9 @@ const COMMANDS = {
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'],
25
28
  }
26
29
 
27
30
  const USAGE = `
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