diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7134347 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +# .github/workflows/ci.yml +name: CI + +on: + pull_request: + +jobs: + unit-tests: + name: Run Unit Tests + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.13] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + + - name: Run unit tests + run: pytest diff --git a/main.py b/main.py deleted file mode 100644 index 41c5003..0000000 --- a/main.py +++ /dev/null @@ -1,6 +0,0 @@ -def main(): - print("Hello from plex-mcp!") - - -if __name__ == "__main__": - main() diff --git a/simple-direct-plex-test.py b/simple-direct-plex-test.py deleted file mode 100644 index 57a119c..0000000 --- a/simple-direct-plex-test.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys -from plexapi.server import PlexServer -from plexapi.exceptions import Unauthorized, NotFound - -def main(): - """Simplest possible direct Plex API test""" - print("Direct Plex API Test") - print("===================") - - # Check environment variables - plex_token = os.environ.get("PLEX_TOKEN") - plex_server_url = os.environ.get("PLEX_SERVER_URL") - - if not plex_token or not plex_server_url: - print("ERROR: Environment variables not set!") - print(f"PLEX_SERVER_URL: {'Set' if plex_server_url else 'Not set'}") - print(f"PLEX_TOKEN: {'Set' if plex_token else 'Not set'}") - print("\nPlease set both PLEX_TOKEN and PLEX_SERVER_URL environment variables.") - sys.exit(1) - - print(f"Environment variables configured:") - print(f"PLEX_SERVER_URL: {plex_server_url}") - print(f"PLEX_TOKEN: {'*****' + plex_token[-4:] if plex_token else 'Not set'}") - print() - - try: - print("Connecting to Plex server...") - plex = PlexServer(plex_server_url, plex_token) - - print(f"✅ SUCCESS: Connected to Plex server '{plex.friendlyName}'") - print(f"Server version: {plex.version}") - print() - - # Try to get library sections - print("Retrieving library sections:") - sections = plex.library.sections() - - if sections: - print(f"Found {len(sections)} library sections:") - for section in sections: - print(f"- {section.title} ({section.type}): {len(section.all())} items") - else: - print("No library sections found.") - - # Try to get recent items - movie_sections = [section for section in sections if section.type == 'movie'] - if movie_sections: - section = movie_sections[0] - print(f"\nRecent items from '{section.title}':") - items = section.recentlyAdded(maxresults=3) - - if items: - for item in items: - print(f"- {item.title} ({getattr(item, 'year', 'Unknown Year')})") - else: - print("No recent items found.") - - except Unauthorized: - print("❌ ERROR: Authentication failed. Please check your PLEX_TOKEN.") - except NotFound: - print("❌ ERROR: Resource not found. Please check your PLEX_SERVER_URL.") - except Exception as e: - print(f"❌ ERROR: An exception occurred: {str(e)}") - -if __name__ == "__main__": - main() \ No newline at end of file