### Example PCD Manifest Source: https://github.com/dictionarry-hub/schema/blob/main/docs/manifest.md This is a comprehensive example of a pcd.json file, illustrating all required and optional fields. ```json { "name": "db", "version": "2.1.35", "description": "Seraphys' OCD Playground", "arr_types": ["radarr", "sonarr", "whisparr"], "dependencies": { "schema": "^1.1.0" }, "authors": [ { "name": "Dictionarry Team", "email": "team@dictionarry.dev" } ], "license": "MIT", "repository": "https://github.com/dictionarry-hub/database", "tags": ["4k", "hdr", "remux", "quality", "archival"], "links": { "homepage": "https://dictionarry.dev", "issues": "https://github.com/dictionarry-hub/db/issues" }, "profilarr": { "minimum_version": "2.0.0" } } ``` -------------------------------- ### PCD Repository Layout Example Source: https://github.com/dictionarry-hub/schema/blob/main/docs/structure.md Illustrates the typical directory structure for a PCD repository, including manifest, operations, and optional tweaks folders. ```text my-pcd/ ├── pcd.json ├── ops/ │ ├── 1.create-1080p-Efficient.sql └── tweaks/ ├── allow-DV-no-fallback.sql └── ban-megusta.sql ``` -------------------------------- ### Schema PCD Repository Layout Example Source: https://github.com/dictionarry-hub/schema/blob/main/docs/structure.md Shows the specific layout for a schema PCD, which contains only DDL in the ops folder and no tweaks. ```text schema-pcd/ ├── pcd.json └── ops/ └── 0.schema.sql ``` -------------------------------- ### SQL Operations for PCD Seeding Source: https://context7.com/dictionarry-hub/schema/llms.txt Provides example SQL statements for seeding quality profiles, custom formats, and their associated scores within a PCD. ```sql -- ops/1.seed-quality-profiles.sql — example base layer for a downstream PCD INSERT INTO quality_profiles (name, description, upgrades_allowed, minimum_custom_format_score, upgrade_until_score) VALUES ('1080p Efficient', 'Balanced 1080p profile', 1, 0, 10000), ('2160p Remux', 'Archival 4K remux profile', 1, 1000, 50000); ``` ```sql -- ops/2.seed-custom-formats.sql INSERT INTO custom_formats (name, description) VALUES ('x265', 'HEVC encoded release'), ('HDR10', 'HDR10 format'), ('Dolby Atmos','Dolby Atmos audio'); ``` ```sql -- ops/3.seed-scores.sql INSERT INTO quality_profile_custom_formats (quality_profile_name, custom_format_name, arr_type, score) VALUES ('1080p Efficient', 'x265', 'radarr', 50), ('1080p Efficient', 'Dolby Atmos', 'all', 200), ('2160p Remux', 'HDR10', 'radarr', 500), ('2160p Remux', 'Dolby Atmos', 'all', 400); ``` -------------------------------- ### Change-Driven Development: Update Quality Profile Score (SQL) Source: https://context7.com/dictionarry-hub/schema/llms.txt Illustrates the Change-Driven Development (CDD) workflow for authoring idempotent SQL operations. This example updates a score in `quality_profile_custom_formats` with an expected-value guard to ensure conflicts are explicit. ```sql -- Scenario: raise the Dolby Atmos score in the "1080p Quality HDR" profile -- Step 1 – verify current state (expected previous value = 400) SELECT score FROM quality_profile_custom_formats WHERE quality_profile_name = '1080p Quality HDR' AND custom_format_name = 'Dolby Atmos' AND arr_type = 'all'; -- Returns: 400 -- Step 2 – append the operation to the appropriate ops file UPDATE quality_profile_custom_formats SET score = 1200 WHERE quality_profile_name = '1080p Quality HDR' AND custom_format_name = 'Dolby Atmos' AND arr_type = 'all' AND score = 400; -- guard: fails loudly if upstream already changed this -- Expected: 1 row affected -- Step 3 – add a custom format test case for regression coverage INSERT INTO custom_format_tests (custom_format_name, title, type, should_match, description) VALUES ('Dolby Atmos', 'Movie.Title.2023.2160p.UHD.BluRay.Atmos.x265-GROUP', 'movie', 1, 'Standard Atmos tag in release title should match'); ``` -------------------------------- ### Insert Delay Profile - Usenet Only Source: https://context7.com/dictionarry-hub/schema/llms.txt Inserts a Usenet-only delay profile. For 'only_usenet' protocol, torrent_delay must be NULL. ```sql -- Usenet-only profile (torrent_delay must be NULL) INSERT INTO delay_profiles (name, preferred_protocol, usenet_delay, torrent_delay, bypass_if_highest_quality, bypass_if_above_custom_format_score, minimum_custom_format_score ) VALUES ( 'Usenet Only', 'only_usenet', 15, NULL, 1, 0, NULL ); ``` -------------------------------- ### Insert Delay Profile - Torrent Preference Source: https://context7.com/dictionarry-hub/schema/llms.txt Inserts a delay profile that prefers torrents with a specified delay and bypasses the delay if the release scores above a certain threshold. The usenet_delay must be non-NULL for 'prefer_torrent'. ```sql -- Insert a delay profile that prefers torrents with a 30-minute delay -- and bypasses the delay if the release scores above 2000 INSERT INTO delay_profiles ( name, preferred_protocol, usenet_delay, torrent_delay, bypass_if_highest_quality, bypass_if_above_custom_format_score, minimum_custom_format_score ) VALUES ( 'Default Torrent Profile', 'prefer_torrent', 60, -- usenet_delay (must be non-NULL for prefer_torrent) 30, -- torrent_delay in minutes 0, 1, -- enable bypass when score threshold exceeded 2000 -- required because bypass_if_above_custom_format_score = 1 ); ``` -------------------------------- ### Seed Qualities and API Mappings (SQL) Source: https://context7.com/dictionarry-hub/schema/llms.txt Seeds the `qualities` table and populates `quality_api_mappings` to translate canonical quality names to application-specific names. Handles differences in naming conventions between applications like Sonarr and Radarr. ```sql -- ops/2.qualities.sql INSERT INTO qualities (name) VALUES ('Unknown'), ('WORKPRINT'), ('CAM'), ('TELESYNC'), ('TELECINE'), ('DVDSCR'), ('REGIONAL'), ('SDTV'), ('DVD'), ('DVD-R'), ('HDTV-480p'), ('HDTV-720p'), ('HDTV-1080p'), ('HDTV-2160p'), ('WEBDL-480p'), ('WEBDL-720p'), ('WEBDL-1080p'), ('WEBDL-2160p'), ('WEBRip-480p'), ('WEBRip-720p'), ('WEBRip-1080p'), ('WEBRip-2160p'), ('Bluray-480p'), ('Bluray-576p'), ('Bluray-720p'), ('Bluray-1080p'), ('Bluray-2160p'), ('Remux-1080p'), ('Remux-2160p'), ('BR-DISK'), ('Raw-HD'); -- Radarr: direct name match for all 30 qualities INSERT INTO quality_api_mappings (quality_name, arr_type, api_name) SELECT name, 'radarr', name FROM qualities WHERE name IN ( 'Unknown', 'WORKPRINT', 'CAM', 'TELESYNC', 'TELECINE', 'DVDSCR', 'REGIONAL', 'SDTV', 'DVD', 'DVD-R', 'HDTV-720p', 'HDTV-1080p', 'HDTV-2160p', 'WEBDL-480p', 'WEBDL-720p', 'WEBDL-1080p', 'WEBDL-2160p', 'WEBRip-480p', 'WEBRip-720p', 'WEBRip-1080p', 'WEBRip-2160p', 'Bluray-480p', 'Bluray-576p', 'Bluray-720p', 'Bluray-1080p', 'Bluray-2160p', 'Remux-1080p', 'Remux-2160p', 'BR-DISK', 'Raw-HD' ); -- Sonarr: remux qualities use different API names INSERT INTO quality_api_mappings (quality_name, arr_type, api_name) SELECT name, 'sonarr', 'Bluray-1080p Remux' FROM qualities WHERE name = 'Remux-1080p'; INSERT INTO quality_api_mappings (quality_name, arr_type, api_name) SELECT name, 'sonarr', 'Bluray-2160p Remux' FROM qualities WHERE name = 'Remux-2160p'; ``` -------------------------------- ### Minimal PCD Manifest File (`pcd.json`) Source: https://context7.com/dictionarry-hub/schema/llms.txt This JSON file declares a PCD's identity, supported arr applications, version, schema dependency, and compatibility requirements. Profilarr uses this file for validation and loading. ```json // pcd.json — minimal schema-only PCD { "name": "my-quality-db", "version": "1.0.0", "description": "Custom quality profiles for 4K HDR remux collection", "arr_types": ["radarr", "sonarr"], "dependencies": { "schema": "^1.1.0" }, "authors": [ { "name": "Jane Doe", "email": "jane@example.com" } ], "license": "MIT", "repository": "https://github.com/example/my-quality-db", "tags": ["4k", "hdr", "remux", "archival"], "links": { "homepage": "https://example.com", "issues": "https://github.com/example/my-quality-db/issues" }, "profilarr": { "minimum_version": "2.0.0" } } ``` -------------------------------- ### Define Custom Format for Dolby Vision (Regex) Source: https://context7.com/dictionarry-hub/schema/llms.txt Defines a custom format for Dolby Vision releases using a regex pattern condition. This involves inserting into multiple tables: custom_formats, regular_expressions, custom_format_conditions, and condition_patterns. ```sql -- Define a custom format for Dolby Vision with a regex pattern condition INSERT INTO custom_formats (name, description, include_in_rename) VALUES ('Dolby Vision', 'Dolby Vision HDR format', 0); -- Register the regex INSERT INTO regular_expressions (name, pattern, description) VALUES ( 'dv-pattern', '\b(DV|DoVi|Dolby[\. ]?Vision)\b', 'Matches common Dolby Vision tags in release titles' ); -- Register the condition on the custom format INSERT INTO custom_format_conditions (custom_format_name, name, type, arr_type, negate, required) VALUES ('Dolby Vision', 'DV Release Title', 'release_title', 'all', 0, 1); -- Link condition to the regex via condition_patterns INSERT INTO condition_patterns (custom_format_name, condition_name, regular_expression_name) VALUES ('Dolby Vision', 'DV Release Title', 'dv-pattern'); ``` -------------------------------- ### Validate Language Coverage (Shell Script) Source: https://context7.com/dictionarry-hub/schema/llms.txt A shell script to validate language coverage by fetching live language lists from Radarr and Sonarr repositories and comparing them against the `ops/1.languages.sql` schema. Run locally or via CI to detect upstream changes. ```bash # Run locally to check for missing languages ./scripts/validateLanguages.sh # Expected output when all languages are present: # Fetching Radarr languages... # Found Radarr languages: # Afrikaans # Albanian # ... # === Radarr Validation === # ✓ All Radarr languages present (65) # # === Sonarr Validation === # ✓ All Sonarr languages present (65) # # Total unique languages in schema: 67 # Non-zero exit (failure) example when a new language is added upstream: # === Radarr Validation === ``` -------------------------------- ### Seed Languages Table Source: https://context7.com/dictionarry-hub/schema/llms.txt Populates the 'languages' table with all supported languages for Radarr and Sonarr, including special values like 'Any' and 'Original'. This script is essential for downstream operations that reference canonical language names. ```sql -- ops/1.languages.sql INSERT INTO languages (name) VALUES ('Unknown'), ('English'), ('French'), ('Spanish'), ('German'), ('Italian'), ('Japanese'), ('Chinese'), ('Russian'), ('Korean'), ('Portuguese (Brazil)'), ('Spanish (Latino)'), -- ... (65 languages total) ('Any'), ('Original'); -- Example: using seeded languages in a downstream PCD ops file -- Link a quality profile to English-only and not-dubbed constraints INSERT INTO quality_profile_languages (quality_profile_name, language_name, type) VALUES ('1080p Efficient', 'English', 'must'), ('1080p Efficient', 'French', 'not'); ``` -------------------------------- ### Validate Radarr and Sonarr Qualities Source: https://context7.com/dictionarry-hub/schema/llms.txt This script fetches quality definitions from Radarr and Sonarr, then validates them against the ops/2.qualities.sql schema. It normalizes Sonarr's remux naming for consistent comparison. Run locally to check for missing or renamed qualities. ```bash # Run locally to check for missing or renamed qualities ./scripts/validateQualities.sh ``` ```text # Expected output when all qualities are present: # Fetching Radarr qualities... # Found Radarr qualities: # Bluray-1080p # ... # === Radarr Validation === # ✓ All Radarr qualities present (30) # # === Sonarr Validation === # ✓ All Sonarr qualities present (22) # # Total unique qualities in schema: 31 ``` ```text # CI integration — runs on push, pull_request, and daily schedule: # See .github/workflows/validate.yml # jobs: # validate-languages: runs ./scripts/validateLanguages.sh # validate-qualities: runs ./scripts/validateQualities.sh ``` -------------------------------- ### Schema Migration: Add Position to Quality Group Members (SQL) Source: https://context7.com/dictionarry-hub/schema/llms.txt Demonstrates an append-only migration pattern by adding a new column to an existing table using `ALTER TABLE`. This preserves the immutability of prior operations while extending the schema. Includes downstream usage for assigning positions. ```sql -- ops/3.quality-group-member-position.sql -- Adds ordering support to quality group members -- Previous ops are never edited; this new op appends the change ALTER TABLE quality_group_members ADD COLUMN position INTEGER NOT NULL DEFAULT 0; -- Downstream PCD usage: assign positions when inserting group members INSERT INTO quality_group_members (quality_profile_name, quality_group_name, quality_name, position) VALUES ('1080p Efficient', 'WEB Tier', 'WEBDL-1080p', 1), ('1080p Efficient', 'WEB Tier', 'WEBRip-1080p', 2); ``` -------------------------------- ### Core DDL Schema Definitions Source: https://context7.com/dictionarry-hub/schema/llms.txt Defines the core tables, foreign keys, indexes, and constraints for the schema layer. This pure DDL script establishes the foundation for all downstream operations. ```sql -- ops/0.schema.sql (excerpt) — illustrating stable-key FK pattern used throughout -- Core entity: qualities CREATE TABLE qualities ( id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(100) UNIQUE NOT NULL, created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP ); -- Maps Profilarr canonical quality names to arr-specific API names -- Absence of a row = quality does not exist for that arr CREATE TABLE quality_api_mappings ( quality_name VARCHAR(100) NOT NULL, arr_type VARCHAR(20) NOT NULL, -- 'radarr' | 'sonarr' api_name VARCHAR(100) NOT NULL, created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (quality_name, arr_type), FOREIGN KEY (quality_name) REFERENCES qualities(name) ON DELETE CASCADE ON UPDATE CASCADE ); -- Quality profiles define a complete media acquisition strategy CREATE TABLE quality_profiles ( id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(100) UNIQUE NOT NULL, description TEXT, upgrades_allowed INTEGER NOT NULL DEFAULT 1, minimum_custom_format_score INTEGER NOT NULL DEFAULT 0, upgrade_until_score INTEGER NOT NULL DEFAULT 0, upgrade_score_increment INTEGER NOT NULL DEFAULT 1 CHECK (upgrade_score_increment > 0), created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP ); -- Assign custom formats to a profile with a score -- Scores drive upgrade priority and minimum-score filtering in Radarr/Sonarr CREATE TABLE quality_profile_custom_formats ( quality_profile_name VARCHAR(100) NOT NULL, custom_format_name VARCHAR(100) NOT NULL, arr_type VARCHAR(20) NOT NULL, -- 'radarr' | 'sonarr' | 'all' score INTEGER NOT NULL, PRIMARY KEY (quality_profile_name, custom_format_name, arr_type), FOREIGN KEY (quality_profile_name) REFERENCES quality_profiles(name) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (custom_format_name) REFERENCES custom_formats(name) ON DELETE CASCADE ON UPDATE CASCADE ); -- Only one quality item per profile may be the "upgrade_until" ceiling CREATE UNIQUE INDEX idx_one_upgrade_until_per_profile ON quality_profile_qualities(quality_profile_name) WHERE upgrade_until = 1; ``` -------------------------------- ### Add Regression Tests for Custom Format Source: https://context7.com/dictionarry-hub/schema/llms.txt Adds regression tests for a custom format to verify its matching logic. This involves inserting test cases into the custom_format_tests table, specifying the custom format, title, type, expected match outcome, and a description. ```sql -- Add a regression test INSERT INTO custom_format_tests (custom_format_name, title, type, should_match, description) VALUES ('Dolby Vision', 'Movie.2023.2160p.BluRay.DoVi.HDR10.x265-GROUP', 'movie', 1, 'DoVi tag at 2160p should match'), ('Dolby Vision', 'Movie.2023.1080p.BluRay.x264-GROUP', 'movie', 0, '1080p without DV tag must not match'); ``` -------------------------------- ### Add Resolution Condition to Custom Format Source: https://context7.com/dictionarry-hub/schema/llms.txt Adds a resolution condition to an existing custom format, specifying that only 2160p resolutions should match. This requires inserting into custom_format_conditions and condition_resolutions tables. ```sql -- Add a resolution condition: only 2160p INSERT INTO custom_format_conditions (custom_format_name, name, type, arr_type, negate, required) VALUES ('Dolby Vision', 'Must be 4K', 'resolution', 'all', 0, 1); INSERT INTO condition_resolutions (custom_format_name, condition_name, resolution) VALUES ('Dolby Vision', 'Must be 4K', '2160p'); ``` -------------------------------- ### Update Quality Profile Custom Format Score Source: https://github.com/dictionarry-hub/schema/blob/main/docs/structure.md Expresses a change as a single SQL operation to update a score. Includes an expected-value guard to make conflicts explicit. ```sql UPDATE quality_profile_custom_formats SET score = 1200 WHERE profile_id = qp('1080p Quality HDR') AND custom_format_id = cf('Dolby Atmos') AND score = 400; -- expected previous value ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.