mirror of
https://github.com/acedanger/shell.git
synced 2026-03-24 19:11:48 -07:00
feat: Update color code definitions for consistency across scripts
This commit is contained in:
@@ -51,12 +51,12 @@
|
|||||||
# Critical operations use explicit error checking instead of automatic exit
|
# Critical operations use explicit error checking instead of automatic exit
|
||||||
|
|
||||||
# Color codes for output
|
# Color codes for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN=$'\033[0;36m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Performance tracking variables (removed unused variables)
|
# Performance tracking variables (removed unused variables)
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Color codes
|
# Color codes
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Plex database path
|
# Plex database path
|
||||||
PLEX_DB_PATH="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
PLEX_DB_PATH="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
set +e
|
set +e
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
||||||
|
|||||||
@@ -55,12 +55,12 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Color codes for output
|
# Color codes for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN=$'\033[0;36m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Test configuration
|
# Test configuration
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|||||||
@@ -49,13 +49,13 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Color codes for output
|
# Color codes for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN=$'\033[0;36m'
|
||||||
MAGENTA='\033[0;35m'
|
MAGENTA=$'\033[0;35m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|||||||
@@ -58,11 +58,11 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
||||||
|
|||||||
@@ -34,15 +34,15 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Color codes for output
|
# Color codes for output
|
||||||
readonly RED='\033[0;31m'
|
readonly RED=$'\033[0;31m'
|
||||||
readonly GREEN='\033[0;32m'
|
readonly GREEN=$'\033[0;32m'
|
||||||
readonly YELLOW='\033[1;33m'
|
readonly YELLOW=$'\033[1;33m'
|
||||||
readonly BLUE='\033[0;34m'
|
readonly BLUE=$'\033[0;34m'
|
||||||
readonly CYAN='\033[0;36m'
|
readonly CYAN=$'\033[0;36m'
|
||||||
readonly WHITE='\033[1;37m'
|
readonly WHITE=$'\033[1;37m'
|
||||||
readonly BOLD='\033[1m'
|
readonly BOLD=$'\033[1m'
|
||||||
readonly DIM='\033[2m'
|
readonly DIM=$'\033[2m'
|
||||||
readonly RESET='\033[0m'
|
readonly RESET=$'\033[0m'
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
readonly PLEX_SERVICE="plexmediaserver"
|
readonly PLEX_SERVICE="plexmediaserver"
|
||||||
|
|||||||
51
plex/plex.sh
51
plex/plex.sh
@@ -57,16 +57,16 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# 🎨 Color definitions for sexy output
|
# 🎨 Color definitions for sexy output
|
||||||
readonly RED='\033[0;31m'
|
readonly RED=$'\033[0;31m'
|
||||||
readonly GREEN='\033[0;32m'
|
readonly GREEN=$'\033[0;32m'
|
||||||
readonly YELLOW='\033[1;33m'
|
readonly YELLOW=$'\033[1;33m'
|
||||||
readonly BLUE='\033[0;34m'
|
readonly BLUE=$'\033[0;34m'
|
||||||
readonly PURPLE='\033[0;35m'
|
readonly PURPLE=$'\033[0;35m'
|
||||||
readonly CYAN='\033[0;36m'
|
readonly CYAN=$'\033[0;36m'
|
||||||
readonly WHITE='\033[1;37m'
|
readonly WHITE=$'\033[1;37m'
|
||||||
readonly BOLD='\033[1m'
|
readonly BOLD=$'\033[1m'
|
||||||
readonly DIM='\033[2m'
|
readonly DIM=$'\033[2m'
|
||||||
readonly RESET='\033[0m'
|
readonly RESET=$'\033[0m'
|
||||||
|
|
||||||
# 🔧 Configuration
|
# 🔧 Configuration
|
||||||
readonly PLEX_SERVICE="plexmediaserver"
|
readonly PLEX_SERVICE="plexmediaserver"
|
||||||
@@ -784,6 +784,7 @@ show_help() {
|
|||||||
printf " ${RED}${BOLD}%-18s${RESET} %s %s\n" "nuclear" "[!!]" "Nuclear database recovery (last resort)"
|
printf " ${RED}${BOLD}%-18s${RESET} %s %s\n" "nuclear" "[!!]" "Nuclear database recovery (last resort)"
|
||||||
printf " ${CYAN}${BOLD}%-18s${RESET} %s %s\n" "backups" "[#]" "List and manage database backup files"
|
printf " ${CYAN}${BOLD}%-18s${RESET} %s %s\n" "backups" "[#]" "List and manage database backup files"
|
||||||
printf " ${GREEN}${BOLD}%-18s${RESET} %s %s\n" "install-dbrepair" "[+]" "Install or update DBRepair tool"
|
printf " ${GREEN}${BOLD}%-18s${RESET} %s %s\n" "install-dbrepair" "[+]" "Install or update DBRepair tool"
|
||||||
|
printf " ${WHITE}${BOLD}%-18s${RESET} %s %s\n" "tui" "[>]" "Launch interactive TUI dashboard"
|
||||||
printf " ${PURPLE}${BOLD}%-18s${RESET} %s %s\n" "help" "${HOURGLASS}" "Show this help message"
|
printf " ${PURPLE}${BOLD}%-18s${RESET} %s %s\n" "help" "${HOURGLASS}" "Show this help message"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${DIM}${WHITE}Examples:${RESET}"
|
echo -e "${DIM}${WHITE}Examples:${RESET}"
|
||||||
@@ -796,10 +797,35 @@ show_help() {
|
|||||||
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete" "Interactive backup deletion"
|
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete" "Interactive backup deletion"
|
||||||
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete --name foo" "Delete by name pattern"
|
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} backups delete --name foo" "Delete by name pattern"
|
||||||
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} install-dbrepair" "Install/update DBRepair"
|
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} install-dbrepair" "Install/update DBRepair"
|
||||||
|
printf " ${DIM}%-40s # %s${RESET}\n" "${SCRIPT_NAME} tui" "Launch full TUI dashboard"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
# 📚 Function to launch library scanner
|
# <EFBFBD>️ Function to launch the Python TUI dashboard
|
||||||
|
launch_tui() {
|
||||||
|
local venv_dir="${SCRIPT_DIR}/.venv"
|
||||||
|
local tui_app="${SCRIPT_DIR}/tui/app.py"
|
||||||
|
|
||||||
|
if [[ ! -f "$tui_app" ]]; then
|
||||||
|
print_status "${CROSS}" "TUI application not found: $tui_app" "${RED}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create venv and install dependencies if needed
|
||||||
|
if [[ ! -d "$venv_dir" ]]; then
|
||||||
|
print_status "${INFO}" "Setting up Python environment (first run)..." "${BLUE}"
|
||||||
|
if ! python3 -m venv "$venv_dir" 2>/dev/null; then
|
||||||
|
print_status "${CROSS}" "Failed to create Python venv. Install python3-venv." "${RED}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
"${venv_dir}/bin/pip" install --quiet textual
|
||||||
|
print_status "${CHECKMARK}" "Python environment ready" "${GREEN}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${venv_dir}/bin/python3" "$tui_app"
|
||||||
|
}
|
||||||
|
|
||||||
|
# <20>📚 Function to launch library scanner
|
||||||
launch_scanner() {
|
launch_scanner() {
|
||||||
print_status "${SPARKLES}" "Launching Plex Library Scanner..." "${PURPLE}"
|
print_status "${SPARKLES}" "Launching Plex Library Scanner..." "${PURPLE}"
|
||||||
|
|
||||||
@@ -966,6 +992,9 @@ main() {
|
|||||||
"install-dbrepair"|"update-dbrepair"|"dbrepair")
|
"install-dbrepair"|"update-dbrepair"|"dbrepair")
|
||||||
install_or_update_dbrepair
|
install_or_update_dbrepair
|
||||||
;;
|
;;
|
||||||
|
"tui"|"dashboard"|"ui")
|
||||||
|
launch_tui
|
||||||
|
;;
|
||||||
"backups"|"backup-list")
|
"backups"|"backup-list")
|
||||||
if [[ $# -ge 2 && "${2,,}" == "delete" ]]; then
|
if [[ $# -ge 2 && "${2,,}" == "delete" ]]; then
|
||||||
if [[ $# -ge 4 && "${3}" == "--name" ]]; then
|
if [[ $# -ge 4 && "${3}" == "--name" ]]; then
|
||||||
|
|||||||
@@ -44,16 +44,16 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# 🎨 Color definitions for styled output
|
# 🎨 Color definitions for styled output
|
||||||
readonly RED='\033[0;31m'
|
readonly RED=$'\033[0;31m'
|
||||||
readonly GREEN='\033[0;32m'
|
readonly GREEN=$'\033[0;32m'
|
||||||
readonly YELLOW='\033[1;33m'
|
readonly YELLOW=$'\033[1;33m'
|
||||||
readonly BLUE='\033[0;34m'
|
readonly BLUE=$'\033[0;34m'
|
||||||
readonly PURPLE='\033[0;35m'
|
readonly PURPLE=$'\033[0;35m'
|
||||||
readonly CYAN='\033[0;36m'
|
readonly CYAN=$'\033[0;36m'
|
||||||
readonly WHITE='\033[1;37m'
|
readonly WHITE=$'\033[1;37m'
|
||||||
readonly BOLD='\033[1m'
|
readonly BOLD=$'\033[1m'
|
||||||
readonly DIM='\033[2m'
|
readonly DIM=$'\033[2m'
|
||||||
readonly RESET='\033[0m'
|
readonly RESET=$'\033[0m'
|
||||||
|
|
||||||
# 🔧 Configuration
|
# 🔧 Configuration
|
||||||
readonly PLEX_SERVICE="plexmediaserver"
|
readonly PLEX_SERVICE="plexmediaserver"
|
||||||
|
|||||||
@@ -54,12 +54,12 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Color codes for output
|
# Color codes for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN=$'\033[0;36m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
# Test configuration
|
# Test configuration
|
||||||
TEST_DIR="/tmp/plex-backup-test-$(date +%s)"
|
TEST_DIR="/tmp/plex-backup-test-$(date +%s)"
|
||||||
|
|||||||
@@ -50,11 +50,11 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
NC='\033[0m'
|
NC=$'\033[0m'
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|||||||
@@ -53,11 +53,11 @@
|
|||||||
# Comprehensive check to ensure Plex is fully recovered and functional
|
# Comprehensive check to ensure Plex is fully recovered and functional
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED=$'\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN=$'\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW=$'\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE=$'\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC=$'\033[0m' # No Color
|
||||||
|
|
||||||
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
PLEX_DB_DIR="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user