Skip to content

Add show-missing command to compare local collections with site collages#166

Merged
marceljungle merged 7 commits intodevelopfrom
copilot/fix-165
Aug 18, 2025
Merged

Add show-missing command to compare local collections with site collages#166
marceljungle merged 7 commits intodevelopfrom
copilot/fix-165

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 18, 2025

This PR implements a new red-plex collages show-missing <collage_id> command that helps users identify torrent groups missing from their local collections compared to the current state of site collages.

Features

The new command:

  • Compares local collection data stored in the database with the current collage state on RED/OPS
  • Identifies torrent groups that exist on the site but are missing locally
  • Displays detailed information for each missing group including artist names, album names, and direct torrent links
  • Works seamlessly with both RED and OPS sites using stored site configuration
  • Provides helpful error messages and usage suggestions

Usage

red-plex collages show-missing 12345

Example output:

Checking collage 'Best Albums 2023' (ID: 12345) on RED...

Found 2 missing group(s) in your local collection:
================================================================================
  1. Artist Name - Album Title
     Link: https://redacted.sh/torrents.php?id=1004

  2. Another Artist - Another Album  
     Link: https://redacted.sh/torrents.php?id=1005
================================================================================

Implementation Details

  • Use case pattern: Following project architecture, business logic is contained in ShowMissingUseCase in the use_case directory
  • Structured responses: Created ShowMissingResponse and MissingGroupInfo models for clean data handling
  • Separation of concerns: CLI command focuses on user interaction while use case handles business logic
  • New database method: Added get_collage_collection_by_external_id() to retrieve collections by their site collage ID rather than internal rating key
  • Robust error handling: Handles missing collections, API failures, and configuration issues gracefully
  • Rate limiting: Leverages existing Gazelle API rate limiting infrastructure
  • Code quality: Follows project conventions and maintains clean architecture

The command integrates naturally with the existing collages workflow - users can identify missing content and then use the existing update command to sync their collections.

Fixes #165.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 18, 2025 17:34
Co-authored-by: marceljungle <44347173+marceljungle@users.noreply.github.com>
Co-authored-by: marceljungle <44347173+marceljungle@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a show-missing command to get missing groups from the local collection Add show-missing command to compare local collections with site collages Aug 18, 2025
Copilot AI requested a review from marceljungle August 18, 2025 17:41
@marceljungle
Copy link
Copy Markdown
Owner

@copilot some things to do:

  • Remove this message from the end:

    To add these missing groups to your local collection, run:
    red-plex collages update 14228
    
  • Don't you think it would be a better idea to move the implementation to an use case inside use_case dir? And leave inside the commands/collage.py only the call to the use case? Or maybe create a service inside infrastructure/service? What do you think it is better?

- Remove the message suggesting to run 'red-plex collages update'
- Move business logic from CLI command to new ShowMissingUseCase in use_case directory
- Create ShowMissingResponse and MissingGroupInfo models for structured data handling
- Update CLI command to use the new use case pattern, following project architecture
- Maintain same functionality while improving code organization and separation of concerns

Co-authored-by: marceljungle <44347173+marceljungle@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 18, 2025

@copilot some things to do:

  • Remove this message from the end:

...

Done! I've addressed both requests:

  1. ✅ Removed the suggestion message at the end that recommended running red-plex collages update
  2. ✅ Refactored the implementation following the use case pattern - moved business logic to ShowMissingUseCase in the use_case directory

The CLI command now focuses solely on user interaction while the use case handles all the business logic. This follows the existing project architecture pattern used by other commands like the collection processor.

Changes in commit 714a1fe.

@marceljungle
Copy link
Copy Markdown
Owner

@copilot don't you think it's better to have _get_base_url() along with this line torrent_url = f"{base_url}/torrents.php?id={group_id}" outside the use case? Maybe a method inside gazelle_apiI() that can be named, get torrent group link, and given a site and a group_id, it gives you the torrent_url? In a hexagonal architecture the use case shouldn't know about REST/GRPC/EVENTS, etc.

… layer

Co-authored-by: marceljungle <44347173+marceljungle@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 18, 2025

@copilot don't you think it's better to have _get_base_url() along with this line torrent_url = f"{base_url}/torrents.php?id={group_id}" outside the use case? Maybe a method inside gazelle_apiI() that...

You're absolutely right about the hexagonal architecture violation. I've refactored the code to properly separate concerns:

Moved URL construction to infrastructure layer: Added get_torrent_group_url(group_id) method to GazelleAPI class
Removed infrastructure logic from use case: Deleted _get_base_url() method and URL construction from ShowMissingUseCase
Proper separation: Use case now focuses purely on business logic while infrastructure handles technical details

The use case no longer knows about REST endpoints or config loading - it simply calls self.gazelle_api.get_torrent_group_url(group_id) and the infrastructure layer handles all the URL construction details.

Changes in commit 92da8ba.

@marceljungle marceljungle marked this pull request as ready for review August 18, 2025 19:06
@marceljungle marceljungle merged commit bc40ff7 into develop Aug 18, 2025
7 checks passed
@marceljungle marceljungle deleted the copilot/fix-165 branch August 18, 2025 19:06
@marceljungle marceljungle added the feature New feature label Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a show-missing command to get missing groups from the local collection

2 participants