summaryrefslogtreecommitdiff
path: root/lcl-edit
diff options
context:
space:
mode:
authorLM-LCL <hello@exaltedelite.club>2023-04-19 21:23:42 +0200
committerLM-LCL <hello@exaltedelite.club>2023-04-19 21:23:42 +0200
commitb98f0f496b6739749257804297468fb71845a776 (patch)
tree44096c59211f1d877515914273cde862fbf47c1f /lcl-edit
EZown
Diffstat (limited to 'lcl-edit')
-rwxr-xr-xlcl-edit180
1 files changed, 180 insertions, 0 deletions
diff --git a/lcl-edit b/lcl-edit
new file mode 100755
index 0000000..5757625
--- /dev/null
+++ b/lcl-edit
@@ -0,0 +1,180 @@
+#! /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'
+