Skip to content

Conversation

@Teagan42
Copy link
Contributor

What

  • batch IMDb metadata requests using titles:batchGet
  • test batched IMDb fetching
  • bump version to 0.26.21

Why

  • reduce repeated IMDb API calls during load

Affects

  • mcp_plex/loader.py
  • tests/test_load_from_plex.py
  • tests/test_loader_unit.py
  • AGENTS.md
  • pyproject.toml
  • uv.lock

Testing

  • uv run ruff check .
  • uv run pytest

Documentation

  • n/a

https://chatgpt.com/codex/tasks/task_e_68c66a1efd5c83288197ab2d57a50747

Copilot AI review requested due to automatic review settings September 14, 2025 07:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds batching capability for IMDb API requests to reduce API calls and improve performance during metadata loading.

  • Implements a new _fetch_imdb_batch function that uses the titles:batchGet endpoint for multiple IMDb IDs
  • Refactors the Plex loading logic to collect IMDb IDs first and fetch them in batches
  • Adds logging to track batch processing progress

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mcp_plex/loader.py Implements batched IMDb fetching and refactors movie/episode loading to use batch requests
tests/test_loader_unit.py Adds unit test for the new batch IMDb fetching function
tests/test_load_from_plex.py Updates integration test to mock the new batch endpoint
tests/test_gather_in_batches.py Adds logging test for batch processing progress
pyproject.toml Bumps version to 0.26.21
AGENTS.md Documents the new IMDb batching optimization
Comments suppressed due to low confidence (1)

tests/test_load_from_plex.py:119

  • The test is calling _gather_in_batches with batch_size=1, but the actual batching functionality for IMDb requests (via _fetch_imdb_batch) is not being tested. Consider adding a test that verifies IMDb requests are properly batched together.
    items = asyncio.run(loader._load_from_plex(server, "key", batch_size=1))
    assert calls == [(1, 1), (2, 1)]

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
mcp_plex
   cache.py36489%22, 50–52
   imdb_cache.py20290%17–18
   loader.py3453889%33–35, 88, 102–103, 107, 114–121, 130, 132–134, 149–150, 163, 170, 238, 256, 268, 270, 516–518, 528, 531–535, 660, 915
   server.py2982293%59–60, 102–103, 226, 454, 458, 480–486, 518, 528, 559–560, 577–578, 601, 604–605, 663
TOTAL8246692% 

Tests Skipped Failures Errors Time
37 0 💤 0 ❌ 0 🔥 26.991s ⏱️

@Teagan42 Teagan42 merged commit 2cfb090 into main Sep 14, 2025
4 checks passed
@Teagan42 Teagan42 deleted the codex/enhance-logging-in-loader.py branch September 14, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants