summaryrefslogtreecommitdiff
path: root/lcl-edit
diff options
context:
space:
mode:
Diffstat (limited to 'lcl-edit')
-rwxr-xr-xlcl-edit293
1 files changed, 113 insertions, 180 deletions
diff --git a/lcl-edit b/lcl-edit
index 5757625..16b3937 100755
--- a/lcl-edit
+++ b/lcl-edit
@@ -1,180 +1,113 @@
-#! /bin/bash
-
-source ./util/menu/deasy-core
-source ./util/notify
-source ./util/dpath
-
-run() {
- cd "$HOME/Desktop"
- filepath="$(find -L "$DPATH" \
- . \
- -type f | dmenu -b \
- -i \
- -l 25 \
- -p 'Search File:' \
- -nb '#ffffff' \
- -nf '#000080' \
- -sb '#000080' \
- -sf '#ffffff')"
- [ -f "$filepath" ] || exit 0
-
- CHOICES=('[Video]Strip' \
- '[Video]Transcode' \
- '[Video]Scale' \
- '[Video]Clip' \
- '[Video]Extract-Chapters' \
- '[Video]Insert-Chapters' \
- '[Video]Split-Chapters' \
- '[Image]Strip' \
- '[Image]Convert' \
- '[Image]Resize'
- '[Image]Trim' \
- '[Image]Border-Radius')
-
- [ ! -z "$1" ] && selected="$1" \
- || selected="$(echo "${CHOICES[@]}" | tr ' ' '\n' \
- | dmenu -i \
- -l 20 \
- -p 'Select Edit:' \
- -nb '#ffffff' \
- -nf '#000080' \
- -sb '#000080' \
- -sf '#ffffff')"
-
- basedir="$(dirname "$filepath")";
- filename="$(basename "$filepath")"
- savepath="$DPATH/$filename"
- basename="${filename%.*}"
-
- case "$selected" in
- "${CHOICES[0]}")
- ffmpeg -n \
- -sn \
- -i "$filepath" \
- -map_metadata -1 \
- -map_chapters -1 \
- -c:v copy \
- -c:a copy \
- "$DPATH/[STRIP] $filename"
- ;;
-
- "${CHOICES[1]}")
- fileext="$(deasy_core 'File Extension (mp3)')"
- [ -z "$fileext" ] && exit 0
-
- ffmpeg -n -i "$filepath" "${savepath%.*}.$fileext"
- ;;
-
- "${CHOICES[2]}")
- scale="$(deasy_core 'Scale (854:480)')"
- [ -z "$scale" ] && exit 0
-
- ffmpeg -y \
- -i "$filepath" \
- -vf scale="$scale" \
- "$DPATH/[$scale] $filename"
- ;;
-
- "${CHOICES[3]}")
- from="$(deasy_core 'From (00:00/n)')"
- [ -z "$from" ] && exit 0
-
- to="$(deasy_core 'To (00:00/n)')"
- [ -z "$to" ] && exit 0
-
- ffmpeg -y \
- -ss "$from" \
- -to "$to" \
- -i "$filepath" \
- "$DPATH/[CLIP] $filename"
- ;;
-
- "${CHOICES[4]}")
- ffmpeg -n \
- -i "$filepath" \
- -f ffmetadata \
- "$DPATH/[CHAPTERS] $basename"
- ;;
-
- "${CHOICES[5]}")
- chapterpath="$(deasy_core 'Chapter Filepath')"
- [ -z "$chapterpath" ] && exit 0
-
- ffmpeg -n \
- -i "$filepath" \
- -i "$chapterpath" \
- -map_metadata 1 \
- -codec copy \
- "$DPATH/[WITH-CHAPTERS] $filename"
- ;;
-
- "${CHOICES[6]}")
- mkdir -p "$DPATH/$basename"
- ffprobe -print_format csv \
- -show_chapters \
- "$filepath" \
- | cut -d ',' -f '5,7,8' \
- | while IFS=, read start end chapter
- do
- ffmpeg -n \
- -nostdin \
- -i "$filepath" \
- -ss "$start" \
- -to "$end" \
- -c copy \
- -map 0 \
- -map_chapters -1 \
- "$DPATH/$basename/$chapter.${filepath##*.}"
- done
- ;;
-
- "${CHOICES[7]}")
- cp "$filepath" "$DPATH/[STRIP] $filename"
- exiftool -overwrite_original -all= "$DPATH/[STRIP] $filename"
- ;;
-
- "${CHOICES[8]}")
- fileext="$(deasy_core 'File Extension (png)')"
- [ -z "$fileext" ] && exit 0
-
- convert "$filepath" "${savepath%.*}.$fileext"
- ;;
-
- "${CHOICES[9]}")
- size="$(deasy_core 'Size (75x75)')"
- [ -z "$size" ] && exit 0
-
- convert "$filepath" -resize "$size" "$DPATH/[$size] $filename"
- ;;
-
- "${CHOICES[10]}")
- convert "$filepath" -trim "$DPATH/[TRIM] $filename"
- ;;
-
- "${CHOICES[11]}")
- n="$(deasy_core 'Border Radius (n)')"
- [ -z "$n" ] && exit 0
-
- convert "$filepath" \
- \( +clone -alpha extract \
- -draw "fill black polygon 0,0 0,$n $n,0 fill white circle $n,$n $n,0" \
- \( +clone -flip \) -compose Multiply -composite \
- \( +clone -flop \) -compose Multiply -composite \
- \) -alpha off -compose CopyOpacity -composite "$DPATH/[RADIUS] $filename"
- ;;
-
- '')
- exit 0
- ;;
-
- *)
- notify 'Invalid Entry'
- ;;
- esac
-}
-
-run "$@"; status=$?
-
-[ ! $status -eq 0 ] && [ ! $status -eq 143 ] \
- && notify 'Something Went Wrong'
-
+#! /bin/zsh
+
+filepath="$(find ~/Archive -type d \( -name node_modules -o -name .git \) -prune -o \
+ -type f -name '*' -print | dmenu -i -l 15 -p 'Search File')"
+[ ! -f "$filepath" ] && exit 1
+
+CHOICES=('[Video]Strip' \
+ '[Video]Transcode' \
+ '[Video]Scale' \
+ '[Video]Clip' \
+ '[Video]Extract-Chapters' \
+ '[Video]Insert-Chapters' \
+ '[Video]Split-Chapters' \
+ '[Image]Strip' \
+ '[Image]Convert' \
+ '[Image]Resize'
+ '[Image]Trim' \
+ '[Image]Border-Radius')
+
+[ ! -z "$1" ] && selected="$1" \
+ || selected="$(echo "${CHOICES[@]}" | tr ' ' '\n' \
+ | dmenu -i -l 15 -p 'Select Edit')"
+
+filename="$(basename "$filepath")"
+
+case "$selected" in
+ "${CHOICES[1]}")
+ ffmpeg -n \
+ -sn \
+ -i "$filepath" \
+ -map_metadata -1 \
+ -map_chapters -1 \
+ -c:v copy \
+ -c:a copy \
+ "$HOME/[STRIP] $filename" ;;
+ "${CHOICES[2]}")
+ fileext="$(print | dmenu -p 'File Extension (mp3)')"
+ [ ! -z "$fileext" ] && ffmpeg -n \
+ -i "$filepath" \
+ "${filepath%.*}.$fileext" ;;
+ "${CHOICES[3]}")
+ scale="$(print | dmenu -p 'Scale (854:480)')"
+ [ ! -z "$scale" ] && ffmpeg -y \
+ -i "$filepath" \
+ -vf scale="$scale" \
+ "$HOME/[$scale] $filename" ;;
+ "${CHOICES[4]}")
+ from="$(print | dmenu -p 'From (00:00/n)')"
+ [ -z "$from" ] && exit 0
+
+ to="$(print | dmenu -p 'To (00:00/n)')"
+ [ -z "$to" ] && exit 0
+
+ ffmpeg -y \
+ -ss "$from" \
+ -to "$to" \
+ -i "$filepath" \
+ "$HOME/[CLIP] $filename" ;;
+ "${CHOICES[5]}")
+ ffmpeg -n \
+ -i "$filepath" \
+ -f ffmetadata \
+ "$HOME/[CHAPTERS] ${filename%.*}" ;;
+ "${CHOICES[6]}")
+ chapterpath="$(print | dmenu -p 'Chapter Filepath')"
+ [ -z "$chapterpath" ] && exit 0
+
+ ffmpeg -n \
+ -i "$filepath" \
+ -i "$chapterpath" \
+ -map_metadata 1 \
+ -codec copy \
+ "$HOME/[WITH-CHAPTERS] $filename" ;;
+ "${CHOICES[7]}")
+ mkdir -p "$HOME/${filename%.*}"
+ ffprobe -print_format csv \
+ -show_chapters \
+ "$filepath" \
+ | cut -d ',' -f '5,7,8' \
+ | while IFS=, read start end chapter
+ do
+ ffmpeg -n \
+ -nostdin \
+ -i "$filepath" \
+ -ss "$start" \
+ -to "$end" \
+ -c copy \
+ -map 0 \
+ -map_chapters -1 \
+ "$HOME/${filename%.*}/$chapter.${filepath##*.}"
+ done ;;
+ "${CHOICES[8]}")
+ cp "$filepath" "$HOME/[STRIP] $filename"
+ exiftool -overwrite_original -all= "$HOME/[STRIP] $filename" ;;
+ "${CHOICES[9]}")
+ fileext="$(print | dmenu -p 'File Extension (png)')"
+ [ ! -z "$fileext" ] && convert "$filepath" "$HOME/${filename%.*}.$fileext" ;;
+ "${CHOICES[10]}")
+ size="$(print | dmenu -p 'Size (75x75)')"
+ [ ! -z "$size" ] && convert "$filepath" -resize "$size" "$HOME/[$size] $filename" ;;
+ "${CHOICES[11]}")
+ convert "$filepath" -trim "$HOME/[TRIM] $filename" ;;
+ "${CHOICES[12]}")
+ n="$(print | dmenu -p 'Border Radius (n)')"
+ [ ! -z "$n" ] && convert "$filepath" \
+ \( +clone -alpha extract \
+ -draw "fill black polygon 0,0 0,$n $n,0 fill white circle $n,$n $n,0" \
+ \( +clone -flip \) -compose Multiply -composite \
+ \( +clone -flop \) -compose Multiply -composite \
+ \) -alpha off -compose CopyOpacity -composite "$HOME/[RADIUS] $filename" ;;
+ '') exit 0 ;;
+ *) exit 1 ;;
+esac