@@ -20,13 +20,16 @@ services:
2020 image : ghcr.io/nullable-eth/labelarr:latest
2121 container_name : labelarr
2222 restart : unless-stopped
23+ volumes :
24+ - ./labelarr-data:/data
25+ - ./exports:/data/exports # Mount host directory for export files
2326 environment :
2427 # Required - Get from Plex Web (F12 → Network → X-Plex-Token)
2528 - PLEX_TOKEN=your_plex_token_here
2629 # Required - Get from https://www.themoviedb.org/settings/api
2730 - TMDB_READ_ACCESS_TOKEN=your_tmdb_read_access_token
2831 # Required - Your Plex server details
29- - PLEX_SERVER=localhost
32+ - PLEX_SERVER=plex
3033 - PLEX_PORT=32400
3134 - PLEX_REQUIRES_HTTPS=true
3235 # Process all libraries (recommended for first-time users)
@@ -42,6 +45,9 @@ services:
4245 # - USE_SONARR=true
4346 # - SONARR_URL=http://sonarr:8989
4447 # - SONARR_API_KEY=your_sonarr_api_key
48+ # Optional export functionality
49+ # - EXPORT_LABELS=action,comedy,thriller,documentary,kids
50+ # - EXPORT_LOCATION=/data/exports
4551```
4652
4753** Run:** ` docker-compose up -d `
@@ -64,6 +70,7 @@ services:
6470- ** 🔄 Force Update Mode** - Reprocess all items regardless of previous processing status
6571- ** 🧹 Smart Duplicate Cleaning** - Automatically removes old unnormalized keywords when adding normalized versions
6672- ** 🔒 Enhanced Error Handling** - Better authentication and connection testing
73+ - ** 📤 Export Functionality** - Generate file lists for specific labels to sync content or create backups
6774
6875---
6976
@@ -160,7 +167,13 @@ services:
160167
161168- `USE_SONARR=true` - Enable Sonarr integration (default : ` false` )
162169- ` SONARR_URL=http://localhost:8989` - Your Sonarr instance URL
163- - ` SONARR_API_KEY=your_api_key` - Your Sonarr API key
170+ - ` SONARR_API_KEY=your_sonarr_api_key` - Your Sonarr API key
171+
172+ **Export Integration (Optional):**
173+
174+ - ` EXPORT_LABELS=action,comedy,thriller` - Comma-separated list of labels to export file paths for
175+ - ` EXPORT_LOCATION=/path/to/export` - Directory where export files will be created
176+ - `EXPORT_MODE=txt` - Export format : ` txt` (default) or `json`
164177
165178</details>
166179
@@ -189,6 +202,13 @@ Labelarr now supports automatic TMDb ID detection through Radarr and Sonarr APIs
189202- ✅ **Automatic fallback** - If Radarr/Sonarr doesn't have the item, falls back to file path detection
190203- ✅ **Optional integration** - Enable only if you use Radarr/Sonarr
191204
205+ # ## ⚡ **Performance Considerations**
206+
207+ - **File path detection is faster** - If your file paths consistently contain TMDb IDs, file path detection is significantly faster than API calls
208+ - **Radarr/Sonarr integration adds latency** - Each API lookup introduces network overhead and processing time
209+ - **Recommendation**: Use file path detection (with TMDb IDs in filenames/folders) as your primary method for best performance
210+ - **When to use APIs**: Only enable Radarr/Sonarr integration if your file paths don't contain TMDb IDs or are inconsistently formatted
211+
192212# ## How It Works
193213
1942141. **For Movies (Radarr)** :
@@ -295,6 +315,276 @@ The TMDb ID detection is very flexible and supports various formats:
295315
296316</details>
297317
318+ <details id="export-functionality">
319+ <summary><h3 style="margin: 0; display: inline;">📤 Export Functionality</h3></summary>
320+
321+ Labelarr can automatically export file paths for media items that have specific labels, creating organized lists perfect for syncing content to alternate locations or creating backup sets.
322+
323+ ### 🎯 **What It Does**
324+
325+ - **Scans all processed media** for items containing specified labels
326+ - **Creates separate text files** for each export label (e.g., `action.txt`, `comedy.txt`)
327+ - **Lists full file paths** of matching movies and TV show episodes
328+ - **Updates files** after each processing run with current results
329+ - **Preserves existing files** until new export data is ready
330+
331+ ### 🔧 **Configuration**
332+
333+ Add these environment variables to enable export functionality:
334+
335+ ```yaml
336+ environment:
337+ # Specify which labels to export (comma-separated, case-insensitive)
338+ - EXPORT_LABELS=action,comedy,thriller,documentary
339+ # Directory where export files will be created
340+ - EXPORT_LOCATION=/data/exports
341+ # Export format: txt (default) creates separate files, json creates single comprehensive file
342+ - EXPORT_MODE=txt
343+ # ... other labelarr config ...
344+ ```
345+
346+ ** Complete Docker Compose Example with Export:**
347+
348+ ``` yaml
349+ services :
350+ labelarr :
351+ image : ghcr.io/nullable-eth/labelarr:latest
352+ container_name : labelarr
353+ restart : unless-stopped
354+ volumes :
355+ - ./labelarr-data:/data
356+ - ./exports:/data/exports # Mount host directory for export files
357+ environment :
358+ - PLEX_TOKEN=your_plex_token_here
359+ - TMDB_READ_ACCESS_TOKEN=your_tmdb_token
360+ - PLEX_SERVER=plex
361+ - PLEX_PORT=32400
362+ - MOVIE_PROCESS_ALL=true
363+ - TV_PROCESS_ALL=true
364+ # Export configuration
365+ - EXPORT_LABELS=action,comedy,thriller,documentary,kids
366+ - EXPORT_LOCATION=/data/exports
367+ - EXPORT_MODE=txt
368+ ` ` `
369+
370+ ### 📁 **Output Example**
371+
372+ With ` EXPORT_LABELS=action,comedy,kids` and `EXPORT_LOCATION=/data/exports`, Labelarr will create library-specific subdirectories:
373+
374+ # ### **Text Mode (Default)**
375+
376+ ```
377+ /data/exports/
378+ ├── summary.txt # Detailed statistics and file sizes
379+ ├── Movies/ # Movie library exports
380+ │ ├── action.txt # Action movies only
381+ │ ├── comedy.txt # Comedy movies only
382+ │ └── kids.txt # Kids movies only
383+ └── TV Shows/ # TV show library exports
384+ ├── action.txt # Action TV shows only
385+ ├── comedy.txt # Comedy TV shows only
386+ └── kids.txt # Kids TV shows only
387+ ```
388+
389+ #### **JSON Mode**
390+
391+ With `EXPORT_MODE=json`, Labelarr creates a single comprehensive JSON file:
392+
393+ ```
394+ /data/exports/
395+ └── export.json # Complete export data with statistics
396+ ```
397+
398+ Each file contains full paths to matching media from that specific library:
399+
400+ **Movies/action.txt:**
401+
402+ ```
403+ /data/movies/John Wick (2014)/John Wick (2014) (Bluray-1080p).mkv
404+ /data/movies/Mad Max Fury Road (2015)/Mad Max Fury Road (2015) (Bluray-2160p).mkv
405+ /data/movies/The Dark Knight (2008)/The Dark Knight (2008) (Bluray-2160p).mkv
406+ ```
407+
408+ **TV Shows/action.txt:**
409+
410+ ```
411+ /data/tv/Breaking Bad (2008)/Season 01/Breaking Bad S01E01 (1080p).mkv
412+ /data/tv/Breaking Bad (2008)/Season 01/Breaking Bad S01E02 (1080p).mkv
413+ /data/tv/24 (2001)/Season 01/24 S01E01 (1080p).mkv
414+ ```
415+
416+ **export.json structure:**
417+
418+ ```json
419+ {
420+ "generated_at": "2024-01-15 14:30:25",
421+ "export_mode": "json",
422+ "libraries": {
423+ "Movies": {
424+ "action": [
425+ {
426+ "path": "/data/movies/John Wick (2014)/John Wick (2014) (Bluray-1080p).mkv",
427+ "size": 4832716800
428+ },
429+ {
430+ "path": "/data/movies/Mad Max Fury Road (2015)/Mad Max Fury Road (2015) (Bluray-2160p).mkv",
431+ "size": 8945283072
432+ }
433+ ],
434+ "comedy": [
435+ {
436+ "path": "/data/movies/The Hangover (2009)/The Hangover (2009) (Bluray-1080p).mkv",
437+ "size": 3221225472
438+ }
439+ ]
440+ },
441+ "TV Shows": {
442+ "action": [
443+ {
444+ "path": "/data/tv/Breaking Bad (2008)/Season 01/Breaking Bad S01E01 (1080p).mkv",
445+ "size": 2147483648
446+ }
447+ ]
448+ }
449+ },
450+ "summary": {
451+ "total_files": 1247,
452+ "total_size": 2748779069440,
453+ "total_size_formatted": "2.5 TB",
454+ "library_stats": {
455+ "Movies": {
456+ "total_files": 156,
457+ "total_size": 790495232000,
458+ "total_size_formatted": "736.0 GB",
459+ "labels": {
460+ "action": {
461+ "count": 89,
462+ "size": 478150656000,
463+ "size_formatted": "445.2 GB"
464+ },
465+ "comedy": {
466+ "count": 67,
467+ "size": 312344576000,
468+ "size_formatted": "290.8 GB"
469+ }
470+ }
471+ }
472+ },
473+ "label_totals": {
474+ "action": {
475+ "count": 632,
476+ "size": 1797564416000,
477+ "size_formatted": "1.6 TB"
478+ },
479+ "comedy": {
480+ "count": 615,
481+ "size": 1052901376000,
482+ "size_formatted": "980.3 GB"
483+ }
484+ }
485+ }
486+ }
487+ ```
488+
489+ ** summary.txt:**
490+
491+ ```
492+ Labelarr Export Summary
493+ Generated: 2024-01-15 14:30:25
494+
495+ 📁 Export Files Generated:
496+ Movies/action.txt
497+ Movies/comedy.txt
498+ TV Shows/action.txt
499+ TV Shows/comedy.txt
500+
501+ 📊 Overall Statistics:
502+ Total files: 1,247
503+ Total size: 2.5 TB (2,748,779,069,440 bytes)
504+
505+ 📚 Library Breakdown:
506+
507+ Movies:
508+ action.txt: 89 files, 445.2 GB (478,150,656,000 bytes)
509+ comedy.txt: 67 files, 290.8 GB (312,344,576,000 bytes)
510+ Library total: 156 files, 736.0 GB (790,495,232,000 bytes)
511+
512+ TV Shows:
513+ action.txt: 543 files, 1.2 TB (1,319,413,760,000 bytes)
514+ comedy.txt: 548 files, 689.5 GB (740,556,800,000 bytes)
515+ Library total: 1,091 files, 1.8 TB (2,059,970,560,000 bytes)
516+
517+ 🏷️ Label Totals (All Libraries):
518+ action: 632 files, 1.6 TB (1,797,564,416,000 bytes)
519+ comedy: 615 files, 980.3 GB (1,052,901,376,000 bytes)
520+ ```
521+
522+ ### 🔄 ** Use Cases**
523+
524+ ** Content Syncing:**
525+
526+ - Export specific genres to sync to mobile devices or remote locations
527+ - Create curated collections for different family members
528+ - Sync action movies to gaming setup, kids content to tablets
529+ - ** Sync specific content to alternate Plex servers** for distributed media setups
530+ - ** Separate movie and TV exports** for different sync destinations
531+ - ** JSON format for programmatic processing** of export data with file sizes and metadata
532+
533+ ** Backup Management:**
534+
535+ - Generate lists of premium content for priority backup
536+ - Create separate backup sets by genre or rating
537+ - Export documentary collections for educational archives
538+ - ** Create targeted backup lists** for specific movies/TV shows
539+ - ** Library-specific backup strategies** (movies vs TV shows)
540+ - ** JSON export for automated backup tools** that need file size information
541+
542+ ** Media Organization:**
543+
544+ - Generate playlists for external media players
545+ - Create file lists for batch operations (transcoding, moving, etc.)
546+ - Export specific content types for different storage tiers
547+ - ** Organize exports by library type** for easier management
548+ - ** API integration with JSON format** for custom media management tools
549+
550+ ### 🚀 ** Performance**
551+
552+ - ** Memory efficient** : Accumulates paths during processing, writes once at completion
553+ - ** Atomic updates** : Existing export files preserved until new data is ready
554+ - ** Minimal overhead** : Only ~ 2-5 MB RAM usage for large libraries (10K+ items)
555+
556+ ### 💡 ** Tips**
557+
558+ - ** Label names are case-insensitive** : ` Action ` , ` action ` , and ` ACTION ` all match
559+ - ** Multiple labels per item** : Movies with both "action" and "comedy" labels appear in both export files
560+ - ** Empty files created** : Labels with no matches still get empty ` .txt ` files for consistency (text mode)
561+ - ** File paths included** : Both movie files and all TV show episode files are included
562+ - ** Library separation** : Files are organized by Plex library (e.g., ` Movies/action.txt ` vs ` TV Shows/action.txt ` ) in text mode
563+ - ** Library names sanitized** : Special characters in library names are replaced with underscores for valid folder names
564+ - ** Summary statistics** : ` summary.txt ` provides detailed file counts, sizes, and breakdowns by library and label (text mode)
565+ - ** File sizes from Plex** : Uses Plex metadata for accurate file sizes without filesystem access
566+ - ** JSON export includes everything** : Single file with all data, file sizes, and comprehensive statistics
567+ - ** Choose format based on use case** : Use ` txt ` for simple file lists, ` json ` for programmatic processing
568+
569+ ### ⚠️ ** Important Notes**
570+
571+ ** Container File Paths:**
572+
573+ - Exported file paths reflect your ** Plex container's internal file system**
574+ - If using volume mounts (e.g., ` -v /host/media:/data/media ` ), paths may need processing
575+ - Example: Plex sees ` /data/media/movies/... ` but host filesystem has ` /mnt/nas/movies/... `
576+ - Consider path mapping/replacement when using exported files outside the container environment
577+
578+ ** Path Processing Example:**
579+
580+ ``` bash
581+ # If Plex container mounts: -v /mnt/nas/media:/data/media
582+ # Export shows: /data/media/movies/Action Movie.mkv
583+ # You may need: /mnt/nas/media/movies/Action Movie.mkv
584+ ```
585+
586+ </details >
587+
298588<details id =" advanced-configuration " >
299589<summary ><h3 style =" margin : 0 ; display : inline ;" >🔧 Advanced Configuration</h3 ></summary >
300590
0 commit comments