Commit Graph

405 Commits

Author SHA1 Message Date
sbcrumb a559873999 release: Clean up debug logging and bump to v2.1.0
Local Docker Build (Dev) / build-dev (push) Successful in 4s
FEATURES ADDED:
- Comprehensive TV IMDb detection (folder/filename/NFO)
- TV show batch validation prevents wrong series processing
- Fixed glob pattern for exact IMDb matching
- Enhanced webhook path mapping reliability

CLEANUP:
- Removed temporary debug print statements
- Clean production-ready logging
- Maintains all core improvements from debugging session

FIXES:
- Resolves Girls (2012) vs Golden Girls matching issue
- Proper bracket escaping in glob patterns
- Comprehensive IMDb detection for both movies and TV shows
2025-10-12 11:15:20 -04:00
sbcrumb baa6474d12 debug: Force path mapper debug logging to diagnose webhook path mapping failure
Local Docker Build (Dev) / build-dev (push) Successful in 4s
- Enable path_debug temporarily during webhook path mapping
- Version 2.0.28 to track path mapping diagnostics
- Should show Sonarr root folder matching and TV path mapping logic
2025-10-12 11:06:02 -04:00
sbcrumb 1a98c406a2 Merge pull request 'sonarr-matching' (#49) from sonarr-matching into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #49
2025-10-12 11:03:40 -04:00
sbcrumb 97aa2042a3 Merge branch 'dev' into sonarr-matching
Local Docker Build (Dev) / build-dev (pull_request) Successful in 3s
2025-10-12 11:03:33 -04:00
sbcrumb 53d7753231 sonarr-matching (#48)
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #48
2025-10-12 11:02:36 -04:00
sbcrumb 7216491d76 debug: Add comprehensive webhook path mapping debug logging
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
- Track webhook path provided from Sonarr webhooks
- Show path mapper availability and mapping results
- Trace why webhook paths fail and fallback to search occurs
- Version 2.0.27 for webhook path debugging
2025-10-12 11:01:59 -04:00
sbcrumb a5b2381023 resolve: Fix version conflict - use 2.0.26 from dev branch
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
2025-10-12 10:59:50 -04:00
sbcrumb 80df0a0278 chore: Bump version to 2.0.26 for enhanced debug logging
Local Docker Build (Dev) / build-dev (push) Successful in 4s
2025-10-12 10:57:33 -04:00
sbcrumb e780b9e125 debug: Add comprehensive logging to path search and title fallback
- Show all search paths being checked and their existence status
- Debug title fallback logic showing cleaned title comparisons
- Track exactly where false matches occur (e.g., 'girls' in 'thegoldengirls')
- Identify why only some search paths are processed
2025-10-12 10:57:20 -04:00
sbcrumb 59f562c2fa Merge pull request 'sonarr-matching' (#46) from sonarr-matching into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #46
2025-10-12 10:53:50 -04:00
sbcrumb 716dcc05e8 chore: Bump version to 2.0.25 for sonarr-matching fixes
- Increment version for comprehensive TV IMDb detection fixes
- Includes glob pattern fix and batch validation improvements
- Ready for deployment and testing
2025-10-12 10:53:50 -04:00
sbcrumb 000d57e9fe debug: Add logging to find_media_path_by_imdb_and_title to trace search behavior
- Add debug prints to see glob patterns being used
- Track number of matches found and which paths are returned
- Help diagnose why wrong TV series paths are still being found
2025-10-12 10:53:50 -04:00
sbcrumb a0f676a368 chore: Bump version to 2.0.25 for sonarr-matching fixes
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
- Increment version for comprehensive TV IMDb detection fixes
- Includes glob pattern fix and batch validation improvements
- Ready for deployment and testing
2025-10-12 10:52:48 -04:00
sbcrumb 60bbf9440a debug: Add logging to find_media_path_by_imdb_and_title to trace search behavior
- Add debug prints to see glob patterns being used
- Track number of matches found and which paths are returned
- Help diagnose why wrong TV series paths are still being found
2025-10-12 10:51:52 -04:00
sbcrumb a3f7fbe68e Merge pull request 'fix: Correct IMDb ID pattern matching in TV show webhook processing' (#45) from sonarr-matching into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #45
2025-10-12 10:47:02 -04:00
sbcrumb 348f83d547 feat: Add comprehensive IMDb detection for TV shows
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
- Add find_series_imdb_id method to check directory, filenames, and tvshow.nfo
- Add TV show batch validation in webhook batcher (like movies)
- Ensures TV webhooks process correct series by validating IMDb match
- Prevents mismatched processing like Girls (2012) -> Gachiakuta (2025)
- Comprehensive detection checks: folder name, file names, NFO content
2025-10-12 10:46:43 -04:00
sbcrumb 41bccb82b1 fix: Correct IMDb ID pattern matching in TV show webhook processing
- Fix glob pattern to escape brackets for literal [imdb-ID] matching
- Resolves issue where webhook for Girls (2012) [tt1723816] was incorrectly matching Gachiakuta (2025) [tt32612521]
- Previous pattern treated brackets as character sets instead of literal strings
2025-10-12 10:42:26 -04:00
sbcrumb 0827d30a76 Fix NFO extraction to handle lockdata+aired but no dateadded
Local Docker Build (Dev) / build-dev (push) Successful in 3s
The root issue was that NFO extraction methods required both dateadded
AND lockdata=true to return any data. But "The Chosen" NFOs have
lockdata=true and aired dates but no dateadded field, so extraction
returned None and TIER 2 fallback logic never triggered.

Changes:
- Modified extract_nfoguard_dates_from_nfo() to accept lockdata=true NFOs
- Added support for extracting aired dates from episode NFOs
- Updated logic to return data when lockdata=true regardless of dateadded
- Now TIER 2 will properly apply aired->dateadded fallback logic
- Updated version to 2.0.24

This ensures episodes with incomplete NFO metadata get proper fallback
processing instead of being ignored by the three-tier system.

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-10-11 14:38:37 -04:00
sbcrumb 5b9f5c44e1 Fix TV processor TIER 2 fallback logic for NFO files with aired but no dateadded
Local Docker Build (Dev) / build-dev (push) Successful in 4s
The issue was that TIER 2 (NFO cache) wasn't applying the aired date fallback
when NFO files contained aired dates but no dateadded values. This caused
episodes like "The Chosen" to show "no date added just air" because the
system would find lockdata in TIER 2 but reject it due to missing dateadded,
without applying the fallback logic.

Changes:
- Enhanced TIER 2 NFO processing to apply aired->dateadded fallback
- Added debug logging for NFO fallback cases
- Updated version to 2.0.23

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-10-11 13:12:36 -04:00
sbcrumb 21bfb97f4b Merge pull request 'update 2' (#44) from missin-sonarr into dev
Local Docker Build (Dev) / build-dev (push) Successful in 3s
Reviewed-on: #44
2025-10-11 09:49:53 -04:00
sbcrumb 14d551fc36 update 2
Local Docker Build (Dev) / build-dev (pull_request) Successful in 3s
2025-10-11 09:49:14 -04:00
sbcrumb be075f884e Merge pull request 'Implement optimal caching hierarchy for both movies and TV shows' (#43) from sonarrissues into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #43
2025-10-10 16:18:34 -04:00
sbcrumb fb3040c554 Implement optimal caching hierarchy for both movies and TV shows
Perfect the caching strategy as requested:
1. Database check first (fastest lookup)
2. NFO file extraction with database caching
3. API calls only when absolutely necessary

Movies: Fixed order from NFO->DB->API to DB->NFO->API
TV Shows: Added missing NFO extraction tier between database and API

Benefits:
- First scan: Extract existing NFOGuard data from NFOs and cache in DB
- Subsequent scans: ~99% database cache hits, minimal API calls
- NFO recovery: Rebuild database from existing NFO files
- Webhook processing: Cache webhook dates in database immediately

Expected performance: Manual scans now use 3-tier optimization
2025-10-10 16:18:34 -04:00
sbcrumb e609c32df0 Merge pull request 'sonarrissues' (#42) from sonarrissues into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #42
2025-10-10 15:31:28 -04:00
sbcrumb 88b75230a7 Bump version to 2.0.21 to resolve merge conflict with dev branch
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
2025-10-10 15:30:06 -04:00
sbcrumb 035f2f6e02 Optimize TV processor performance with database-first episode lookup
Major performance improvement for manual scans:
- Check NFOGuard database before making Sonarr API calls
- Only query Sonarr history for episodes missing from database
- Filter Sonarr episode processing to only needed episodes
- Add detailed logging for cache hits vs API calls

Expected improvement: 172 API calls -> 0-10 API calls for typical scans
2025-10-10 15:30:06 -04:00
sbcrumb 76dcc0be33 Merge pull request 'Fix rename webhook targeting using episodeId lookup' (#39) from sonarrissues into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #39
2025-10-10 14:17:05 -04:00
sbcrumb d6c1b73959 Fix rename webhook targeting using episodeId lookup
Found that rename events contain episodeId field which can be used to fetch specific episode details. Replaced complex episode data extraction with direct API call to /api/v3/episode/{episodeId} to get season/episode numbers for targeted processing.

This should resolve rename webhooks processing entire series instead of single episodes.
2025-10-10 14:17:05 -04:00
sbcrumb ace671ab08 Merge pull request 'Add comprehensive rename event debugging' (#38) from sonarrissues into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #38
2025-10-10 14:11:53 -04:00
sbcrumb e03249bb36 Add comprehensive rename event debugging
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
Enhanced debugging for Sonarr rename events to understand the actual structure of episodeFileRenamed history records. Added checks for episode data in multiple possible locations (episode, episodeFile, data objects) to identify why season/episode information is missing.

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-10-10 14:11:07 -04:00
sbcrumb f78e8cf924 Merge pull request 'fix: Improve Sonarr history API query for rename events' (#37) from sonarr-api into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #37
2025-10-10 14:03:40 -04:00
sbcrumb a5eb23e886 fix: Improve Sonarr history API query for rename events
- Remove invalid eventType parameter that was causing 400 error
- Fetch recent history and filter client-side for episodeFileRenamed events
- Add better datetime parsing for event filtering
- Increase page size to 50 to catch more recent events
2025-10-10 14:03:40 -04:00
sbcrumb fe59875719 Merge pull request 'fix: Use environment variable directly for Sonarr API key' (#36) from sonarr-api into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #36
2025-10-10 11:17:29 -04:00
sbcrumb 4dff85c5c9 fix: Use environment variable directly for Sonarr API key
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
- Changed from config.sonarr_api_key to os.environ.get('SONARR_API_KEY', '')
- Matches pattern used in tv_processor.py for Sonarr API access
2025-10-10 11:17:02 -04:00
sbcrumb d12a634dd1 Merge pull request 'fix: Correct config attribute name for Sonarr URL in rename webhook handler' (#35) from rename-sonarr into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #35
2025-10-10 11:07:49 -04:00
sbcrumb 0e24f74dcb fix: Correct config attribute name for Sonarr URL in rename webhook handler
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s
- Changed config.sonarr_base_url to config.sonarr_url to match actual config object
- Fixes AttributeError that was preventing rename webhook targeting from working
2025-10-10 11:02:53 -04:00
sbcrumb 6e70497be2 Merge pull request 'fix: Add targeted mode for rename webhooks using Sonarr history API' (#34) from rename into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #34
2025-10-10 10:40:16 -04:00
sbcrumb 3d0dae995a fix: Add targeted mode for rename webhooks using Sonarr history API
- Rename webhooks don't include episodeFile data from Sonarr
- Added fallback to query recent episodeFileRenamed events from history
- Uses 1-hour window to find most recent rename for targeted processing
- Prevents full series processing on single episode renames
2025-10-10 10:40:16 -04:00
sbcrumb 74c30d647e Merge pull request 'rename' (#33) from rename into dev
Local Docker Build (Dev) / build-dev (push) Successful in 3s
Reviewed-on: #33
2025-10-10 10:31:12 -04:00
sbcrumb 5cc7281f06 bump: Version 2.0.13 for rename webhook debug logging
Local Docker Build (Dev) / build-dev (pull_request) Successful in 3s
2025-10-10 10:30:31 -04:00
sbcrumb 6e15d79b8f debug: Add comprehensive logging for rename webhook episodeFile analysis 2025-10-10 10:29:15 -04:00
sbcrumb f98fa9626c Merge pull request 'sonarr-all' (#32) from sonarr-all into dev
Local Docker Build (Dev) / build-dev (push) Successful in 3s
Reviewed-on: #32
2025-10-09 18:13:06 -04:00
sbcrumb 3787ca2d23 Fix all Sonarr webhooks: Force targeted processing for single episodes
Local Docker Build (Dev) / build-dev (pull_request) Successful in 3s
- Extend episodeFile extraction to ALL webhook types (Download, Rename, Upgrade)
- Force targeted mode when episodes_data has ≤3 episodes to prevent full series processing
- Add debug logging to track episode extraction and processing mode decisions
- Prevents processing 177 episodes when only 1-3 episodes are involved
- Applies to imports, renames, and upgrades - not just renames
- Version bump to 2.0.12

This ensures that single episode operations (most common) only process the specific
episode(s) involved instead of scanning the entire series.
2025-10-09 18:11:47 -04:00
sbcrumb e897656396 Fix TV rename webhooks: Implement targeted episode processing
- Extract episode info from episodeFile when webhook.episodes is empty for rename events
- Create proper episode data structure for process_webhook_episodes method
- Prevents full series processing (177 episodes) for single episode renames
- Dramatically improves performance for rename operations
- Version bump to 2.0.11

Resolves issue where rename webhooks were falling back to full series processing instead of targeted mode.
2025-10-09 18:10:11 -04:00
sbcrumb 84322d91d0 Merge pull request 'Fix TV webhook processing: Add missing process_webhook_episodes method' (#31) from tv-webhook into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #31
2025-10-09 18:04:19 -04:00
sbcrumb ed78a81a8e Fix TV webhook processing: Add missing process_webhook_episodes method
- Add process_webhook_episodes method to TVProcessor class for targeted episode processing
- Implement helper methods: _parse_episode_from_filename, _get_sonarr_series_metadata, _get_episode_metadata, _extract_title_from_filename, _get_webhook_episode_date
- Enables webhook-based episode processing with title extraction and metadata handling
- Resolves 'TVProcessor' object has no attribute 'process_webhook_episodes' error
- Version bump to 2.0.10
2025-10-09 18:04:19 -04:00
sbcrumb 7ff2de6e66 Merge pull request 'sonarr-date' (#30) from sonarr-date into dev
Local Docker Build (Dev) / build-dev (push) Successful in 24s
Reviewed-on: #30
2025-10-05 10:43:34 -04:00
sbcrumb 5ade28c118 fix: Only fallback to airdate when Sonarr has no import date
Local Docker Build (Dev) / build-dev (pull_request) Successful in 23s
- Modified fallback logic to only use airdate as dateadded when source is NOT 'sonarr:history.import'
- This prevents using airdate fallback when Sonarr has valid import dates available
- Ensures Sonarr import dates are prioritized over airdate fallbacks
- Addresses issue where episodes with valid Sonarr import dates were still falling back to airdates
2025-10-05 10:42:35 -04:00
sbcrumb 191e6f5f3f fix: Use Sonarr import history for TV episode date detection
- Modified _get_sonarr_episodes to call get_episode_import_history() for each episode
- This retrieves actual import dates from Sonarr's history API instead of just episodeFile.dateAdded
- Added fallback to episodeFile.dateAdded if history lookup fails
- Updated source tracking to use 'sonarr:history.import' for better debugging
- Added debug logging to show which method found the import date
- Should resolve issue where episodes fall back to aired dates despite valid Sonarr imports
2025-10-05 10:29:13 -04:00
sbcrumb 0dafcd64b2 Merge code-remove branch with TV processing fixes
Local Docker Build (Dev) / build-dev (push) Successful in 24s
Resolves TV series processing errors by fixing method calls and adding missing functionality:
- Fixed SonarrClient method names (series_by_imdb, episodes_for_series)
- Added missing get_episode_air_date method to ExternalClientManager
- Merged into dev branch at version 2.0.7
2025-10-04 11:43:37 -04:00