Skip to content

Watchdog isn't working for JAV files but can be easyly corrected. #294

@ultimatemagenta

Description

@ultimatemagenta

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):

  1. Searches /scenes → No match
  2. Searches /movies → No match
  3. Stops and fails → File moved to failed folder

Expected Behavior

When processing a JAV file:

  1. Searches /scenes → No match
  2. Searches /movies → No match
  3. Searches /jav → Match found! ✅
  4. 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

  1. No configuration needed - Works automatically for all files
  2. No breaking changes - Existing behavior preserved
  3. Minimal code change - Only 3 lines added
  4. Uses existing infrastructure - JAV endpoint already implemented
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions