-
-
Notifications
You must be signed in to change notification settings - Fork 1
Development
kavinthangavel edited this page Apr 22, 2025
·
6 revisions
This document provides information for developers who want to contribute to Simkl Scrobbler.
simkl-movie-tracker/
โโโ docs/ # Documentation
โโโ simkl_mps/ # Main package
โ โโโ __init__.py # Package initialization
โ โโโ backlog_cleaner.py # Handles offline queue
โ โโโ cli.py # Command-line interface
โ โโโ main.py # Application entry point
โ โโโ media_cache.py # Movie info caching
โ โโโ media_tracker.py # Main tracking coordination
โ โโโ monitor.py # Window monitoring
โ โโโ movie_scrobbler.py # Movie tracking and Simkl integration
โ โโโ service_manager.py # System service management
โ โโโ service_runner.py # Background service implementation
โ โโโ simkl_api.py # Simkl API interactions
โ โโโ tray_app.py # System tray application
โ โโโ window_detection.py # Cross-platform window detection
โ โโโ players/ # Media player integrations
โ โ โโโ __init__.py
โ โ โโโ mpc.py # MPC-HC/BE integration
โ โ โโโ mpv.py # MPV integration
โ โ โโโ potplayer.py # PotPlayer integration
โ โ โโโ vlc.py # VLC integration
โ โโโ utils/ # Utility functions and constants
โโโ tests/ # Test suite
โโโ .gitignore # Git ignore patterns
โโโ pyproject.toml # Project metadata and dependencies
โโโ README.md # Project overview
โโโ LICENSE # License information
-
Clone the repository:
git clone https://github.com/kavinthangavel/simkl-movie-tracker.git cd simkl-movie-tracker -
Set up the development environment:
# Using Poetry (recommended) poetry install --with dev # Or using pip pip install -e ".[dev]"
-
Set up pre-commit hooks (optional):
pre-commit install
# Run tests with pytest
poetry run pytest
# Run tests with coverage
poetry run pytest --cov=simkl_mps
# Run specific test file
poetry run pytest tests/test_specific_file.pyThis project follows PEP 8 style guidelines. Use flake8 to check your code:
poetry run flake8 simkl_mpsTo add support for a new media player:
- Create a new file in the
players/directory (e.g.,simkl_mps/players/new_player.py) - Implement a class that follows the player integration interface:
class NewPlayerIntegration: def __init__(self): # Initialize player connection pass def get_position_duration(self, process_name=None): # Return (position_seconds, duration_seconds) tuple or (None, None) pass
- Add the player to
players/__init__.py - Update window detection to recognize the player in
window_detection.py
# Build distribution packages
poetry build
# Publish to PyPI (requires credentials)
poetry publish- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and commit them:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request against the main repository
For development, you can use the default client ID or register your own:
- Go to https://simkl.com/settings/developer/
- Create a new application
- Set the redirect URL to
urn:ietf:wg:oauth:2.0:oob - Use the client ID in your development environment:
SIMKL_CLIENT_ID=your_client_id
- Use the
--debugflag to enable detailed logging:simkl-mps start --debug - Check logs in the application data directory
- Use Python's debugger (pdb) or an IDE like PyCharm or VS Code for step-by-step debugging
- Test player integration separately using the player-specific test scripts
Simkl Scrobbler uses a modular architecture:
- ๐ช Window Detection Layer: Platform-specific code to detect media player windows
- ๐ฎ Media Player Integration Layer: Interfaces with specific players to get playback information
- ๐ฌ Movie Identification Layer: Parses titles and identifies movies via Simkl API
- ๐ Progress Tracking Layer: Monitors playback and determines completion
- ๐ Simkl API Layer: Handles authentication and scrobbling to Simkl
This separation allows for easy maintenance and extension of individual components.
graph TD
A[Window Detection] -->|Active Windows| B[Player Recognition]
B -->|Window Info| C[Title Extraction]
C -->|Movie Title| D[guessit Parser]
D -->|Parsed Info| E[Simkl Search]
E -->|Movie ID| F[Progress Tracker]
F -->|Position Updates| G{Completion Check}
G -->|>80%| H[Mark as Watched]
G -->|<80%| F
I[Player Integration] -->|Position Data| F
J[OS-specific APIs] --> A
style A fill:#d5f5e3,stroke:#333,stroke-width:2px
style H fill:#f9d5e5,stroke:#333,stroke-width:2px
style I fill:#d5eef7,stroke:#333,stroke-width:2px
style J fill:#f7dc6f,stroke:#333,stroke-width:2px