Compare commits
5 Commits
72cba64e23
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c1051226b | |||
| 9a096970c3 | |||
| b390872d27 | |||
| be6c7285b3 | |||
| f5121bc1c5 |
@@ -64,10 +64,15 @@ function helpme() {
|
|||||||
echo -e "wii : Convert Wii games"
|
echo -e "wii : Convert Wii games"
|
||||||
echo -e "nds-patcher : Patches NDS ROMs"
|
echo -e "nds-patcher : Patches NDS ROMs"
|
||||||
echo -e "megadrive : Flashes Megadrive Carts"
|
echo -e "megadrive : Flashes Megadrive Carts"
|
||||||
|
echo -e "chd : Converts roms with CHDMAN"
|
||||||
echo -e ""
|
echo -e ""
|
||||||
echo -e "\e[32m--------- System Stats ----------\e[0m"
|
echo -e "\e[32m------------ System -------------\e[0m"
|
||||||
echo -e "kill [tab] : Show processes to Kill"
|
echo -e "kill [tab] : Show processes to Kill"
|
||||||
echo -e "btop : Show systems stats"
|
echo -e "btop : Show systems stats"
|
||||||
|
echo -e "rpmlist : List all RPM packages"
|
||||||
|
echo -e "sudo dnf remove *name : Remove a RPM package"
|
||||||
|
echo -e "flatpak list --app : List flatpak packages"
|
||||||
|
echo -e "flatremove app_id : Remove flatpak app"
|
||||||
echo -e ""
|
echo -e ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +97,8 @@ alias star-edit="nano ~/.config/starship.toml"
|
|||||||
alias ssh="kitty +kitten ssh"
|
alias ssh="kitty +kitten ssh"
|
||||||
alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2
|
alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2
|
||||||
alias unpack="tar -xvf"
|
alias unpack="tar -xvf"
|
||||||
|
alias flatremove="flatpak uninstall"
|
||||||
|
alias rpmlist="dnf list installed"
|
||||||
# Scripts
|
# Scripts
|
||||||
alias myapps="sudo -v && ~/.bash/scripts/fedora-apps.sh"
|
alias myapps="sudo -v && ~/.bash/scripts/fedora-apps.sh"
|
||||||
alias phoneapps="~/.bash/scripts/phone-apps.sh"
|
alias phoneapps="~/.bash/scripts/phone-apps.sh"
|
||||||
@@ -99,6 +106,7 @@ alias compress="~/.bash/scripts/compress.sh"
|
|||||||
alias wii="~/.bash/scripts/wii.sh"
|
alias wii="~/.bash/scripts/wii.sh"
|
||||||
alias nds-patcher="~/.bash/scripts/nds.sh"
|
alias nds-patcher="~/.bash/scripts/nds.sh"
|
||||||
alias megadrive="~/.bash/scripts/megadrive.sh"
|
alias megadrive="~/.bash/scripts/megadrive.sh"
|
||||||
|
alias chd="~/.bash/scripts/chd.sh"
|
||||||
alias caddy="~/.bash/scripts/caddy.sh"
|
alias caddy="~/.bash/scripts/caddy.sh"
|
||||||
|
|
||||||
export GSK_RENDERER=cairo
|
export GSK_RENDERER=cairo
|
||||||
|
|||||||
+17
-8
@@ -88,15 +88,25 @@ add_config() {
|
|||||||
|
|
||||||
[[ -z "$SERVICE" ]] && { gum style --foreground "red" " Aborted – no service name given."; press_enter; return; }
|
[[ -z "$SERVICE" ]] && { gum style --foreground "red" " Aborted – no service name given."; press_enter; return; }
|
||||||
|
|
||||||
# Domain – pre-filled with common suffix; type the subdomain then arrow to end
|
# Domain – type subdomain only, suffix appended automatically
|
||||||
DOMAIN=$(gum input \
|
SUBDOMAIN=$(gum input \
|
||||||
--prompt " Domain: " \
|
--prompt " Subdomain: " \
|
||||||
--prompt.foreground "$ORANGE" \
|
--prompt.foreground "$ORANGE" \
|
||||||
--value ".marlow.quest" \
|
--placeholder "e.g. homarr (will become homarr.marlow.quest)" \
|
||||||
--width 40 \
|
--width 50 \
|
||||||
--cursor.foreground "$ORANGE")
|
--cursor.foreground "$ORANGE")
|
||||||
|
|
||||||
[[ -z "$DOMAIN" ]] && { gum style --foreground "red" " Aborted – no domain given."; press_enter; return; }
|
[[ -z "$SUBDOMAIN" ]] && { gum style --foreground "red" " Aborted – no domain given."; press_enter; return; }
|
||||||
|
|
||||||
|
# If they typed a full domain (contains a dot) use as-is, otherwise append suffix
|
||||||
|
if [[ "$SUBDOMAIN" == *.* ]]; then
|
||||||
|
DOMAIN="$SUBDOMAIN"
|
||||||
|
else
|
||||||
|
DOMAIN="${SUBDOMAIN}.marlow.quest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
gum style --foreground "$GREY_LIGHT" --margin "0 2" " → ${DOMAIN}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Upstream IP:port – pre-filled with common subnet prefix
|
# Upstream IP:port – pre-filled with common subnet prefix
|
||||||
UPSTREAM=$(gum input \
|
UPSTREAM=$(gum input \
|
||||||
@@ -117,13 +127,12 @@ add_config() {
|
|||||||
--selected.foreground "$ORANGE" \
|
--selected.foreground "$ORANGE" \
|
||||||
--header " Select an option:" \
|
--header " Select an option:" \
|
||||||
--header.foreground "$GREY_LIGHT" \
|
--header.foreground "$GREY_LIGHT" \
|
||||||
"Yes" "No")
|
"No" "Yes")
|
||||||
|
|
||||||
# Build the Caddy config block
|
# Build the Caddy config block
|
||||||
if [[ "$USE_TINYAUTH" == "Yes" ]]; then
|
if [[ "$USE_TINYAUTH" == "Yes" ]]; then
|
||||||
CONFIG_BLOCK="${DOMAIN} {
|
CONFIG_BLOCK="${DOMAIN} {
|
||||||
import tinyauth
|
import tinyauth
|
||||||
}
|
|
||||||
|
|
||||||
reverse_proxy ${UPSTREAM}
|
reverse_proxy ${UPSTREAM}
|
||||||
}"
|
}"
|
||||||
|
|||||||
Executable
+173
@@ -0,0 +1,173 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# --- Theme Configuration (Orange & Grey) ---
|
||||||
|
ORANGE="#FF6B00"
|
||||||
|
GREY_LIGHT="#B3B3B3"
|
||||||
|
GREY_DARK="#2E2E2E"
|
||||||
|
|
||||||
|
export GUM_CHOOSE_CURSOR_FOREGROUND="$ORANGE"
|
||||||
|
export GUM_CHOOSE_SELECTED_FOREGROUND="$ORANGE"
|
||||||
|
export GUM_CHOOSE_ITEM_FOREGROUND="$GREY_LIGHT"
|
||||||
|
export GUM_CONFIRM_SELECTED_BACKGROUND="$ORANGE"
|
||||||
|
export GUM_CONFIRM_SELECTED_FOREGROUND="#000000"
|
||||||
|
export GUM_CONFIRM_UNSELECTED_BACKGROUND="$GREY_DARK"
|
||||||
|
export GUM_CONFIRM_UNSELECTED_FOREGROUND="$GREY_LIGHT"
|
||||||
|
|
||||||
|
# Create a clean temporary log to trap underlying command errors
|
||||||
|
ERROR_LOG=$(mktemp /tmp/chd_converter_err.XXXXXX)
|
||||||
|
trap 'rm -f "$ERROR_LOG"' EXIT
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
|
||||||
|
# Title Box Header
|
||||||
|
gum style \
|
||||||
|
--border double \
|
||||||
|
--border-foreground "$ORANGE" \
|
||||||
|
--foreground "$ORANGE" \
|
||||||
|
--margin "1 2" \
|
||||||
|
--padding "1 4" \
|
||||||
|
--align center \
|
||||||
|
--width 40 \
|
||||||
|
"CHD ROM Converter"
|
||||||
|
|
||||||
|
# Main Menu Selection
|
||||||
|
CHOICE=$(gum choose --header="Select an action:" "Compress to CHD" "Extract CHD back to ROM" "Exit")
|
||||||
|
|
||||||
|
case "$CHOICE" in
|
||||||
|
"Compress to CHD")
|
||||||
|
gum style --foreground "$ORANGE" "Select the folder containing ROMs to compress:"
|
||||||
|
TARGET_DIR=$(gum file --directory)
|
||||||
|
|
||||||
|
[ -z "$TARGET_DIR" ] && continue
|
||||||
|
cd "$TARGET_DIR" || continue
|
||||||
|
|
||||||
|
shopt -s nullglob nocaseglob
|
||||||
|
FILES=(*.iso *.cue *.gdi)
|
||||||
|
|
||||||
|
if [ ${#FILES[@]} -eq 0 ]; then
|
||||||
|
gum style --foreground "$GREY_LIGHT" "No compatible files (.iso, .cue, .gdi) found in this folder."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." --timeout 5s >/dev/null
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONVERTED_ORIGINALS=()
|
||||||
|
FAILED_FILES=()
|
||||||
|
|
||||||
|
for FILE in "${FILES[@]}"; do
|
||||||
|
[ -f "$FILE" ] || continue
|
||||||
|
OUTPUT_CHD="${FILE%.*}.chd"
|
||||||
|
|
||||||
|
# Wrapped inside bash -c so 'gum spin' output stays visible on the terminal screen
|
||||||
|
gum spin --spinner dot --spinner.foreground "$ORANGE" --title.foreground "$GREY_LIGHT" --title "Compressing: $FILE..." -- bash -c "chdman createcd -i '$FILE' -o '$OUTPUT_CHD' >/dev/null 2>'$ERROR_LOG'"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
CONVERTED_ORIGINALS+=("$FILE")
|
||||||
|
|
||||||
|
# Track associated .bin files from inside the .cue file for safe cleanup
|
||||||
|
if [[ "$FILE" =~ \.cue$ ]]; then
|
||||||
|
while IFS= read -r BIN_FILE; do
|
||||||
|
BIN_FILE=$(echo "$BIN_FILE" | tr -d '\r"' | xargs)
|
||||||
|
if [ -f "$BIN_FILE" ]; then
|
||||||
|
CONVERTED_ORIGINALS+=("$BIN_FILE")
|
||||||
|
fi
|
||||||
|
done < <(grep -i 'FILE' "$FILE" | awk -F '"' '{print $2}')
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
FAILED_FILES+=("$FILE")
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if grep -qE "not found|command not found" "$ERROR_LOG" 2>/dev/null; then
|
||||||
|
gum style --foreground "#FF3333" --border normal --border-foreground "#FF3333" --padding "0 1" "Error: 'chdman' is not installed or not in your PATH."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." >/dev/null
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
gum style --foreground "#FF3333" "Failed to compress: $FILE"
|
||||||
|
gum style --foreground "$GREY_LIGHT" "Reason: $(cat "$ERROR_LOG")"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#CONVERTED_ORIGINALS[@]} -gt 0 ]; then
|
||||||
|
if gum confirm "Compression complete! Do you want to delete the original source files?"; then
|
||||||
|
for ORIG in "${CONVERTED_ORIGINALS[@]}"; do
|
||||||
|
rm -f "$ORIG"
|
||||||
|
done
|
||||||
|
gum style --foreground "$ORANGE" "Original files cleaned up successfully."
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
elif [ ${#FAILED_FILES[@]} -gt 0 ]; then
|
||||||
|
gum style --foreground "$GREY_LIGHT" "File processing halted due to errors shown above."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." >/dev/null
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"Extract CHD back to ROM")
|
||||||
|
gum style --foreground "$ORANGE" "Select the folder containing CHDs to extract:"
|
||||||
|
TARGET_DIR=$(gum file --directory)
|
||||||
|
|
||||||
|
[ -z "$TARGET_DIR" ] && continue
|
||||||
|
cd "$TARGET_DIR" || continue
|
||||||
|
|
||||||
|
shopt -s nullglob nocaseglob
|
||||||
|
FILES=(*.chd)
|
||||||
|
|
||||||
|
if [ ${#FILES[@]} -eq 0 ]; then
|
||||||
|
gum style --foreground "$GREY_LIGHT" "No .chd files found in this folder."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." --timeout 5s >/dev/null
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONVERTED_CHDS=()
|
||||||
|
|
||||||
|
for FILE in "${FILES[@]}"; do
|
||||||
|
[ -f "$FILE" ] || continue
|
||||||
|
BASE_NAME="${FILE%.*}"
|
||||||
|
|
||||||
|
# Check metadata to safely differentiate between multi-track CD structures and flat DVDs
|
||||||
|
if chdman info -i "$FILE" 2>/dev/null | grep -qi "track"; then
|
||||||
|
# CD Mode (.cue + .bin output alignment)
|
||||||
|
OUTPUT_FILE="$BASE_NAME.cue"
|
||||||
|
gum spin --spinner dot --spinner.foreground "$ORANGE" --title.foreground "$GREY_LIGHT" --title "Extracting CD ROM Layout ($BASE_NAME.cue)..." -- bash -c "chdman extractcd -i '$FILE' -o '$OUTPUT_FILE' >/dev/null 2>'$ERROR_LOG'"
|
||||||
|
else
|
||||||
|
# DVD Mode (True standalone single .iso target extraction)
|
||||||
|
OUTPUT_FILE="$BASE_NAME.iso"
|
||||||
|
gum spin --spinner dot --spinner.foreground "$ORANGE" --title.foreground "$GREY_LIGHT" --title "Extracting DVD Image ($BASE_NAME.iso)..." -- bash -c "chdman extractdvd -i '$FILE' -o '$OUTPUT_FILE' >/dev/null 2>'$ERROR_LOG'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
CONVERTED_CHDS+=("$FILE")
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
if grep -qE "not found|command not found" "$ERROR_LOG" 2>/dev/null; then
|
||||||
|
gum style --foreground "#FF3333" "Error: 'chdman' command not found."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." >/dev/null
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
gum style --foreground "#FF3333" "Failed to extract: $FILE"
|
||||||
|
gum style --foreground "$GREY_LIGHT" "Reason: $(cat "$ERROR_LOG")"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#CONVERTED_CHDS[@]} -gt 0 ]; then
|
||||||
|
if gum confirm "Extraction complete! Do you want to delete the original CHD files?"; then
|
||||||
|
for CHD in "${CONVERTED_CHDS[@]}"; do
|
||||||
|
rm -f "$CHD"
|
||||||
|
done
|
||||||
|
gum style --foreground "$ORANGE" "Original CHD files cleaned up successfully."
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
gum style --foreground "$GREY_LIGHT" "Extraction failed or was aborted."
|
||||||
|
gum input --placeholder "Press Enter to return to menu..." >/dev/null
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"Exit")
|
||||||
|
clear
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# ==========================================
|
# ==========================================
|
||||||
# CONFIGURATION (Edit these!)
|
# CONFIGURATION (Edit these!)
|
||||||
# ==========================================
|
# ==========================================
|
||||||
GOTIFY_TOKEN="AH5NXt3g0lSCyfT" # <--- Paste your token here
|
GOTIFY_TOKEN= # <--- Paste your token here
|
||||||
GOTIFY_URL="https://gotify.marlow.quest"
|
GOTIFY_URL="https://gotify.marlow.quest"
|
||||||
SRC_DIR="$HOME/Videos/Compress"
|
SRC_DIR="$HOME/Videos/Compress"
|
||||||
OUT_DIR="$SRC_DIR/Complete"
|
OUT_DIR="$SRC_DIR/Complete"
|
||||||
|
|||||||
Reference in New Issue
Block a user