### Configure Environment and Start Development Server Source: https://github.com/moldytaint/cinephage/blob/main/docs/development/contributing.md Steps to copy the example environment file and start the development server using npm. This allows for local development and testing. ```bash cp .env.example .env npm run dev ``` -------------------------------- ### Manual Installation and Execution of Cinephage Source: https://github.com/moldytaint/cinephage/blob/main/README.md This snippet outlines the steps for manually installing and running Cinephage. It involves cloning the repository, installing dependencies, building the project, and starting the application. Requires Node.js 20+. ```bash git clone https://github.com/MoldyTaint/cinephage.git cd cinephage npm install npm run build npm start ``` -------------------------------- ### Install Dependencies and Build Application Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Installs dependencies deterministically using 'npm ci' and then builds the application using 'npm run build'. Useful when build fails. ```bash npm ci npm run build ``` -------------------------------- ### Install ffmpeg for Media Info Extraction Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md This snippet shows how to install the ffmpeg package, which includes ffprobe, a tool necessary for extracting media information like resolution and codec. It's essential for Cinephage to properly read media file details. ```bash # Ubuntu/Debian sudo apt install ffmpeg # Verify ffprobe -version ``` -------------------------------- ### Start Development Server (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/CONTRIBUTING.md Starts the development server for Cinephage using npm. This command typically recompiles assets on changes and provides a live-reloading development environment. ```bash npm run dev ``` -------------------------------- ### Multi-Source Attribution Example Source: https://github.com/moldytaint/cinephage/blob/main/docs/guides/indexers.md An example illustrating how Cinephage attributes torrents found on multiple indexers. It shows how the `sourceIndexers` field tracks all sources, even when one version (e.g., the one with more seeders) is chosen as the primary result. This helps users see all available sources for a given release. ```markdown - `indexerName: "Knaben"` (the version with more seeders was kept) - `sourceIndexers: ["YTS", "Knaben"]` (both indexers had it) ``` -------------------------------- ### Update Cinephage Application Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md A step-by-step guide to updating the Cinephage application. It includes stopping the service, backing up the database, pulling code changes, installing dependencies, rebuilding, running migrations, and restarting the service. ```bash # Stop the service sudo systemctl stop cinephage # Backup the database cp /opt/cinephage/data/cinephage.db /opt/cinephage/data/cinephage.db.backup # Pull updates cd /opt/cinephage git fetch origin git pull origin main # Install dependencies npm ci --production=false # Rebuild npm run build # Run migrations npm run db:push # Start the service sudo systemctl start cinephage # Verify sudo systemctl status cinephage ``` -------------------------------- ### Install ffprobe for Media Info Extraction Source: https://github.com/moldytaint/cinephage/blob/main/docs/guides/library-management.md Provides installation commands for ffprobe on different operating systems (Ubuntu/Debian, macOS) and a link for Windows. Mentions setting FFPROBE_PATH if ffprobe is not in the system's PATH. ```bash # Ubuntu/Debian sudo apt install ffmpeg # macOS brew install ffmpeg # Windows Download from https://ffmpeg.org/download.html If ffprobe is not in PATH, set FFPROBE_PATH in .env. ``` -------------------------------- ### Check Node.js Version Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Verifies if the installed Node.js version meets the minimum requirement (20+). ```bash node --version ``` -------------------------------- ### Install Certbot for SSL Certificates Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Installs Certbot and the Nginx plugin for managing Let's Encrypt SSL certificates. This is a prerequisite for obtaining and renewing certificates automatically. ```bash sudo apt install certbot python3-certbot-nginx ``` -------------------------------- ### Troubleshoot Cinephage Service Start Failures Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Steps to diagnose and resolve issues when the Cinephage service fails to start. It involves checking file permissions, reviewing system logs, and testing manual execution. ```bash # Check permissions: ls -la /opt/cinephage/ # Check logs: sudo journalctl -u cinephage -n 50 # Test manually: sudo -u cinephage NODE_ENV=production node /opt/cinephage/build/index.js ``` -------------------------------- ### Clone Repository and Install Dependencies (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/CONTRIBUTING.md Clones the Cinephage repository from GitHub and installs project dependencies using npm. Ensure Git and Node.js (v20+) with npm (v10+) are installed. ```bash git clone https://github.com/MoldyTaint/cinephage.git cd cinephage npm install ``` -------------------------------- ### Configure Environment Variables (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/CONTRIBUTING.md Copies the example environment file to a new file named `.env` for local configuration. This step is crucial for setting up the application's environment-specific settings. ```bash cp .env.example .env ``` -------------------------------- ### Clear npm Cache and Reinstall Dependencies Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Resolves 'npm install' failures by clearing the npm cache, removing existing node_modules and lock files, and then reinstalling dependencies. ```bash npm cache clean --force rm -rf node_modules package-lock.json npm install ``` -------------------------------- ### Switch to npm for Dependency Management Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Ensures consistent dependency management by removing other lock files (yarn.lock, pnpm-lock.yaml) and reinstalling using npm. ```bash rm -rf node_modules yarn.lock pnpm-lock.yaml npm install ``` -------------------------------- ### Build Cinephage for Production (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Commands to clone the Cinephage repository, install production dependencies, build the application, and initialize the database. It also includes a command to verify the production build by running the application. ```bash git clone https://github.com/MoldyTaint/cinephage.git /opt/cinephage cd /opt/cinephage npm ci --production=false npm run build npm run db:push NODE_ENV=production node build/index.js ``` -------------------------------- ### Test qBittorrent WebUI Connection Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Verifies connectivity to the qBittorrent WebUI by making an API request to retrieve the application version. Assumes qBittorrent is running on localhost:8080. ```bash curl http://localhost:8080/api/v2/app/version ``` -------------------------------- ### View and Interact with Log Files (bash) Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md These bash commands demonstrate common operations for viewing, tailing, and searching Cinephage log files located in the `logs/` directory. ```bash # View recent logs tail -100 logs/cinephage.log # Follow logs in real-time tail -f logs/cinephage.log # Search for errors grep -i error logs/cinephage.log # Search for specific indexer grep "1337x" logs/cinephage.log ``` -------------------------------- ### Name-Based File Matching Examples Source: https://github.com/moldytaint/cinephage/blob/main/docs/guides/library-management.md Illustrates how Cinephage parses movie and TV show names to match them to entries when external IDs are not present. Covers common naming patterns for movies and TV episodes. ```plaintext Movies: ``` Movie Name (Year)/Movie Name (Year) [Quality].mkv Movie.Name.Year.Quality.Group.mkv ``` TV Shows: ``` Series Name/Season 01/Series Name - S01E01 - Episode Title.mkv Series.Name.S01E01.Episode.Title.Quality.mkv ``` ``` -------------------------------- ### List Node Processes Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Lists all running Node.js processes, helpful for identifying orphaned instances that might be causing database lock issues. ```bash ps aux | grep node ``` -------------------------------- ### Systemd Service Management Commands (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Essential commands for managing the Cinephage systemd service, including starting, stopping, restarting, and viewing logs. These commands are useful for monitoring and troubleshooting the deployed application. ```bash # Start the service sudo systemctl start cinephage # Stop the service sudo systemctl stop cinephage # Restart the service sudo systemctl restart cinephage # View logs sudo journalctl -u cinephage -f # View recent logs sudo journalctl -u cinephage -n 100 ``` -------------------------------- ### Configure Environment Variables for Log Retention (env) Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Setting the maximum number of logs to retain can help manage disk space and memory usage associated with log files. ```env WORKER_MAX_LOGS=500 ``` -------------------------------- ### Configure Caddy as Reverse Proxy (Caddy Configuration) Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md A simple Caddyfile configuration to set up Caddy as a reverse proxy for Cinephage. Caddy automatically handles SSL certificate provisioning and renewal, simplifying the setup process. ```caddy cinephage.yourdomain.com { reverse_proxy localhost:3000 } ``` -------------------------------- ### Integrate Download Clients and Monitor Downloads (JavaScript) Source: https://context7.com/moldytaint/cinephage/llms.txt Details how to integrate with various download clients (qBittorrent, SABnzbd, NZBGet) through the `DownloadClientManager`. It shows adding downloads via magnet links, monitoring their completion, and handling automatic imports, along with retrieving download statistics. ```javascript import { getDownloadClientManager } from '$lib/server/downloadClients/DownloadClientManager'; import { downloadMonitor } from '$lib/server/downloadClients/monitoring'; const manager = getDownloadClientManager(); // Get client for protocol const { client, instance } = await manager.getClientForProtocol('torrent'); // Add download const hash = await instance.addDownload({ magnetUri: 'magnet:?xt=urn:btih:...', category: 'movies', paused: false, priority: 'normal', seedRatioLimit: 1.0, seedTimeLimit: 172800 }); console.log(`Download added with hash: ${hash}`); // Monitor download progress downloadMonitor.on('download-completed', async (queueItem) => { console.log(`Download completed: ${queueItem.title}`); }); downloadMonitor.on('import-success', (queueItem) => { console.log(`Import successful: ${queueItem.title}`); console.log(`Imported to: ${queueItem.importedPath}`); }); // Get download statistics const stats = await downloadMonitor.getStats(); console.log(stats); ``` -------------------------------- ### Cardigann YAML Indexer Definition Structure Source: https://github.com/moldytaint/cinephage/blob/main/docs/development/contributing.md An example YAML structure for defining a Cardigann-style indexer. This includes fields for ID, name, description, language, type, protocol, capabilities, links, search paths, inputs, and response parsing. ```yaml id: example-indexer name: Example Indexer description: An example indexer definition language: en-US type: public protocol: torrent caps: modes: search: [q] movie-search: [q, imdbid] categories: '2000': Movies '5000': TV links: - https://example.com search: paths: - path: /api/search method: get inputs: query: '{{ .Query.Q }}' response: type: json rows: selector: results fields: title: selector: name download: selector: torrent_url size: selector: size seeders: selector: seeds ``` -------------------------------- ### Svelte 5 Runes Syntax Example Source: https://github.com/moldytaint/cinephage/blob/main/docs/development/architecture.md Demonstrates the basic usage of Svelte 5's runes system, including reactive state with `$state`, derived state with `$derived`, and side effects with `$effect` within a Svelte component's script block. ```svelte ``` -------------------------------- ### Test ffprobe File Accessibility Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md This command verifies if ffprobe can successfully read a specific media file. It's a crucial step to ensure that ffprobe is correctly installed and has the necessary permissions to access media files, which is required for extracting media information. ```bash ffprobe /path/to/file.mkv ``` -------------------------------- ### GET /api/library/movies Source: https://context7.com/moldytaint/cinephage/llms.txt Retrieve all movies in your library with file information and metadata. ```APIDOC ## GET /api/library/movies ### Description Retrieve all movies in your library with file information and metadata. ### Method GET ### Endpoint /api/library/movies ### Parameters *No parameters are required for this endpoint.* ### Request Example ```bash curl http://localhost:3000/api/library/movies ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **movies** (array) - List of movies in the library. - **id** (string) - Unique ID of the movie in Cinephage. - **tmdbId** (integer) - TMDB ID of the movie. - **imdbId** (string) - IMDB ID of the movie. - **title** (string) - Title of the movie. - **year** (integer) - Release year. - **overview** (string) - Synopsis. - **posterPath** (string) - Path to the poster image. - **backdropPath** (string) - Path to the backdrop image. - **runtime** (integer) - Movie runtime in minutes. - **genres** (array of strings) - List of genres. - **path** (string) - Relative path to the movie folder. - **rootFolderId** (string) - ID of the root folder. - **rootFolderPath** (string) - Path of the root folder. - **scoringProfileId** (string) - ID of the scoring profile used. - **monitored** (boolean) - Monitoring status. - **minimumAvailability** (string) - Minimum availability status. - **hasFile** (boolean) - Whether the movie has associated files. - **files** (array) - List of associated media files. - **id** (string) - Unique ID of the file. - **relativePath** (string) - Relative path from the movie folder. - **size** (integer) - File size in bytes. - **dateAdded** (string) - ISO 8601 date when the file was added. - **quality** (object) - Video quality details. - **resolution** (string) - Resolution (e.g., '1080p'). - **source** (string) - Source (e.g., 'BluRay'). - **codec** (string) - Video codec (e.g., 'x264'). - **mediaInfo** (object) - Media information. - **videoCodec** (string) - Video codec. - **audioCodec** (string) - Audio codec. - **duration** (integer) - Duration in seconds. - **releaseGroup** (string) - Release group. - **total** (integer) - Total number of movies in the library. #### Response Example ```json { "success": true, "movies": [ { "id": "movie-uuid", "tmdbId": 27205, "imdbId": "tt1375666", "title": "Inception", "year": 2010, "overview": "A thief who steals corporate secrets...", "posterPath": "/inception.jpg", "backdropPath": "/backdrop.jpg", "runtime": 148, "genres": ["Action", "Science Fiction", "Thriller"], "path": "Inception (2010)", "rootFolderId": "root-uuid", "rootFolderPath": "/media/movies", "scoringProfileId": "quality", "monitored": true, "minimumAvailability": "released", "hasFile": true, "files": [ { "id": "file-uuid", "relativePath": "Inception (2010)/Inception.2010.1080p.BluRay.x264.mkv", "size": 15728640000, "dateAdded": "2024-01-15T10:30:00Z", "quality": { "resolution": "1080p", "source": "BluRay", "codec": "x264" }, "mediaInfo": { "videoCodec": "h264", "audioCodec": "aac", "duration": 8880 }, "releaseGroup": "SPARKS" } ] } ], "total": 1 } ``` ``` -------------------------------- ### Enable Nginx Site and Test Configuration (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Commands to enable the Nginx site configuration for Cinephage, test the Nginx configuration for syntax errors, and then reload the Nginx service to apply the changes. ```bash sudo ln -s /etc/nginx/sites-available/cinephage /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx ``` -------------------------------- ### Run Cinephage Tests with npm Source: https://github.com/moldytaint/cinephage/blob/main/docs/development/testing.md This snippet demonstrates how to execute tests for Cinephage using npm. It covers running all tests, running tests in watch mode for continuous feedback, and running a specific test file for targeted debugging. ```bash # Run all tests npm run test # Run tests in watch mode npm run test:watch # Run specific test file npm run test -- src/lib/server/scoring/scoring.test.ts ``` -------------------------------- ### Queue: Get Download History (HTTP) Source: https://github.com/moldytaint/cinephage/blob/main/docs/reference/api.md Fetches the download history with support for pagination. ```http GET /api/queue/history ``` -------------------------------- ### POST /api/download/grab Source: https://context7.com/moldytaint/cinephage/llms.txt Initiates a download by grabbing a media item directly, potentially creating a .strm file. ```APIDOC ## POST /api/download/grab ### Description Initiates a download by grabbing a media item directly, potentially creating a .strm file for streaming protocols. ### Method POST ### Endpoint /api/download/grab ### Parameters #### Request Body - **title** (string) - Required - The title of the media. - **downloadUrl** (string) - Required - The URL or stream identifier for the media. - **protocol** (string) - Required - The protocol to use for downloading (e.g., "streaming"). - **mediaType** (string) - Required - The type of media (e.g., "movie", "episode"). - **movieId** (string) - Optional - The unique identifier for the movie. - **indexerId** (integer) - Optional - The ID of the indexer used. - **indexerName** (string) - Optional - The name of the indexer used. ### Request Example ```json { "title": "Inception (2010) - Stream", "downloadUrl": "stream://movie/27205", "protocol": "streaming", "mediaType": "movie", "movieId": "movie-uuid", "indexerId": 5, "indexerName": "StreamingIndexer" } ``` ### Response #### Success Response (200) - **queueId** (string) - The ID of the download queue item. - **hash** (string) - The hash of the downloaded item. - **clientId** (string) - The ID of the client. - **clientName** (string) - The name of the client. - **category** (string) - The category of the media. - **wasDuplicate** (boolean) - Indicates if the downloaded item was a duplicate. - **isUpgrade** (boolean) - Indicates if the download was an upgrade. #### Response Example ```json { "success": true, "data": { "queueId": "queue-uuid", "hash": "abcdef1234567890", "clientId": "client-uuid", "clientName": "qBittorrent", "category": "movies", "wasDuplicate": false, "isUpgrade": true } } ``` #### Error Response (400) - **success** (boolean) - Indicates failure. - **error** (string) - Description of the error. - **rejectionType** (string) - The type of rejection (e.g., "quality"). - **upgradeDecision** (object) - Details about the upgrade decision. - **upgradeStatus** (string) - The status of the upgrade. - **reason** (string) - The reason for the upgrade decision. - **isUpgrade** (boolean) - Whether it was an upgrade. - **candidateScore** (integer) - Score of the candidate release. - **existingScore** (integer) - Score of the existing release. - **upgradeStats** (object) - Statistics about the upgrade (resolution, source, etc.). #### Error Response Example ```json { "success": false, "error": "Release does not meet upgrade requirements", "rejectionType": "quality", "upgradeDecision": { "upgradeStatus": "not_upgrade", "reason": "Existing quality (1080p BluRay) is better than candidate (720p WEB-DL)", "isUpgrade": false, "candidateScore": 650, "existingScore": 850, "upgradeStats": { "resolution": "downgrade", "source": "downgrade" } } } ``` ``` -------------------------------- ### Library: Get Scan Status (HTTP) Source: https://github.com/moldytaint/cinephage/blob/main/docs/reference/api.md Retrieves the current status of the library scan process. ```http GET /api/library/status ``` -------------------------------- ### GET /api/discover/search Source: https://context7.com/moldytaint/cinephage/llms.txt Search for movies, TV shows, or people across TMDB with library status enrichment. ```APIDOC ## GET /api/discover/search ### Description Search for movies, TV shows, or people across TMDB with library status enrichment. ### Method GET ### Endpoint /api/discover/search ### Parameters #### Query Parameters - **query** (string) - Required - The search term. - **type** (string) - Optional - Type of content to search for (e.g., 'movie', 'tv', 'person', 'all'). Defaults to 'all'. - **page** (integer) - Optional - Page number for pagination. ### Request Example ```bash # Search for movies curl "http://localhost:3000/api/discover/search?query=inception&type=movie&page=1" # Multi-search (movies, TV, people) curl "http://localhost:3000/api/discover/search?query=nolan&type=all" ``` ### Response #### Success Response (200) - **results** (array) - List of search results. - **id** (integer) - Unique identifier from TMDB. - **title** (string) - Title or name of the result. - **media_type** (string) - Type of media ('movie', 'tv', 'person'). - **release_date** (string) - Release date (for movies/TV). - **vote_average** (number) - Average vote score (for movies/TV). - **poster_path** (string) - Path to the poster image. - **inLibrary** (boolean) - Whether the item is already in the user's library. - **libraryId** (string) - The ID of the item in the Cinephage library, if `inLibrary` is true. - **pagination** (object) - Pagination details. - **page** (integer) - Current page number. - **total_pages** (integer) - Total number of pages. - **total_results** (integer) - Total number of results. #### Response Example ```json { "results": [ { "id": 27205, "title": "Inception", "media_type": "movie", "release_date": "2010-07-16", "vote_average": 8.4, "poster_path": "/inception.jpg", "inLibrary": true, "libraryId": "uuid-12345" } ], "pagination": { "page": 1, "total_pages": 1, "total_results": 1 } } ``` ``` -------------------------------- ### Service Manager with Lazy Initialization (TypeScript) Source: https://github.com/moldytaint/cinephage/blob/main/docs/development/architecture.md Demonstrates the singleton pattern with lazy initialization for heavy services. The service is only instantiated when it's first accessed, improving startup performance. This pattern is crucial for managing resources efficiently in the application. ```typescript let externalIdService: ExternalIdService | null = null; export function getExternalIdService() { if (!externalIdService) { externalIdService = new ExternalIdService(db); } return externalIdService; } ``` -------------------------------- ### Reset Cinephage Database Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Resets the Cinephage database to its initial state. This action will result in data loss. ```bash npm run db:reset ``` -------------------------------- ### GET /api/discover Source: https://context7.com/moldytaint/cinephage/llms.txt Retrieve trending movies and TV shows from TMDB with optional filtering and library status enrichment. ```APIDOC ## GET /api/discover ### Description Retrieve trending movies and TV shows from TMDB with optional filtering and library status enrichment. ### Method GET ### Endpoint /api/discover ### Parameters #### Query Parameters - **type** (string) - Optional - Type of content to retrieve (e.g., 'movie', 'tv'). - **page** (integer) - Optional - Page number for pagination. - **sort_by** (string) - Optional - Sorting order (e.g., 'popularity.desc'). - **with_genres** (string) - Optional - Comma-separated list of genre IDs. - **vote_average.gte** (number) - Optional - Minimum vote average. ### Request Example ```bash curl "http://localhost:3000/api/discover?type=movie&page=1&sort_by=popularity.desc&with_genres=28,12&vote_average.gte=7.0" ``` ### Response #### Success Response (200) - **results** (array) - List of media items. - **id** (integer) - Unique identifier from TMDB. - **title** (string) - Title of the media. - **media_type** (string) - Type of media ('movie' or 'tv'). - **release_date** (string) - Release date. - **vote_average** (number) - Average vote score. - **poster_path** (string) - Path to the poster image. - **overview** (string) - Synopsis of the media. - **inLibrary** (boolean) - Whether the item is already in the user's library. - **pagination** (object) - Pagination details. - **page** (integer) - Current page number. - **total_pages** (integer) - Total number of pages. - **total_results** (integer) - Total number of results. #### Response Example ```json { "results": [ { "id": 123456, "title": "Action Movie", "media_type": "movie", "release_date": "2024-01-15", "vote_average": 8.2, "poster_path": "/poster.jpg", "overview": "An exciting action film...", "inLibrary": false } ], "pagination": { "page": 1, "total_pages": 50, "total_results": 1000 } } ``` ``` -------------------------------- ### Check SQLite Database Integrity Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Verifies the integrity of the Cinephage SQLite database file by running the 'integrity_check' pragma. ```bash sqlite3 data/cinephage.db "PRAGMA integrity_check;" ``` -------------------------------- ### Configure Cinephage Systemd Service (Bash) Source: https://github.com/moldytaint/cinephage/blob/main/docs/deployment/production.md Steps to set up Cinephage as a systemd service on Linux. This includes creating a dedicated user, setting directory ownership, copying the service file, creating and configuring the environment file, and enabling/starting the service. ```bash sudo useradd -r -s /bin/false cinephage sudo chown -R cinephage:cinephage /opt/cinephage sudo mkdir -p /opt/cinephage/data /opt/cinephage/logs sudo chown cinephage:cinephage /opt/cinephage/data /opt/cinephage/logs sudo cp /opt/cinephage/deploy/cinephage.service /etc/systemd/system/ sudo cp /opt/cinephage/.env.example /opt/cinephage/.env sudo chown cinephage:cinephage /opt/cinephage/.env sudo chmod 600 /opt/cinephage/.env sudo nano /opt/cinephage/.env sudo systemctl daemon-reload sudo systemctl enable cinephage sudo systemctl start cinephage sudo systemctl status cinephage sudo journalctl -u cinephage -f ``` -------------------------------- ### Check Port Availability (Production) Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Identifies if the default production port (3000) is already in use by another process. ```bash lsof -i :3000 ``` -------------------------------- ### Manage Library Files with Watcher and Scanner (JavaScript) Source: https://context7.com/moldytaint/cinephage/llms.txt Shows how to set up real-time file system monitoring using `LibraryWatcher` for immediate event handling (file added, removed) and trigger scheduled or manual library scans using `diskScan`. This is crucial for keeping the media library synchronized with the file system. ```javascript import { LibraryWatcher } from '$lib/server/library/library-watcher'; import { diskScan } from '$lib/server/library/disk-scan'; // Start real-time file watcher const watcher = new LibraryWatcher(); await watcher.start(); watcher.on('file-added', async (filePath) => { console.log(`New file detected: ${filePath}`); }); watcher.on('file-removed', (filePath) => { console.log(`File removed: ${filePath}`); }); // Trigger manual scan const scanResult = await diskScan('/media/movies', { type: 'movie', deep: true, matchToTmdb: true }); console.log(scanResult); ``` -------------------------------- ### Check Port Availability (Development) Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Identifies if the default development port (5173) is already in use by another process. ```bash lsof -i :5173 ``` -------------------------------- ### Run TypeScript Type Checking Source: https://github.com/moldytaint/cinephage/blob/main/docs/troubleshooting.md Executes the TypeScript type checking process to identify and fix potential errors before building the application. ```bash npm run check ```