mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
added the ability to initiate a plex library scan from the CLI. tab completions are supported as well.
This commit is contained in:
118
plex/README.md
118
plex/README.md
@@ -229,6 +229,7 @@ ls -lah "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/
|
||||
- Interactive menu system for easy management
|
||||
- Process monitoring and health checks
|
||||
- Integration with other backup/repair tools
|
||||
- **NEW:** Library scanner integration
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
@@ -236,6 +237,7 @@ ls -lah "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/
|
||||
./plex.sh stop # Stop Plex service
|
||||
./plex.sh restart # Restart Plex service
|
||||
./plex.sh status # Show service status
|
||||
./plex.sh scan # Launch library scanner
|
||||
./plex.sh repair # Launch repair menu (calls other tools)
|
||||
./plex.sh nuclear # Nuclear recovery option
|
||||
./plex.sh # Interactive menu
|
||||
@@ -248,11 +250,16 @@ $ ./plex.sh status
|
||||
Plex Media Server Status: RUNNING
|
||||
Uptime: 2 days, 14 hours, 23 minutes
|
||||
|
||||
# Launch library scanner
|
||||
$ ./plex.sh scan
|
||||
[*] Launching Plex Library Scanner...
|
||||
[i] Launching scanner in interactive mode...
|
||||
|
||||
# Interactive menu
|
||||
$ ./plex.sh
|
||||
=== Plex Management Menu ===
|
||||
1) Start Service
|
||||
2) Stop Service
|
||||
2) Stop Service
|
||||
3) Restart Service
|
||||
4) Service Status
|
||||
5) Database Check
|
||||
@@ -260,6 +267,93 @@ $ ./plex.sh
|
||||
Enter your choice [1-6]:
|
||||
```
|
||||
|
||||
#### `scan-plex-libraries.sh` ⭐ **NEW**
|
||||
**Comprehensive Plex library scanning and management**
|
||||
|
||||
**Features:**
|
||||
- List all Plex library sections with IDs
|
||||
- Scan libraries for new media files
|
||||
- Refresh metadata with force options
|
||||
- Deep media analysis capabilities
|
||||
- Generate thumbnails and fanart
|
||||
- Show library tree structures
|
||||
- Interactive and command-line modes
|
||||
- Comprehensive error handling and logging
|
||||
|
||||
**Status:** ✅ **ACTIVE** (June 26, 2025)
|
||||
|
||||
**Integration:**
|
||||
- Integrated into `plex.sh` as the `scan` command
|
||||
- Available via aliases: `plex-scan`, `plex-scanner`
|
||||
- Direct command-line access available
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
# Via plex.sh (recommended)
|
||||
./plex.sh scan # Interactive scanner
|
||||
./plex.sh scan list # List all libraries
|
||||
./plex.sh scan scan 29 # Scan Movies library
|
||||
./plex.sh scan refresh "" true # Force refresh all libraries
|
||||
|
||||
# Direct usage
|
||||
./scan-plex-libraries.sh list # List all library sections
|
||||
./scan-plex-libraries.sh scan # Scan all libraries for new media
|
||||
./scan-plex-libraries.sh scan 29 # Scan specific library (ID 29)
|
||||
./scan-plex-libraries.sh refresh 29 true # Force refresh specific library
|
||||
./scan-plex-libraries.sh analyze 29 true # Deep analyze library
|
||||
./scan-plex-libraries.sh generate 29 # Generate thumbnails
|
||||
./scan-plex-libraries.sh tree 29 # Show library structure
|
||||
./scan-plex-libraries.sh -v scan 29 # Verbose scanning
|
||||
|
||||
# Via aliases
|
||||
plex-scan # Launch via plex.sh
|
||||
plex-scanner list # Direct scanner access
|
||||
```
|
||||
|
||||
**Example Operations:**
|
||||
```bash
|
||||
# List all available libraries
|
||||
$ ./scan-plex-libraries.sh list
|
||||
Available Library Sections:
|
||||
=========================
|
||||
29: Movies
|
||||
30: TV Shows
|
||||
31: Music
|
||||
|
||||
# Scan Movies library for new content
|
||||
$ ./scan-plex-libraries.sh scan 29
|
||||
[>] Scanning library section 29 for new media...
|
||||
[✓] Library section 29 scan completed
|
||||
|
||||
# Force refresh all libraries
|
||||
$ ./scan-plex-libraries.sh refresh "" true
|
||||
[~] Refreshing metadata for all libraries...
|
||||
[i] Refreshing section 29...
|
||||
[✓] Section 29 refreshed successfully
|
||||
[i] Refreshing section 30...
|
||||
[✓] Section 30 refreshed successfully
|
||||
[✓] All libraries refreshed successfully
|
||||
```
|
||||
|
||||
**Interactive Mode:**
|
||||
```bash
|
||||
$ ./scan-plex-libraries.sh
|
||||
🎬 Plex Library Scanner - Interactive Mode
|
||||
Select an operation to perform:
|
||||
|
||||
Available Operations:
|
||||
1) List all libraries
|
||||
2) Scan libraries for new media
|
||||
3) Refresh library metadata
|
||||
4) Analyze library media
|
||||
5) Generate thumbnails
|
||||
6) Show library tree
|
||||
q) Quit
|
||||
|
||||
Choose an option [1-6,q]:
|
||||
```
|
||||
```
|
||||
|
||||
### 📊 Utility Scripts
|
||||
|
||||
#### `check-plex-builtin-backups.sh` ⭐ **NEW**
|
||||
@@ -325,7 +419,7 @@ sudo ./cleanup-plex-databases.sh # Perform actual cleanup
|
||||
|
||||
**What it removes:**
|
||||
- Temporary files (`*-tmp`, `*-2025-*-tmp`)
|
||||
- MD5 checksum files (`*.md5`)
|
||||
- MD5 checksum files (`*.md5`)
|
||||
- Recovery files (`*recovery*`)
|
||||
- Repaired files (`*repaired*`)
|
||||
- Empty backup files (`*empty-backup*`)
|
||||
@@ -363,7 +457,7 @@ sudo ./cleanup-plex-databases.sh # Perform actual cleanup
|
||||
$ ./test-plex-backup.sh --quick
|
||||
[TEST] Quick smoke test suite
|
||||
[PASS] Database access test
|
||||
[PASS] Service management test
|
||||
[PASS] Service management test
|
||||
[PASS] Backup directory access test
|
||||
[PASS] All 3 tests passed in 15 seconds
|
||||
```
|
||||
@@ -402,7 +496,7 @@ $ ./test-plex-backup.sh --quick
|
||||
Scripts moved to `deprecated/` folder (June 21, 2025):
|
||||
|
||||
- **`plex-database-repair.sh`** → Use `plex-db-manager.sh`
|
||||
- **`recover-plex-database.sh`** → Use `nuclear-plex-recovery.sh`
|
||||
- **`recover-plex-database.sh`** → Use `nuclear-plex-recovery.sh`
|
||||
- **`restore-plex.sh`** → Use `nuclear-plex-recovery.sh`
|
||||
- **`icu-aware-recovery.sh`** → Functionality built into other scripts
|
||||
|
||||
@@ -425,7 +519,7 @@ graph TD
|
||||
I --> A
|
||||
J[integration-test-plex.sh] --> C
|
||||
K[plex-recent-additions.sh]
|
||||
|
||||
|
||||
style A fill:#e1f5fe
|
||||
style C fill:#f3e5f5
|
||||
style F fill:#ffebee
|
||||
@@ -538,7 +632,7 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
|
||||
- Backup success/failure rates
|
||||
- Database integrity status
|
||||
- Service uptime and performance
|
||||
- Service uptime and performance
|
||||
- Disk space utilization
|
||||
- Recovery operation success
|
||||
|
||||
@@ -553,7 +647,7 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
./plex-db-manager.sh check
|
||||
```
|
||||
|
||||
2. **Review Service Status**
|
||||
2. **Review Service Status**
|
||||
```bash
|
||||
./plex.sh status
|
||||
systemctl status plexmediaserver
|
||||
@@ -575,10 +669,10 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
```bash
|
||||
# Always dry-run first
|
||||
sudo ./nuclear-plex-recovery.sh --dry-run
|
||||
|
||||
|
||||
# If satisfied with plan:
|
||||
sudo ./nuclear-plex-recovery.sh --auto
|
||||
|
||||
|
||||
# Validate recovery
|
||||
./validate-plex-recovery.sh
|
||||
```
|
||||
@@ -640,7 +734,7 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
|
||||
**Recent Major Changes (June 21, 2025):**
|
||||
- ✅ Fixed database corruption root cause (30-minute auto-repair loop)
|
||||
- ✅ **DISABLED custom backup system** - Replaced with Plex built-in backups
|
||||
- ✅ **DISABLED custom backup system** - Replaced with Plex built-in backups
|
||||
- ✅ Retired redundant repair scripts to `deprecated/` folder
|
||||
- ✅ Implemented Plex native scheduled backups (every 3 days)
|
||||
- ✅ Created consolidated database manager (`plex-db-manager.sh`)
|
||||
@@ -669,7 +763,7 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
```bash
|
||||
# Check Plex built-in backup status
|
||||
ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/"*.backup.*
|
||||
|
||||
|
||||
# Verify backup location on NAS
|
||||
ls -lah /mnt/share/media/backups/plex/
|
||||
```
|
||||
@@ -678,7 +772,7 @@ ls -lath "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
|
||||
|
||||
❌ **Don't re-enable daily custom backup scripts** (conflicts with Plex built-in)
|
||||
❌ **Don't enable 30-minute auto-repair schedules** (causes corruption)
|
||||
❌ **Don't use force-kill on Plex processes** (corrupts databases)
|
||||
❌ **Don't use force-kill on Plex processes** (corrupts databases)
|
||||
❌ **Don't bypass safety checks** in scripts
|
||||
❌ **Don't run multiple repair operations simultaneously**
|
||||
❌ **Don't ignore failed service shutdowns** (wait for graceful exit)
|
||||
|
||||
Reference in New Issue
Block a user