# AIOStreams Feature Gap Analysis

Source: https://github.com/Viren070/AIOStreams

## What AIOStreams Is
A server-side Stremio addon aggregator (Node.js/TypeScript, 2k stars).
It wraps multiple Stremio addons + debrid services into ONE unified addon with
deduplication, filtering, sorting, and custom formatting.

## Features Worth Copying to Unspooled

### HIGH PRIORITY (implemented in Phases 1-4)

| Feature | Status | How implemented |
|---------|--------|----------------|
| Regex stream filters | ✅ Phase 1 | `StreamFilterEngine.kt` — 3-pass (REQUIRE/EXCLUDE/INCLUDE), per-content-type rules |
| Per-content-type filter presets | ✅ Phase 1 | Movie/series/anime tabs in StreamFilterScreen |
| Addon groups with early exit | ✅ Phase 1 | `AddonGroupConfig` + `getStreamsGrouped()` |
| Smart deduplication | ✅ Phase 2 | `StreamDeduplicator.kt` — 4-pass: URL→infoHash→smart hash→fuzzy Levenshtein |
| Configurable sort presets | ✅ Phase 4 | `SortPreset` enum with weight multipliers in SourceRanker |
| Catalog customization | ✅ Phase 3 | OTT/genre/Trakt toggles now wired into HomeViewModel |
| Addon marketplace | ✅ Phase 3 | `AddonMarketplace.kt` — 19 curated presets, 5 categories |

### MEDIUM PRIORITY (not yet implemented)

| Feature | AIOStreams approach | Android TV adaptation |
|---------|-------------------|----------------------|
| Custom stream formatter | Template engine with 30+ variables | Kotlin template parser for stream card display |
| RPDB poster enhancement | Auto-upgrade low-quality posters | RPDB API integration with fallback |
| Library detection | Flag streams already in debrid cloud | Debrid API library listing + hash match |
| Catalog shuffle/merge | Drag-and-drop, merge multiple catalogs | Room entity + LazyColumn reorder |

### LOW PRIORITY (skip — server-side concerns)
- Built-in proxy (MediaFlow/StremThru) — server-side middleware
- Usenet support (Easynews, NzbDAV) — niche audience
- Multi-user config isolation — single-device app
- Admin dashboard/analytics — operator feature
- SEL expression language — overkill for Android TV; regex filters cover 80% of use cases

## Community Research Notes

Top community demands (from GitHub issues, Reddit r/Debrid_Stream_App):
1. Consolidation — "one addon to rule them all"
2. Filtering precision — regex, conditions, release group matching
3. Sorting control — stackable, content-aware (movies vs series vs anime)
4. Deduplication — many users see the same content from multiple addons
5. Credential auto-wiring — configure debrid once, propagates to all addons
6. Catalog management — rename, reorder, disable rows

Active competitor comparison: AIOStreams vs Syncler vs Stremio native — AIOStreams wins on
filtering flexibility and addon consolidation. Unspooled's advantage: native Android TV
Compose UI, no server dependency, works offline.

## Implementation Patterns Used

### Regex Filter Engine
```kotlin
// 3-pass filter in StreamFilterEngine.apply()
// Pass 1: REQUIRE — drop everything not matching
// Pass 2: EXCLUDE — remove matches
// Pass 3: INCLUDE — mark for ranking bonus (no filtering)
// Stored per-content-type in PreferencesManager as JSON
```

### Sort Preset Weight Multipliers
```kotlin
// In SourceRanker.rankStreams():
val (relMult, qualMult, sizeMult) = when (preset) {
    QUALITY_FIRST -> Triple(0.8f, 1.5f, 0.5f)
    CACHE_FIRST   -> Triple(2.0f, 0.6f, 1.5f)
    BALANCED      -> Triple(1.0f, 1.0f, 1.0f)
}
// Applied to reliabilityWeight * relMult, qualityWeight * qualMult, sizeWeight * sizeMult
```

### Smart Dedup
```kotlin
// 4-pass: URL exact → infoHash → smart hash (size:res:encode:group) → fuzzy filename
// Levenshtein similarity ≥82% = duplicate
// Quality-aware: keeps higher resolution/encode among dupes
```

### Catalog Filtering
```kotlin
// In HomeViewModel.buildHomeContent():
definitions.filter { def ->
    when {
        def.rowId.startsWith("ott_") -> ottSlug in ottEnabledSet
        def.rowId.startsWith("genre_") -> genre in genreSelections || genreSelections.isEmpty()
        def.rowId in traktRows -> showTraktRows
        else -> true
    }
}
```
