Add JAV endpoint to watchdog lookup fallback
Problem Description
The watchdog currently only searches on /scenes and /movies endpoints when processing files, but never searches on /jav endpoint, even for JAV (Japanese Adult Video) files like Abf-310.mp4, IPX-123.mp4, etc.
This results in JAV files failing to match and being moved to the failed folder, even though:
- ✅ The
SceneType.JAV enum already exists
- ✅ The
/jav endpoint is already implemented in __build_url()
- ✅ ThePornDB API has a working
/jav endpoint with proper metadata
Current Behavior
When processing a JAV file (e.g., Abf-310.mp4):
- Searches
/scenes → No match
- Searches
/movies → No match
- Stops and fails → File moved to failed folder
Expected Behavior
When processing a JAV file:
- Searches
/scenes → No match
- Searches
/movies → No match
- Searches
/jav → Match found! ✅
- File is correctly renamed and moved to matched folder
Solution Implemented
Modified metadataapi.py in the __metadata_api_lookup() function to add JAV as a third fallback:
File: metadataapi.py (lines ~173-186)
Before:
def __metadata_api_lookup(name_parts: FileInfo, namer_config: NamerConfig, phash: Optional[PerceptualHash] = None) -> List[ComparisonResult]:
scene_type: SceneType = SceneType.SCENE
if name_parts.site: # noqa: SIM102
if name_parts.site.strip().lower() in namer_config.movie_data_preferred:
scene_type = SceneType.MOVIE
results: List[ComparisonResult] = []
results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, scene_type, phash)
if not results or not results[0].is_match():
scene_type = SceneType.MOVIE if scene_type == SceneType.SCENE else SceneType.SCENE
results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, scene_type, phash)
return results
After:
def __metadata_api_lookup(name_parts: FileInfo, namer_config: NamerConfig, phash: Optional[PerceptualHash] = None) -> List[ComparisonResult]:
scene_type: SceneType = SceneType.SCENE
if name_parts.site: # noqa: SIM102
if name_parts.site.strip().lower() in namer_config.movie_data_preferred:
scene_type = SceneType.MOVIE
results: List[ComparisonResult] = []
results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, scene_type, phash)
if not results or not results[0].is_match():
scene_type = SceneType.MOVIE if scene_type == SceneType.SCENE else SceneType.SCENE
results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, scene_type, phash)
# If still no match, try JAV endpoint
if not results or not results[0].is_match():
results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, SceneType.JAV, phash)
return results
Test Results
Tested with Abf-310.mp4:
Logs show successful progression through all endpoints:
Requesting GET "https://api.theporndb.net/scenes?parse=abf.310&limit=25"
Requesting GET "https://api.theporndb.net/movies?parse=abf.310&limit=25"
Requesting GET "https://api.theporndb.net/jav?parse=abf.310&limit=25" ← NEW!
Phash match with 'Prestige - 2026-01-15 - ABF-310 - My Boss, Whom I Admire...'
Match was 60.00 for ABF-310
Result:
- ✅ File correctly matched on
/jav endpoint
- ✅ Renamed to:
Prestige - 2026-01-15 - ABF-310 - My Boss, Whom I Admire...
- ✅ Moved to:
E:\NAMER\MATCHED\JAV\Prestige\
- ✅ Metadata and hashes sent to ThePornDB
- ✅ Poster downloaded
Benefits
- No configuration needed - Works automatically for all files
- No breaking changes - Existing behavior preserved
- Minimal code change - Only 3 lines added
- Uses existing infrastructure - JAV endpoint already implemented
- Better match rate - JAV files no longer fail unnecessarily
Suggested Enhancement (Optional)
For even better JAV support, consider adding a jav_data_preferred configuration option (similar to movie_data_preferred) to prioritize JAV endpoint for specific studios:
# In configuration.py
jav_data_preferred: Sequence[str]
"""
Sequence of sites where JAV endpoint should be prioritized
Common JAV studios: abf, ipx, ssis, cawd, stars, mide, pppe, etc.
"""
This would allow searching /jav first for known JAV studios, rather than as a fallback.
Environment
- OS: Windows
- Namer version: Latest (installed via pip)
- Python version: 3.13
- API: ThePornDB
This modification enables JAV support that was already implemented but never used in the watchdog workflow.
Add JAV endpoint to watchdog lookup fallback
Problem Description
The watchdog currently only searches on
/scenesand/moviesendpoints when processing files, but never searches on/javendpoint, even for JAV (Japanese Adult Video) files likeAbf-310.mp4,IPX-123.mp4, etc.This results in JAV files failing to match and being moved to the failed folder, even though:
SceneType.JAVenum already exists/javendpoint is already implemented in__build_url()/javendpoint with proper metadataCurrent Behavior
When processing a JAV file (e.g.,
Abf-310.mp4):/scenes→ No match/movies→ No matchExpected Behavior
When processing a JAV file:
/scenes→ No match/movies→ No match/jav→ Match found! ✅Solution Implemented
Modified
metadataapi.pyin the__metadata_api_lookup()function to add JAV as a third fallback:File:
metadataapi.py(lines ~173-186)Before:
After:
Test Results
Tested with
Abf-310.mp4:Logs show successful progression through all endpoints:
Result:
/javendpointPrestige - 2026-01-15 - ABF-310 - My Boss, Whom I Admire...E:\NAMER\MATCHED\JAV\Prestige\Benefits
Suggested Enhancement (Optional)
For even better JAV support, consider adding a
jav_data_preferredconfiguration option (similar tomovie_data_preferred) to prioritize JAV endpoint for specific studios:This would allow searching
/javfirst for known JAV studios, rather than as a fallback.Environment
This modification enables JAV support that was already implemented but never used in the watchdog workflow.