From 07d8051731151d482ad05192125adb902e1b6e4c Mon Sep 17 00:00:00 2001 From: liph Date: Wed, 25 Feb 2026 10:26:28 +0100 Subject: [PATCH] updated scripts (added podman-update.sh) --- aerc/.config/aerc/accounts.conf | 20 +++--- aerc/.config/aerc/aerc.conf | 3 +- aerc/.config/aerc/binds.conf | 8 +-- niri/.config/niri/config.kdl | 15 +++-- scripts/scripts/a.out | 0 scripts/scripts/aria.sh | 91 ++++++++++++++++++++++++++ scripts/scripts/extraudio.sh | 107 +++++++++++++++++++++++++++++++ scripts/scripts/m3u8.sh | 17 +++++ scripts/scripts/move-trash_1.sh | 22 +++++++ scripts/scripts/nonum.sh | 37 +++++++++++ scripts/scripts/nothumb.sh | 47 ++++++++++++++ scripts/scripts/podman-update.sh | 62 ++++++++++++++++++ scripts/scripts/pve_chmod.sh | 15 +++++ scripts/scripts/retag.sh | 76 ++++++++++++++++++++++ scripts/scripts/split.sh | 105 ++++++++++++++++++++++++++++++ scripts/scripts/sync-mail_1.sh | 13 ++++ scripts/scripts/thumb.sh | 76 ++++++++++++++++++++++ scripts/scripts/yazi-picker.sh | 11 ++++ 18 files changed, 703 insertions(+), 22 deletions(-) delete mode 100644 scripts/scripts/a.out create mode 100755 scripts/scripts/aria.sh create mode 100755 scripts/scripts/extraudio.sh create mode 100755 scripts/scripts/m3u8.sh create mode 100755 scripts/scripts/move-trash_1.sh create mode 100755 scripts/scripts/nonum.sh create mode 100755 scripts/scripts/nothumb.sh create mode 100755 scripts/scripts/podman-update.sh create mode 100755 scripts/scripts/pve_chmod.sh create mode 100755 scripts/scripts/retag.sh create mode 100755 scripts/scripts/split.sh create mode 100755 scripts/scripts/sync-mail_1.sh create mode 100755 scripts/scripts/thumb.sh create mode 100755 scripts/scripts/yazi-picker.sh diff --git a/aerc/.config/aerc/accounts.conf b/aerc/.config/aerc/accounts.conf index aaee9e3..d82df4a 100644 --- a/aerc/.config/aerc/accounts.conf +++ b/aerc/.config/aerc/accounts.conf @@ -41,13 +41,13 @@ aliases = blue@liphlink.xyz,red@liphlink.xyz # default = Inbox # aliases = blue@liphlink.xyz,red@liphlink.xyz -# [proton] -# source = imap+insecure://liiph%40protonmail.com:dRvBWYW3uERY6xqXDgJLeQ@127.0.0.1:1144 -# outgoing = smtp+insecure://liiph%40protonmail.com:dRvBWYW3uERY6xqXDgJLeQ@127.0.0.1:1026 -# default = INBOX -# from = Liph -# copy-to = Sent -# archive = Archive -# postpone = Drafts -# folders-sort = INBOX,Drafts,Sent,Archive,Spam,Trash -# aliases = liiph@proton.me,liiph@pm.me,ph.waibel@proton.me,ph.waibel@pm.me +[proton] + source = imap+insecure://liiph%40protonmail.com:YF37rs63oirevVIs-mq0tg@127.0.0.1:1143 + outgoing = smtp+insecure://liiph%40protonmail.com:YF37rs63oirevVIs-mq0tg@127.0.0.1:1025 + default = INBOX + from = Liph + copy-to = Sent + archive = Archive + postpone = Drafts + folders-sort = INBOX,Drafts,Sent,Archive,Spam,Trash + aliases = liiph@proton.me,liiph@pm.me,ph.waibel@proton.me,ph.waibel@pm.me diff --git a/aerc/.config/aerc/aerc.conf b/aerc/.config/aerc/aerc.conf index d9c8bcc..aa66415 100644 --- a/aerc/.config/aerc/aerc.conf +++ b/aerc/.config/aerc/aerc.conf @@ -96,7 +96,8 @@ index-format=notmuch://~/.local/share/mail # # Default: flags:4,name<20%,subject,date>= #index-columns=flags:4,name<20%,subject,date>= -border-char-vertical=" " +# border-char-vertical="┃" +border-char-vertical="│" border-char-horizontal="─" styleset-name="gruvbox-dark" diff --git a/aerc/.config/aerc/binds.conf b/aerc/.config/aerc/binds.conf index 6bda7d2..65f1c3e 100644 --- a/aerc/.config/aerc/binds.conf +++ b/aerc/.config/aerc/binds.conf @@ -16,10 +16,10 @@ [messages] # Switch between Adresses ,1 = :change-tab phil_live -,2 = :change-tab phil_notmuch -,3 = :change-tab spam_live -,4 = :change-tab spam_notmuch -,5 = :change-tab proton +# ,2 = :change-tab phil_notmuch +,2 = :change-tab spam_live +# ,4 = :change-tab spam_notmuch +,3 = :change-tab proton # d = :modify -inbox +deleted # a = :modify -inbox diff --git a/niri/.config/niri/config.kdl b/niri/.config/niri/config.kdl index b1f214e..16fac99 100644 --- a/niri/.config/niri/config.kdl +++ b/niri/.config/niri/config.kdl @@ -83,6 +83,7 @@ spawn-at-startup "swww-daemon" spawn-at-startup "xwayland-satellite" spawn-at-startup "gammastep" "-l" "47.38:8.54" "-t" "6000:4000" spawn-at-startup "kitty" +spawn-at-startup "kanshi" spawn-at-startup "librewolf" spawn-at-startup "sh" "-c" "sleep 5 && exec swayidle -w timeout 300 hyprlock timeout 600 'niri msg action power-off-monitors' resume 'niri msg action power-on-monitors' timeout 3600 'systemctl suspend'" prefer-no-csd @@ -104,13 +105,13 @@ match app-id=r#"^org\.keepassxc\.KeePassXC$"# match app-id=r#"^org\.gnome\.World\.Secrets$"# block-out-from "screen-capture" } -window-rule { - match app-id="Bitwarden" - default-column-width { - proportion 0.6667 - } - open-floating true -} +// window-rule { +// match app-id="Bitwarden" +// default-column-width { +// proportion 0.6667 +// } +// open-floating true +// } // terminal window-rule window-rule { match app-id="Zoom Workplace" diff --git a/scripts/scripts/a.out b/scripts/scripts/a.out deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/scripts/aria.sh b/scripts/scripts/aria.sh new file mode 100755 index 0000000..ee597fe --- /dev/null +++ b/scripts/scripts/aria.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# Fast Aria2 Download Script +# Usage: ./aria2-download.sh [output-filename] + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Check if aria2c is installed +if ! command -v aria2c &> /dev/null; then + echo -e "${RED}aria2c is not installed!${NC}" + echo "Installing aria2..." + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + if command -v apt-get &> /dev/null; then + sudo apt-get update && sudo apt-get install -y aria2 + elif command -v yum &> /dev/null; then + sudo yum install -y aria2 + elif command -v pacman &> /dev/null; then + sudo pacman -S aria2 + else + echo -e "${RED}Please install aria2 manually${NC}" + exit 1 + fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + if command -v brew &> /dev/null; then + brew install aria2 + else + echo -e "${RED}Please install Homebrew or aria2 manually${NC}" + exit 1 + fi + else + echo -e "${RED}Unsupported OS. Please install aria2 manually${NC}" + exit 1 + fi +fi + +# Check if URL is provided +if [ -z "$1" ]; then + echo -e "${RED}Error: No URL provided${NC}" + echo "Usage: $0 [output-filename]" + exit 1 +fi + +URL="$1" +OUTPUT_FILE="$2" + +# Build aria2c command with optimized settings +ARIA2_CMD="aria2c \ + --max-connection-per-server=16 \ + --split=16 \ + --min-split-size=1M \ + --max-concurrent-downloads=16 \ + --continue=true \ + --max-tries=5 \ + --retry-wait=3 \ + --timeout=60 \ + --connect-timeout=30 \ + --file-allocation=none \ + --summary-interval=0 \ + --console-log-level=notice" + +# Add output filename if provided +if [ -n "$OUTPUT_FILE" ]; then + ARIA2_CMD="$ARIA2_CMD --out=\"$OUTPUT_FILE\"" +fi + +# Add URL +ARIA2_CMD="$ARIA2_CMD \"$URL\"" + +echo -e "${GREEN}Starting download...${NC}" +echo -e "${YELLOW}URL: $URL${NC}" +if [ -n "$OUTPUT_FILE" ]; then + echo -e "${YELLOW}Output: $OUTPUT_FILE${NC}" +fi +echo "" + +# Execute download +eval $ARIA2_CMD + +if [ $? -eq 0 ]; then + echo -e "\n${GREEN}✓ Download completed successfully!${NC}" +else + echo -e "\n${RED}✗ Download failed!${NC}" + exit 1 +fi diff --git a/scripts/scripts/extraudio.sh b/scripts/scripts/extraudio.sh new file mode 100755 index 0000000..6f25661 --- /dev/null +++ b/scripts/scripts/extraudio.sh @@ -0,0 +1,107 @@ +#!/bin/bash + +# Ask where to place the MP3 files +read -p "Place MP3s in same folder as MP4s? (y/n) [y]: " same_folder +same_folder=${same_folder:-y} + +if [[ "$same_folder" =~ ^[Nn]$ ]]; then + read -p "Enter output folder path: " output_folder + mkdir -p "$output_folder" +else + output_folder="" +fi + +# Get default values from folder structure +# Current directory is "The Energies of Love" +default_album=$(basename "$PWD") +# Parent directory is "Donna Eden & David Feinstein" +default_album_artist=$(basename "$(dirname "$PWD")") + +# Prompt for metadata with defaults +read -p "Enter Album Artist [$default_album_artist]: " album_artist +album_artist=${album_artist:-$default_album_artist} + +read -p "Enter Release Date (YYYY): " release_date + +echo "" +echo "Processing MP4 files..." +echo "Album Artist: $album_artist" +echo "" + +counter=0 + +# Process all mp4 files in subdirectories +for file in */*.mp4 *.mp4; do + # Skip if file doesn't exist + [ -e "$file" ] || continue + + dir=$(dirname "$file") + filename=$(basename "$file" .mp4) + + # Determine album based on folder structure + if [ "$dir" != "." ]; then + # File is in subfolder (Intro, week1, week2, etc.) + album=$(basename "$dir") + else + # File is in current directory + album="$default_album" + fi + + # Set output location + if [ -n "$output_folder" ]; then + # Create matching folder structure in output folder + if [ "$dir" != "." ]; then + mkdir -p "$output_folder/$dir" + output="$output_folder/$dir/${filename}.mp3" + else + output="$output_folder/${filename}.mp3" + fi + else + output="$dir/${filename}.mp3" + fi + + # Skip if already exists + if [ -f "$output" ]; then + echo "Skip: $filename (exists)" + continue + fi + + # Get track number + track_num=$(echo "$filename" | grep -oP '^\d+') + + echo "Converting: $filename" + echo " Album: $album" + + # Convert using temp file + temp_file="/tmp/convert_$$.mp3" + + if [ -n "$track_num" ]; then + ffmpeg -i "$file" -vn -acodec libmp3lame -q:a 0 \ + -metadata title="$filename" \ + -metadata track="$track_num" \ + -metadata album_artist="$album_artist" \ + -metadata artist="$album_artist" \ + -metadata album="$album" \ + -metadata date="$release_date" \ + "$temp_file" -y >/dev/null 2>&1 + else + ffmpeg -i "$file" -vn -acodec libmp3lame -q:a 0 \ + -metadata title="$filename" \ + -metadata album_artist="$album_artist" \ + -metadata artist="$album_artist" \ + -metadata album="$album" \ + -metadata date="$release_date" \ + "$temp_file" -y >/dev/null 2>&1 + fi + + if [ -f "$temp_file" ]; then + mv "$temp_file" "$output" + echo " ✓ Done" + ((counter++)) + else + echo " ✗ Failed" + fi +done + +echo "" +echo "Converted $counter files" diff --git a/scripts/scripts/m3u8.sh b/scripts/scripts/m3u8.sh new file mode 100755 index 0000000..ec879c5 --- /dev/null +++ b/scripts/scripts/m3u8.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Ask for the final filename first +echo "=== Video Downloader (yt-dlp + aria2c) ===" +read -p "Enter the final filename (without extension): " filename + +# Then ask for the m3u8 URL +read -p "Enter the m3u8 URL: " url + +# Download using yt-dlp with aria2c +echo "Starting download..." +yt-dlp --external-downloader aria2c \ + --external-downloader-args "aria2c:-x 16 -s 16" \ + -o "${filename}.%(ext)s" \ + "$url" + +echo "Download complete: ${filename}.mp4" diff --git a/scripts/scripts/move-trash_1.sh b/scripts/scripts/move-trash_1.sh new file mode 100755 index 0000000..b3c4bde --- /dev/null +++ b/scripts/scripts/move-trash_1.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Read the message file path from aerc +while read -r filepath; do + # Get the base mail directory + maildir="$HOME/.local/share/mail" + + # Extract the filename + filename=$(basename "$filepath") + + # Create Trash/cur if it doesn't exist + mkdir -p "$maildir/Trash/cur" + + # Move the file to Trash + if [[ -f "$filepath" ]]; then + mv "$filepath" "$maildir/Trash/cur/$filename" + echo "Moved to Trash: $filename" >&2 + fi +done + +# Re-index with notmuch +notmuch new >/dev/null 2>&1 diff --git a/scripts/scripts/nonum.sh b/scripts/scripts/nonum.sh new file mode 100755 index 0000000..8cdb7df --- /dev/null +++ b/scripts/scripts/nonum.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +echo "Removing numbers from filenames and titles (keeping track numbers)..." +echo "" + +for file in *.mp3; do + filename="${file%.*}" + + # Extract track number before removing it from filename + track_num=$(echo "$filename" | grep -oP '^\d+') + + # Remove leading numbers and dot/space from filename + new_filename=$(echo "$filename" | sed 's/^[0-9]\+[. ]\+//') + new_file="${new_filename}.mp3" + + if [ "$file" != "$new_file" ]; then + echo "Processing: $file" + echo " New filename: $new_file" + echo " New title: $new_filename" + echo " Track number: $track_num (kept)" + + # Retag with new title (without number) but keep track number + ffmpeg -i "$file" -c copy \ + -metadata title="$new_filename" \ + -metadata track="$track_num" \ + "${new_filename}_temp.mp3" 2>/dev/null + + # Remove original and rename temp file + rm "$file" + mv "${new_filename}_temp.mp3" "$new_file" + + echo " ✓ Done" + echo "" + fi +done + +echo "Complete! All files processed." diff --git a/scripts/scripts/nothumb.sh b/scripts/scripts/nothumb.sh new file mode 100755 index 0000000..7d052ee --- /dev/null +++ b/scripts/scripts/nothumb.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +echo "Removing thumbnails and associated CDs from MP3 files..." +echo "" + +counter=0 + +# Process all mp3 files +for file in *.mp3 */*.mp3 */*/*.mp3; do + # Skip if file doesn't exist + [ -e "$file" ] || continue + + filename=$(basename "$file") + + echo "Processing: $file" + + # Create temp file + temp_file="/tmp/strip_${counter}_$$.mp3" + + # Remove all images/artwork and strip video streams + ffmpeg -i "$file" \ + -map 0:a \ + -c copy \ + -map_metadata 0 \ + -id3v2_version 3 \ + -vn \ + "$temp_file" -y >/dev/null 2>&1 + + if [ -f "$temp_file" ] && [ -s "$temp_file" ]; then + # Remove disc number metadata using eyeD3 if available + if command -v eyeD3 &> /dev/null; then + eyeD3 --remove-images \ + --disc-num "" \ + "$temp_file" >/dev/null 2>&1 + fi + + mv "$temp_file" "$file" + echo " ✓ Done" + ((counter++)) + else + echo " ✗ Failed" + [ -f "$temp_file" ] && rm "$temp_file" + fi +done + +echo "" +echo "Processed $counter files" diff --git a/scripts/scripts/podman-update.sh b/scripts/scripts/podman-update.sh new file mode 100755 index 0000000..3e5c685 --- /dev/null +++ b/scripts/scripts/podman-update.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# 1. Configuration: List the folder names you wish to EXCLUDE from updates. +# Separate names with a space. Example: EXCLUDED_FOLDERS=("ai-stack" "testing") +EXCLUDED_FOLDERS=("ai","dns-adguard","dns-pihole","immich") + +# 2. Set the base directory to the current location where the script is run. +# This assumes you place the script inside your /podman folder. +BASE_DIR="." + +echo "========================================" +echo "Starting Podman Update Script" +echo "Current Directory: $(pwd)" +echo "Excluded Folders: ${EXCLUDED_FOLDERS[*]}" +echo "========================================" + +# 3. Loop through all directories in the base directory +for dir in "$BASE_DIR"/*/; do + # Extract just the folder name (e.g., /podman/essential/ -> "essential") + folder_name=$(basename "$dir") + + # Check if this folder is in the exclusion list + # [[ " ${array[@]} " =~ " ${value} " ]] is a bash pattern matching trick + if [[ " ${EXCLUDED_FOLDERS[@]} " =~ " ${folder_name} " ]]; then + echo "[SKIPPING] Excluded folder found: $folder_name" + continue + fi + + # Check if docker-compose.yml exists in this folder + if [ -f "$dir/docker-compose.yml" ]; then + echo "" + echo "[PROCESSING] Updating stack in: $folder_name" + + # Change directory to the folder containing the compose file + cd "$dir" || { + echo "Error: Could not enter $dir" + continue + } + + # Pull the latest images + echo " -> Pulling latest images..." + podman-compose pull + + # Force recreate and restart containers + # -d: Detached mode (run in background) + # --force-recreate: Stops and recreates containers even if config hasn't changed + echo " -> Force restarting services..." + podman-compose up -d --force-recreate + + # Return to the original base directory + cd "$BASE_DIR" || exit + + echo "[FINISHED] $folder_name updated." + else + # Optional: Silence this if you have many non-compose folders + echo "[IGNORE] No docker-compose.yml found in $folder_name" + fi +done + +echo "========================================" +echo "All tasks completed." +echo "========================================" diff --git a/scripts/scripts/pve_chmod.sh b/scripts/scripts/pve_chmod.sh new file mode 100755 index 0000000..34d56bc --- /dev/null +++ b/scripts/scripts/pve_chmod.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +sudo chown -R 101000:100033 /mnt/{hdd1,hdd2,hdd3,hdd4,hdd5,ssd1,ssd2} + +sudo chmod -R 775 /mnt/{hdd1,hdd2,hdd3,hdd4,hdd5,ssd1,ssd2} + +sudo chown -R 101000:101000 /mnt/tank/audio +sudo chmod -R 777 /mnt/tank/audio + +sudo chown -R 101000:101000 /mnt/flash1/downloads/music +sudo chmod -R 755 /mnt/flash1/downloads/music + +sudo chown -R 101000:100033 /mnt/ssd2/cloud_phil /mnt/flash1/podman/browser/data/.consume +sudo chmod -R 775 /mnt/ssd2/cloud_phil /mnt/flash1/podman/browser/data/.consume + diff --git a/scripts/scripts/retag.sh b/scripts/scripts/retag.sh new file mode 100755 index 0000000..2033863 --- /dev/null +++ b/scripts/scripts/retag.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# Get metadata from first mp3 file if it exists +first_file=$(ls *.mp3 2>/dev/null | head -n 1) + +if [ -n "$first_file" ]; then + default_artist=$(ffprobe -v quiet -show_entries format_tags=artist -of default=noprint_wrappers=1:nokey=1 "$first_file") + default_album=$(ffprobe -v quiet -show_entries format_tags=album -of default=noprint_wrappers=1:nokey=1 "$first_file") + default_date=$(ffprobe -v quiet -show_entries format_tags=date -of default=noprint_wrappers=1:nokey=1 "$first_file") + default_composer=$(ffprobe -v quiet -show_entries format_tags=composer -of default=noprint_wrappers=1:nokey=1 "$first_file") +fi + +# Prompt with defaults +read -p "Enter Album Artist [$default_artist]: " album_artist +album_artist=${album_artist:-$default_artist} + +read -p "Enter Album [$default_album]: " album +album=${album:-$default_album} + +read -p "Enter Release Date (YYYY or YYYY-MM-DD) [$default_date]: " release_date +release_date=${release_date:-$default_date} + +read -p "Enter Composer [$default_composer]: " composer +composer=${composer:-$default_composer} + +echo "" +echo "Retagging files..." +echo "Album Artist: $album_artist" +echo "Album: $album" +echo "Release Date: $release_date" +echo "Composer: $composer" +echo "" + +for file in *.mp3; do + filename="${file%.*}" + track_num=$(echo "$filename" | grep -oP '^\d+') + + echo "Retagging: $file (Track $track_num)" + + if [ -n "$composer" ]; then + ffmpeg -i "$file" -c copy \ + -metadata title="$filename" \ + -metadata track="$track_num" \ + -metadata album_artist="$album_artist" \ + -metadata artist="$album_artist" \ + -metadata album="$album" \ + -metadata date="$release_date" \ + -metadata composer="$composer" \ + -metadata disc="" \ + -metadata discnumber="" \ + -metadata totaldiscs="" \ + -metadata disk="" \ + -metadata disknumber="" \ + "${filename}_temp.mp3" 2>/dev/null + else + ffmpeg -i "$file" -c copy \ + -metadata title="$filename" \ + -metadata track="$track_num" \ + -metadata album_artist="$album_artist" \ + -metadata artist="$album_artist" \ + -metadata album="$album" \ + -metadata date="$release_date" \ + -metadata composer="" \ + -metadata disc="" \ + -metadata discnumber="" \ + -metadata totaldiscs="" \ + -metadata disk="" \ + -metadata disknumber="" \ + "${filename}_temp.mp3" 2>/dev/null + fi + + mv "${filename}_temp.mp3" "$file" +done + +echo "" +echo "Done! All files retagged." diff --git a/scripts/scripts/split.sh b/scripts/scripts/split.sh new file mode 100755 index 0000000..d539899 --- /dev/null +++ b/scripts/scripts/split.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# Handle Ctrl+C gracefully +trap ctrl_c INT + +function ctrl_c() { + echo "" + echo "Cancelled by user." + exit 0 +} + +# Function to read input with tab completion for paths +read_path() { + local prompt="$1" + local input + + # Use read with -e flag for readline editing (enables tab completion) + read -e -p "$prompt" input + echo "$input" +} + +# Get source folder +SOURCE=$(read_path "Enter source folder path: ") + +# Validate source exists +if [ ! -d "$SOURCE" ]; then + echo "Error: Source folder '$SOURCE' does not exist!" + exit 1 +fi + +# Get destination folders +echo "Enter destination folders (one per line, empty line to finish):" +echo "(Tip: Use TAB for folder completion, Ctrl+C to cancel)" +DESTINATIONS=() +while true; do + dest=$(read_path "Destination $((${#DESTINATIONS[@]} + 1)): ") + if [ -z "$dest" ]; then + break + fi + # Create destination if it doesn't exist + if [ ! -d "$dest" ]; then + read -p "Destination '$dest' doesn't exist. Create it? (y/n): " create + if [ "$create" = "y" ]; then + mkdir -p "$dest" + else + continue + fi + fi + DESTINATIONS+=("$dest") +done + +# Validate we have destinations +if [ ${#DESTINATIONS[@]} -eq 0 ]; then + echo "Error: No destination folders provided!" + exit 1 +fi + +# Display summary +echo "" +echo "=== Summary ===" +echo "Source: $SOURCE" +echo "Destinations:" +for i in "${!DESTINATIONS[@]}"; do + echo " $((i + 1)). ${DESTINATIONS[$i]}" +done + +# Get list of items in source +items=("$SOURCE"/*) +total=${#items[@]} +items_per_dest=$((total / ${#DESTINATIONS[@]})) + +echo "" +echo "Total items to split: $total" +echo "Items per destination: ~$items_per_dest" +echo "" + +read -p "Proceed with copy? (y/n): " confirm +if [ "$confirm" != "y" ]; then + echo "Cancelled." + exit 0 +fi + +# Distribute items +echo "" +echo "Starting distribution..." +for i in "${!DESTINATIONS[@]}"; do + start=$((i * items_per_dest)) + if [ $i -eq $((${#DESTINATIONS[@]} - 1)) ]; then + # Last destination gets remainder + end=$total + else + end=$(((i + 1) * items_per_dest)) + fi + + echo "" + echo "Copying to ${DESTINATIONS[$i]} (items $((start + 1)) to $end)..." + for ((j=start; j $item_name" + rsync -a "${items[$j]}" "${DESTINATIONS[$i]}/" + done +done + +echo "" +echo "Distribution complete!" diff --git a/scripts/scripts/sync-mail_1.sh b/scripts/scripts/sync-mail_1.sh new file mode 100755 index 0000000..a9b6565 --- /dev/null +++ b/scripts/scripts/sync-mail_1.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Sync with server (this pushes local changes including deletions) +mbsync -a + +# Re-index +notmuch new + +# Auto-tag folders +notmuch tag +sent -- folder:Sent and not tag:sent +notmuch tag +draft -- folder:Drafts and not tag:draft +notmuch tag +trash -- folder:Trash and not tag:trash +notmuch tag +spam -- folder:Spam and not tag:spam diff --git a/scripts/scripts/thumb.sh b/scripts/scripts/thumb.sh new file mode 100755 index 0000000..fc6a56e --- /dev/null +++ b/scripts/scripts/thumb.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# Ask for the thumbnail filename +echo "=== Album Art Embedder (Recursive) ===" +echo "Current directory: $(pwd)" +read -p "Enter thumbnail filename in this directory (e.g., cover.jpg): " thumbnail + +# Full path to thumbnail +thumbnail_path="$(pwd)/$thumbnail" + +# Check if thumbnail exists +if [ ! -f "$thumbnail_path" ]; then + echo "Error: Thumbnail not found at $thumbnail_path" + exit 1 +fi + +# Ask for album artist +read -p "Enter album artist name: " album_artist + +# Get album name from current directory +album_name="$(basename "$(pwd)")" + +echo "" +echo "Found thumbnail: $thumbnail_path" +echo "Album: $album_name" +echo "Album Artist: $album_artist" +echo "Processing all mp3/mp4 files in subdirectories..." +echo "" + +# Counter for processed files +count=0 + +# Find all mp3 and mp4 files in subdirectories (not current dir) +find . -mindepth 2 -type f \( -name "*.mp3" -o -name "*.mp4" \) | while read -r file; do + echo "Processing: $file" + + # Get file extension + ext="${file##*.}" + + # Create temporary filename + temp_file="${file}.tmp.${ext}" + + # Add thumbnail and metadata using ffmpeg + if [ "$ext" = "mp3" ]; then + ffmpeg -i "$file" -i "$thumbnail_path" \ + -map 0 -map 1 \ + -c copy \ + -metadata album_artist="$album_artist" \ + -metadata album="$album_name" \ + -disposition:v:0 attached_pic \ + "$temp_file" 2>/dev/null + else + # For mp4 files + ffmpeg -i "$file" -i "$thumbnail_path" \ + -map 0 -map 1 \ + -c copy \ + -metadata artist="$album_artist" \ + -metadata album="$album_name" \ + -disposition:v:0 attached_pic \ + "$temp_file" 2>/dev/null + fi + + if [ $? -eq 0 ]; then + mv "$temp_file" "$file" + ((count++)) + echo "✓ Done" + else + echo "✗ Failed" + [ -f "$temp_file" ] && rm "$temp_file" + fi + echo "" +done + +echo "Finished! Processed $count files." +echo "Album Artist set to: $album_artist" +echo "Album set to: $album_name" diff --git a/scripts/scripts/yazi-picker.sh b/scripts/scripts/yazi-picker.sh new file mode 100755 index 0000000..0a93c7d --- /dev/null +++ b/scripts/scripts/yazi-picker.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# ~/scripts/yazi-picker.sh + +# Launch Yazi and capture the selected file +selected_file=$(yazi --chooser-file) + +# If a file was selected, print it (or pass it to another application) +if [ -n "$selected_file" ]; then + echo "$selected_file" | xclip -selection clipboard # Copy to clipboard (optional) + echo "Selected file: $selected_file" +fi