added all scripts
This commit is contained in:
91
aria.sh
Executable file
91
aria.sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fast Aria2 Download Script
|
||||
# Usage: ./aria2-download.sh <URL> [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 <URL> [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
|
||||
87
bluelight.sh
Executable file
87
bluelight.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
|
||||
SHADER_DIR="$HOME/.config/hypr/shaders"
|
||||
SHADER_FILE="$SHADER_DIR/brightness.frag"
|
||||
|
||||
# Ensure shader directory exists
|
||||
mkdir -p "$SHADER_DIR"
|
||||
|
||||
# Get screen brightness level
|
||||
echo "Enter screen brightness level (0-10, where 10 = 100%):"
|
||||
read -r LEVEL
|
||||
|
||||
# Validate input
|
||||
if ! [[ "$LEVEL" =~ ^[0-9]+$ ]] || [ "$LEVEL" -lt 0 ] || [ "$LEVEL" -gt 10 ]; then
|
||||
echo "Invalid input. Please enter a number between 0 and 10."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert to decimal (0-10 -> 0.0-1.0)
|
||||
BRIGHTNESS=$(echo "scale=2; $LEVEL / 10" | bc)
|
||||
|
||||
# Ask about keyboard backlight
|
||||
echo "Adjust keyboard backlight? (y/n):"
|
||||
read -r KBD_ADJUST
|
||||
|
||||
if [[ "$KBD_ADJUST" == "y" || "$KBD_ADJUST" == "Y" ]]; then
|
||||
echo "Enter keyboard backlight level (0-10, where 10 = 100%):"
|
||||
read -r KBD_LEVEL
|
||||
|
||||
# Validate keyboard input
|
||||
if ! [[ "$KBD_LEVEL" =~ ^[0-9]+$ ]] || [ "$KBD_LEVEL" -lt 0 ] || [ "$KBD_LEVEL" -gt 10 ]; then
|
||||
echo "Invalid input. Please enter a number between 0 and 10."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert to percentage (0-10 -> 0-100)
|
||||
KBD_PERCENT=$((KBD_LEVEL * 10))
|
||||
|
||||
# Set keyboard backlight
|
||||
kbdlight set $KBD_PERCENT
|
||||
echo "Keyboard backlight set to ${KBD_PERCENT}%"
|
||||
fi
|
||||
|
||||
# Ask about blue light filter
|
||||
echo "Apply blue light filter? (y/n):"
|
||||
read -r BLUELIGHT
|
||||
|
||||
# Create shader based on choice
|
||||
cat > "$SHADER_FILE" << EOF
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
|
||||
in vec2 v_texcoord;
|
||||
out vec4 fragColor;
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main() {
|
||||
vec4 pixColor = texture(tex, v_texcoord);
|
||||
|
||||
EOF
|
||||
|
||||
if [[ "$BLUELIGHT" == "y" || "$BLUELIGHT" == "Y" ]]; then
|
||||
cat >> "$SHADER_FILE" << EOF
|
||||
// Reduce blue light
|
||||
pixColor.r *= 1.0;
|
||||
pixColor.g *= 0.85;
|
||||
pixColor.b *= 0.65;
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> "$SHADER_FILE" << EOF
|
||||
// Adjust brightness
|
||||
pixColor.rgb *= $BRIGHTNESS;
|
||||
|
||||
fragColor = pixColor;
|
||||
}
|
||||
EOF
|
||||
|
||||
# Apply shader
|
||||
if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1)
|
||||
fi
|
||||
/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE"
|
||||
|
||||
echo "Screen brightness set to ${LEVEL}0% $([ "$BLUELIGHT" == "y" ] || [ "$BLUELIGHT" == "Y" ] && echo "with blue light filter")"
|
||||
107
extraudio.sh
Executable file
107
extraudio.sh
Executable file
@@ -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"
|
||||
17
m3u8.sh
Executable file
17
m3u8.sh
Executable file
@@ -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"
|
||||
22
move-trash.sh
Executable file
22
move-trash.sh
Executable file
@@ -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
|
||||
37
nonum.sh
Executable file
37
nonum.sh
Executable file
@@ -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."
|
||||
47
nothumb.sh
Executable file
47
nothumb.sh
Executable file
@@ -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"
|
||||
11
pve_chmod.sh
Executable file
11
pve_chmod.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/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
|
||||
76
retag.sh
Executable file
76
retag.sh
Executable file
@@ -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."
|
||||
105
split.sh
Executable file
105
split.sh
Executable file
@@ -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<end; j++)); do
|
||||
item_name=$(basename "${items[$j]}")
|
||||
echo " -> $item_name"
|
||||
rsync -a "${items[$j]}" "${DESTINATIONS[$i]}/"
|
||||
done
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Distribution complete!"
|
||||
13
sync-mail.sh
Executable file
13
sync-mail.sh
Executable file
@@ -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
|
||||
76
thumb.sh
Executable file
76
thumb.sh
Executable file
@@ -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"
|
||||
Reference in New Issue
Block a user