# arturduleba/anyplay architecture

> Architecture diagram of the GitHub repository arturduleba/anyplay, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arturduleba/anyplay
- Repository: https://github.com/arturduleba/anyplay

## Overview

AnyPlay is an Android media discovery, library, and playback client. Users search anime, movies, or TV, inspect metadata and episodes, then save or play available media; the frontend also manages downloads and library content through a Capacitor native bridge. The README documents AniList/TMDB metadata, torrent downloads, and HLS processing. The tree contains duplicate plugin and activity source copies; both plugin files are represented, but their equivalence is not assumed. Some workflow links are omitted because the excerpts do not show the wiring.

Main entry points: [`native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`](https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java) (Native plugin), [`frontend/static/script.js`](https://github.com/arturduleba/anyplay/blob/main/frontend/static/script.js) (Client logic), [`frontend/static/scrapers.js`](https://github.com/arturduleba/anyplay/blob/main/frontend/static/scrapers.js) (Search scrapers), [`native-plugin/AnyPlayNativePlugin.java`](https://github.com/arturduleba/anyplay/blob/main/native-plugin/AnyPlayNativePlugin.java) (Plugin copy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_ui["Web UI<br/>[index.html]"]
  node_client["Client logic<br/>[script.js]"]
end

subgraph group_discovery["Discovery"]
  node_scrapers["Search scrapers<br/>[scrapers.js]"]
  node_catalogs["Metadata APIs"]
  node_torrent_sources["Torrent sources"]
end

subgraph group_native["Android runtime"]
  node_capacitor["Capacitor host<br/>[MainActivity.java]"]
  node_plugin_app["Native plugin"]
  node_plugin_root["Plugin copy"]
  node_torrent_engine["Torrent engine"]
  node_ffmpeg["HLS processor"]
end

subgraph group_media["Media and library"]
  node_player["Native player"]
  node_library["Library management"]
  node_device_storage[("Device storage")]
end

node_viewer(("Viewer"))

node_viewer -->|"uses"| node_ui
node_ui -.->|"loads"| node_client
node_client -.->|"initializes"| node_scrapers
node_scrapers -->|"fetches metadata"| node_catalogs
node_scrapers -->|"searches sources"| node_torrent_sources
node_client -->|"calls bridge"| node_plugin_app
node_capacitor -->|"registers"| node_plugin_app
node_plugin_app -->|"downloads torrents"| node_torrent_engine
node_plugin_app -->|"processes HLS"| node_ffmpeg
node_plugin_app -->|"launches"| node_player
node_player -->|"saves progress"| node_device_storage
node_plugin_app -->|"manages media"| node_device_storage
node_plugin_root -->|"downloads torrents"| node_torrent_engine
node_plugin_root -->|"processes HLS"| node_ffmpeg

click node_ui "https://github.com/arturduleba/anyplay/blob/main/frontend/index.html"
click node_client "https://github.com/arturduleba/anyplay/blob/main/frontend/static/script.js"
click node_scrapers "https://github.com/arturduleba/anyplay/blob/main/frontend/static/scrapers.js"
click node_capacitor "https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/MainActivity.java"
click node_plugin_app "https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java"
click node_plugin_root "https://github.com/arturduleba/anyplay/blob/main/native-plugin/AnyPlayNativePlugin.java"
click node_player "https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/PlayerActivity.java"
click node_library "https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_client,node_viewer toneBlue
class node_scrapers,node_catalogs,node_torrent_sources toneAmber
class node_capacitor,node_plugin_app,node_plugin_root,node_torrent_engine,node_ffmpeg toneMint
class node_player,node_library,node_device_storage toneRose
```

## Components

### Web client

- [Web UI](https://github.com/arturduleba/anyplay/blob/main/frontend/index.html): `frontend/index.html`
- [Client logic](https://github.com/arturduleba/anyplay/blob/main/frontend/static/script.js): `frontend/static/script.js`

### Discovery

- [Search scrapers](https://github.com/arturduleba/anyplay/blob/main/frontend/static/scrapers.js): `frontend/static/scrapers.js`
- **Metadata APIs**
- **Torrent sources**

### Android runtime

- [Capacitor host](https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/MainActivity.java): `native-plugin/app/src/main/java/com/anyplay/app/MainActivity.java`
- [Native plugin](https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java): `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`
- [Plugin copy](https://github.com/arturduleba/anyplay/blob/main/native-plugin/AnyPlayNativePlugin.java): `native-plugin/AnyPlayNativePlugin.java`
- **Torrent engine**
- **HLS processor**

### Media and library

- [Native player](https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/PlayerActivity.java): `native-plugin/app/src/main/java/com/anyplay/app/PlayerActivity.java`
- [Library management](https://github.com/arturduleba/anyplay/blob/main/native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java): `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`
- **Device storage**

### Other components

- **Viewer**

## Connections

- Viewer → Web UI: uses (evidence: `README.md`)
- Web UI → Client logic: loads
- Client logic → Search scrapers: initializes
- Search scrapers → Metadata APIs: fetches metadata (evidence: `frontend/static/scrapers.js`)
- Search scrapers → Torrent sources: searches sources (evidence: `frontend/static/scrapers.js`)
- Client logic → Native plugin: calls bridge (evidence: `frontend/static/script.js`)
- Capacitor host → Native plugin: registers (evidence: `native-plugin/app/src/main/java/com/anyplay/app/MainActivity.java`)
- Native plugin → Torrent engine: downloads torrents (evidence: `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`)
- Native plugin → HLS processor: processes HLS (evidence: `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`)
- Native plugin → Native player: launches (evidence: `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`)
- Native player → Device storage: saves progress (evidence: `native-plugin/app/src/main/java/com/anyplay/app/PlayerActivity.java`)
- Native plugin → Device storage: manages media (evidence: `native-plugin/app/src/main/java/com/anyplay/app/AnyPlayNativePlugin.java`)
- Plugin copy → Torrent engine: downloads torrents (evidence: `native-plugin/AnyPlayNativePlugin.java`)
- Plugin copy → HLS processor: processes HLS (evidence: `native-plugin/AnyPlayNativePlugin.java`)
