# mysterken/dlsitemetadata architecture

> Architecture diagram of the GitHub repository mysterken/dlsitemetadata, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mysterken/dlsitemetadata
- Repository: https://github.com/mysterken/dlsitemetadata

## Overview

##### Project Type and Purpose
- The project is a plugin meant to extend Playnite’s functionality by fetching metadata from DLsite.
- Its main purpose is to allow users to either search for games or directly supply a game URL or work ID to retrieve metadata.
- It is built using .NET/WPF (as indicated by App.xaml and .cs files) and integrates into Playnite via its metadata plugin architecture.

##### File Structure for Architectural Insights
- The top-level structure includes a LICENSE, README, documentation, manifests, and a “source” directory, which houses the bulk of the project.
- App.xaml and App.config: This suggests that the project uses WPF for any UI components or configuration management.
- Several C# source files (e.g., DLsiteScrapper.cs, DLsiteMetadataProvider.cs, DLsiteMetadataPlugin.cs): These are core components that implement the plugin’s functionality.
- DLsiteMetadataSettingsView.xaml and its related code-behind (.cs): This is likely the UI for configuring the plugin’s settings.
- Additional classes such as DLsiteItemOption.cs, DLsiteMetadata.cs, DLsiteScrapperResult.cs, etc. which encapsulate the business logic.
- An extension.yaml file which likely serves to register the plugin with the host (Playnite).
- Localization files showing support for multiple languages.
- The presence of a manifest (manifests/InstallerManifest.yaml) indicates that the project may be packaged and installed via specific tooling (for instance, Playnite’s extension packaging).

##### Main Components and Their Relationships
- Plugin Integration Component: (e.g., DLsiteMetadataPlugin.cs)
- Acts as the main integration point for Playnite. It registers the plugin, hooks into events, and routes data requests.
- Data Retrieval / Scraping Component: (e.g., DLsiteScrapper.cs, DLsiteScrapperResult.cs)
- Responsible for fetching metadata from DLsite based on either a search query or a direct URL/work ID input.
- Metadata Provider Component: (e.g., DLsiteMetadataProvider.cs)
- Processes the data obtained from the scrapper and maps the retrieved fields to the corresponding Playnite metadata fields (as described in the README’s Supported fields list).
- Configuration and Settings Component: (e.g., DLsiteMetadataSettings.cs, DLsiteMetadataSettingsView.xaml, and its code-behind)
- Provides the user interface and business logic for configuring the plugin options (e.g., category selection, language preferences, inclusion of various contributor roles).
- Application/Host Configuration Component:
- Managed by App.xaml and App.config, these set up the environment, resource definitions, and overall configuration for the plugin.
- Localization and Resources:
- Localization folder (e.g., Localization/en_US.xaml) and Resources directory provide multi-language support for UI text and messages.
- Installer and Packaging:
- The manifest file (manifests/InstallerManifest.yaml) and extension.yaml suggest how this plugin gets packaged and deployed within Playnite.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Playnite Host"]:::external

    subgraph "Core Plugin Logic"
        B["DLsiteMetadataPlugin"]:::plugin
        C["DLsiteScrapper"]:::plugin
        D["DLsiteScrapperResult"]:::plugin
        E["DLsiteMetadataProvider"]:::plugin
    end

    subgraph "User Interface / Configuration"
        F1["DLsiteMetadataSettings.cs"]:::ui
        F2["DLsiteMetadataSettingsView"]:::ui
    end

    subgraph "Infrastructure"
        subgraph "Application Config"
            G1["App.xaml"]:::infra
            G2["App.config"]:::infra
        end
        subgraph "Localization"
            H1["Localization/en_US.xaml"]:::infra
            H2["Resources"]:::infra
        end
        subgraph "Packaging"
            I1["InstallerManifest.yaml"]:::infra
            I2["extension.yaml"]:::infra
        end
    end

    %% Interactions
    A -->|"metadata_request"| B
    B -->|"fetch_raw_data"| C
    C -->|"process_results"| D
    D -->|"map_metadata"| E

    F2 -->|"config_updates"| B
    F1 --- F2

    G1 -->|"init_environment"| B
    G2 -->|"init_environment"| B

    H1 -->|"localize_UI"| F2
    H2 -->|"localize_UI"| F2

    I1 -->|"plugin_deployment"| B
    I2 -->|"plugin_deployment"| B

    %% Click Events
    click B "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteMetadataPlugin.cs"
    click C "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteScrapper.cs"
    click D "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteScrapperResult.cs"
    click E "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteMetadataProvider.cs"
    click F1 "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteMetadataSettings.cs"
    click F2 "https://github.com/mysterken/dlsitemetadata/blob/master/source/DLsiteMetadataSettingsView.xaml"
    click G1 "https://github.com/mysterken/dlsitemetadata/blob/master/source/App.xaml"
    click G2 "https://github.com/mysterken/dlsitemetadata/blob/master/source/App.config"
    click H1 "https://github.com/mysterken/dlsitemetadata/blob/master/source/Localization/en_US.xaml"
    click H2 "https://github.com/mysterken/dlsitemetadata/tree/master/source/Resources"
    click I1 "https://github.com/mysterken/dlsitemetadata/blob/master/manifests/InstallerManifest.yaml"
    click I2 "https://github.com/mysterken/dlsitemetadata/blob/master/source/extension.yaml"

    %% Styles
    classDef external fill:#ffe0b2,stroke:#333,stroke-width:2px;
    classDef plugin fill:#bbdefb,stroke:#333,stroke-width:2px;
    classDef ui fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef infra fill:#e1bee7,stroke:#333,stroke-width:2px;
```
