Compare commits

...

5 Commits

Author SHA1 Message Date
e58bb9af21 Move CI/CD reference docs from memory to in-repo docs/
Some checks failed
Build / Calculate version information (push) Successful in 12s
Build / build_and_upload (push) Failing after 0s
Build / build_images (push) Failing after 0s
Close stale issues / stale (push) Successful in 3s
Moves ci-cd.md (59 lines) from Claude memory into docs/ alongside
existing architecture docs. Slims MEMORY.md from 42 to 18 lines by
removing sections duplicated in CLAUDE.md (Tech Stack, Key Patterns,
Architecture Docs index).

Total memory load per session: 101 → 18 lines.

Fixes #7

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 20:03:31 +01:00
aa6d8eae4c Add Task Completion Protocol to CLAUDE.md
Some checks failed
Build / Calculate version information (push) Successful in 17s
Build / build_and_upload (push) Failing after 0s
Build / build_images (push) Failing after 0s
Close stale issues / stale (push) Successful in 13s
Replace informal implementer workflow with structured 7-step protocol
including mandatory root cause analysis for bug fixes. References /done
skill for automated enforcement.

Part of adversarial-reviewer #260.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 22:29:45 +01:00
f1e97b94a7 Add architecture docs and fork maintenance strategy (#6)
Some checks failed
Build / Calculate version information (push) Successful in 13s
Build / build_and_upload (push) Failing after 0s
Build / build_images (push) Failing after 0s
Close stale issues / stale (push) Successful in 15s
Document channel architecture, M3U/XMLTV integration with Jellyfin,
and fork maintenance strategy for the archived upstream. Also includes
CLAUDE.md updates for implementer workflow and project boundaries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 22:42:07 +01:00
5034941a79 Add Claude Code project setup
Some checks failed
Build / Calculate version information (push) Successful in 22s
Build / build_and_upload (push) Failing after 0s
Build / build_images (push) Failing after 0s
Close stale issues / stale (push) Successful in 14s
- CLAUDE.md with architecture overview and development guide
- .mcp.json with docker, ssh, gitea, csharp-lsp, and nuget MCP servers
- Skills for ersatztv and jellyfin
- .gitignore: exclude .mcp/ (built MCP tools)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 23:50:41 +01:00
Jason Dove
0d301df5e8 remove external dependencies (bugsnag, trakt) (#2840)
* remove bugsnag

* remove trakt client id (that will expire)
2026-02-26 10:43:48 -06:00
84 changed files with 810 additions and 559 deletions

View File

@@ -0,0 +1,167 @@
---
name: ersatztv
description: ErsatzTV custom IPTV channel management — REST API, SQLite DB, Jellyfin integration, FFmpeg profiles. Use when managing custom TV channels.
---
# ErsatzTV Channel Management
Container: `ersatztv` | Port: `8409` | IP: `172.16.238.11` (may change on restart)
Web UI: internal only (`http://localhost:8409` via SSH)
SQLite DB: `~/downloadswarm/ersatztv/ersatztv.sqlite3` on jazz (owned by root — use `sudo sqlite3`)
Image: `ghcr.io/ersatztv/ersatztv:latest` (v26.3.0, repo archived Feb 2026)
## Architecture
ErsatzTV uses **MediatR + Blazor** (not REST for mutations). The REST API is limited:
- **GET endpoints**: channels, collections, schedules, playouts, shows, movies, artists, ffmpeg profiles, health, search, watermarks
- **POST endpoints**: library scan, playout reset, show scan
- **No REST CRUD for channels/collections/schedules** — must use SQLite DB directly
## REST API
```bash
# Via docker exec
docker exec ersatztv curl -s http://localhost:8409/api/ENDPOINT
```
### Read Endpoints (GET)
```
/api/channels # List channels
/api/collections # List collections
/api/schedules # List schedules
/api/playouts # List playouts
/api/shows # List shows
/api/movies # List movies
/api/artists # List artists
/api/search # Search items
/api/ffmpeg/profiles # FFmpeg profiles
/api/watermarks # Watermarks
/iptv/channels.m3u # M3U playlist (for Jellyfin)
/iptv/xmltv.xml # XMLTV guide data
```
### Mutation Endpoints (POST)
```bash
# Library scan
POST /api/libraries/{id}/scan
# Scan single show
POST /api/libraries/{id}/scan-show \
-H "Content-Type: application/json" -d '{"ShowTitle":"Name","DeepScan":false}'
# Reset channel playout (rebuilds schedule)
POST /api/channels/{channelNumber}/playout/reset
```
## SQLite DB Operations
```bash
# Read queries (safe while running, WAL mode)
sudo sqlite3 ~/downloadswarm/ersatztv/ersatztv.sqlite3 "QUERY"
# Write queries — stop container first
docker stop ersatztv
sudo sqlite3 ~/downloadswarm/ersatztv/ersatztv.sqlite3 "QUERY"
docker start ersatztv
```
### Key Queries
```sql
-- List channels
SELECT Id, Number, Name FROM Channel ORDER BY CAST(Number AS INTEGER);
-- List collections with item counts
SELECT c.Id, c.Name, COUNT(ci.Id) as items FROM Collection c LEFT JOIN CollectionItem ci ON ci.CollectionId = c.Id GROUP BY c.Id;
-- List schedules
SELECT Id, Name FROM ProgramSchedule;
-- Playout (channel-schedule links)
SELECT p.Id, c.Number, c.Name, ps.Name as Schedule FROM Playout p JOIN Channel c ON p.ChannelId = c.Id LEFT JOIN ProgramSchedule ps ON p.ProgramScheduleId = ps.Id;
-- Media counts
SELECT 'Shows' as type, COUNT(*) FROM Show UNION ALL SELECT 'Movies', COUNT(*) FROM Movie UNION ALL SELECT 'Episodes', COUNT(*) FROM Episode UNION ALL SELECT 'MusicVideos', COUNT(*) FROM MusicVideo;
-- Jellyfin source
SELECT jms.Id, jc.Address, jms.ServerName FROM JellyfinMediaSource jms JOIN JellyfinConnection jc ON jc.JellyfinMediaSourceId = jms.Id;
-- Library sync status
SELECT l.Id, l.Name, l.MediaKind, jl.ShouldSyncItems FROM Library l JOIN JellyfinLibrary jl ON jl.Id = l.Id;
```
### Channel Setup Workflow (DB)
**Show-specific channel** (single TV show, shuffled):
```sql
-- 1. Schedule
INSERT INTO ProgramSchedule (Id, FixedStartTimeBehavior, KeepMultiPartEpisodesTogether, Name, RandomStartPoint, ShuffleScheduleItems, TreatCollectionsAsShows)
VALUES (<id>, 0, 0, '<name>', 1, 0, 1);
-- 2. Schedule item (CollectionType=1 for Show, PlaybackOrder=3 for Shuffle)
INSERT INTO ProgramScheduleItem (Id, CollectionType, FillWithGroupMode, GuideMode, "Index", MarathonGroupBy, MarathonShuffleGroups, MarathonShuffleItems, MediaItemId, PlaybackOrder, ProgramScheduleId)
VALUES (<id>, 1, 0, 0, 0, 0, 0, 0, <show_id>, 3, <schedule_id>);
INSERT INTO ProgramScheduleOneItem (Id) VALUES (<item_id>);
-- 3. Channel
INSERT INTO Channel (Id, Categories, FFmpegProfileId, FallbackFillerId, "Group", IdleBehavior, IsEnabled, MirrorSourceChannelId, MusicVideoCreditsMode, MusicVideoCreditsTemplate, Name, Number, PlayoutMode, PlayoutOffset, PlayoutSource, PreferredAudioLanguageCode, PreferredAudioTitle, PreferredSubtitleLanguageCode, ShowInEpg, SongVideoMode, SortNumber, StreamSelector, StreamSelectorMode, StreamingMode, SubtitleMode, TranscodeMode, UniqueId, WatermarkId)
VALUES (<id>, '', 1, NULL, '<category>', 0, 1, NULL, 0, NULL, '<name>', '<number>', 0, NULL, 0, NULL, NULL, 'eng', 1, 0, <number>.0, NULL, 0, 4, 2, 0, lower(hex(randomblob(4)))||'-'||lower(hex(randomblob(2)))||'-4'||substr(lower(hex(randomblob(2))),2)||'-'||lower(hex(randomblob(2)))||'-'||lower(hex(randomblob(6))), 1);
-- 4. Playout
INSERT INTO Playout (Id, ChannelId, ProgramScheduleId, ScheduleKind, Seed)
VALUES (<id>, <channel_id>, <schedule_id>, 0, abs(random()) % 1000000);
```
**Collection-based channel** (multiple shows, shuffled):
```sql
-- 1. Collection + items (MediaItemId = Show.Id)
INSERT INTO Collection (Id, Name, UseCustomPlaybackOrder) VALUES (<id>, '<name>', 0);
INSERT INTO CollectionItem (CollectionId, MediaItemId) VALUES (<coll_id>, <show_id>);
-- 2. Schedule (same as above but CollectionType=0, CollectionId set instead of MediaItemId)
INSERT INTO ProgramScheduleItem (Id, CollectionId, CollectionType, ..., PlaybackOrder, ProgramScheduleId)
VALUES (<id>, <coll_id>, 0, ..., 3, <schedule_id>);
-- 3-4. Channel + Playout same as show-specific
```
After creating: `POST /api/channels/{number}/playout/reset`
## Volume Mounts (matches Jellyfin)
| Host Path | Container Path |
|-----------|---------------|
| `~/downloadswarm/ersatztv` | `/config` |
| `/mnt/teramind/episodes` | `/data/tvshows` (ro) |
| `/mnt/episodes` | `/data/episodes` (ro) |
| `/mnt/media/movies` | `/data/movies` (ro) |
| `/mnt/media/standup` | `/data/standup` (ro) |
| `/mnt/media/music_videos` | `/data/music` (ro) |
## FFmpeg & Hardware
- QSV (Intel Quick Sync) hardware acceleration
- Resolution: 1920x1080, H264, AAC stereo
- Device: `/dev/dri` passed through
- HardwareAccelerationKind: 0=None, 1=Qsv, 2=Nvenc, 3=Vaapi, 4=VideoToolbox, 5=Amf
## Jellyfin Integration
- Secrets: `/config/jellyfin-secrets.json` (`{"Address":"http://jellyfin:8096","ApiKey":"978033be716d46678a5d3c54ae0e0ff9"}`)
- Libraries: Movies(10), TV Shows(11), Music Videos(8), Standup(9)
- `JellyfinLibrary.ShouldSyncItems` must be `1` for scans to work
## Gotchas
- DB owned by root — always use `sudo sqlite3`
- WAL mode: reads OK while running, stop container for writes
- No REST API for channel/collection/schedule CRUD — DB scripting only
- Secrets file uses PascalCase JSON (`Address`, `ApiKey`)
- Scanner is separate binary (`ErsatzTV.Scanner`) — check with `docker top ersatztv | grep Scanner`
- EF TPT inheritance: `ProgramScheduleItem` has subtype tables (`ProgramScheduleOneItem`, etc.) — MUST insert into subtype table
- External URL logos work for M3U but NOT for watermark burn-in (code checks `File.Exists()`)
- `/api/health` returns Blazor HTML, not JSON — use `/api/channels` to verify API
- PlaybackOrder enum: 3=Shuffle, 6=SeasonEpisode (use 3 for all channels)
- CollectionType enum: 0=Collection, 1=Show (direct show reference via MediaItemId)
- SubtitleMode: 0=None, 2=Burn-in. Set to 2 with PreferredSubtitleLanguageCode='eng' for non-music channels
- MediaItem.State: 0=Normal, 1=FileNotFound — clean up state=1 items by deleting cascading deps
- ProgramSchedule required NOT NULL columns: FixedStartTimeBehavior, KeepMultiPartEpisodesTogether, RandomStartPoint, ShuffleScheduleItems, TreatCollectionsAsShows
- Channel required NOT NULL columns: SongVideoMode (set 0), plus all standard columns (see Channel table schema)
- After schedule changes, rebuild playout: `POST /api/channels/{number}/playout/reset`
- Playout `ScheduleKind` must be `1` (not `0`/None) — `0` causes "Cannot build playout type None" error
- M3U `tvg-logo` URLs hardcode `http://localhost:8409` — Jellyfin can't fetch these from inside its container. Fix by downloading logos from ETV and base64-uploading to Jellyfin (see `docs/Docker/ErsatzTV.md` for script). Tracked in issue #171
- Repo archived Feb 2026, v26.3.0 is final stable version. Maintainer welcomes forks

View File

@@ -0,0 +1,105 @@
---
name: jellyfin
description: Jellyfin media server management — API for libraries, items, streaming, users. Use when managing media library or checking Jellyfin status.
---
# Jellyfin Management
Container: `jellyfin` | Port: `8096` | IP: `172.16.238.20` (may change on restart)
API Token: `978033be716d46678a5d3c54ae0e0ff9`
Web UI: `https://jellyfin.tblindustries.be` (NO Authelia — native login, password: `coup1802`)
Config: `/home/timothy/downloadswarm/jellyfin/` on jazz
## Access Pattern
```bash
docker exec jellyfin curl -s 'http://localhost:8096/ENDPOINT' \
-H 'X-Emby-Token: 978033be716d46678a5d3c54ae0e0ff9'
```
## Volume Mounts
| Host Path | Container Path | Content |
|-----------|---------------|---------|
| `/mnt/teramind/episodes` | `/data/tvshows` | TV shows |
| `/mnt/episodes` | `/data/episodes` | More episodes |
| `/mnt/media/movies` | `/data/movies` | Movies |
| `/mnt/media/standup` | `/data/standup` | Standup |
| `/mnt/media/music_videos` | `/data/music` | Music videos |
| `/mnt/media/audio/music` | `/data/audio` | Music audio (ro) |
## API Endpoints
### System
```
GET /System/Info # Server info, version
GET /System/Info/Public # Public info (no auth needed)
POST /System/Restart # Restart server
```
### Items (Search & Browse)
```bash
# Search items
GET /Items?includeItemTypes=Movie,Episode,Series&recursive=true&searchTerm=QUERY&fields=Path&limit=20
# Get item details
GET /Items?ids=ITEM_ID&fields=Path,MediaStreams,Overview
# Get all movies
GET /Items?includeItemTypes=Movie&recursive=true&fields=Path&limit=1000
# Get series
GET /Items?includeItemTypes=Series&recursive=true&fields=Path
# Get episodes for a series
GET /Shows/{seriesId}/Episodes?fields=Path,MediaStreams
# Filter by library (parentId)
GET /Items?parentId=LIBRARY_ID&recursive=true&fields=Path
```
### Libraries
```
GET /Library/VirtualFolders # List all libraries
POST /Library/Refresh # Trigger full library scan
POST /Items/{id}/Refresh # Refresh single item metadata
```
### Streaming
```bash
# Test stream URL
GET /Videos/{itemId}/stream?static=true
# Get playback info
GET /Items/{itemId}/PlaybackInfo
```
### Users
```
GET /Users # List users
GET /Users/{userId} # User details
```
## Library IDs
Check with: `curl -s -H "X-Emby-Token: TOKEN" http://localhost:8096/Library/VirtualFolders`
## Live TV
- **ErsatzTV** (channels <1000): M3U `http://ersatztv:8409/iptv/channels.m3u`, XMLTV `http://ersatztv:8409/iptv/xmltv.xml`
- **Dispatcharr** (channels 1000+): IPTV stream manager on port 9191, separate tuner
- Configured in Jellyfin Admin > Live TV
- Guide refresh task ID: `bea9b218c97bbf98c5dc1303bdb9a0ca` — trigger via `POST /ScheduledTasks/Running/{id}`
- **Logo fix after guide refresh**: ErsatzTV logos break (aspect ratio=0) because M3U uses `localhost:8409`. Fix script in `docs/Docker/ErsatzTV.md` downloads from ETV and base64-uploads to `POST /Items/{id}/Images/Primary` (body = base64, Content-Type = image/png)
- **Image upload format**: Jellyfin expects base64-encoded body (NOT raw binary) for `POST /Items/{id}/Images/Primary`
## Gotchas
- **Passwords**: `coup1802` (NOT `ded89Lm4`) — Jellyfin has native auth, no Authelia
- Auth header is `X-Emby-Token` (Jellyfin is an Emby fork)
- Music videos are typed as "Movie" in Jellyfin
- Music library at `/data/music` maps to `/mnt/media/music_videos` on host (not actual music)
- Items return 404 on stream if source volume is unmounted
- Jellyfin preserves item IDs across restarts unless files are renamed
- Full library scan can take a long time — prefer targeted `/Items/{id}/Refresh`
- `ffprobe` available in container for checking media streams: `docker exec jellyfin ffprobe -v quiet -print_format json -show_streams FILE`

3
.gitignore vendored
View File

@@ -3,6 +3,9 @@
project.lock.json
.DS_Store
*.pyc
# Claude Code
.mcp/
nupkg/
# Visual Studio Code

56
.mcp.json Normal file
View File

@@ -0,0 +1,56 @@
{
"mcpServers": {
"docker-mcp": {
"command": "uvx",
"args": [
"mcp-server-docker"
],
"env": {
"DOCKER_HOST": "ssh://timothy@192.168.1.99"
}
},
"ssh-mcp": {
"command": "npx",
"args": [
"-y",
"ssh-mcp",
"--",
"--host=192.168.1.99",
"--user=timothy"
],
"env": {}
},
"gitea": {
"command": "gitea-mcp-server",
"args": [
"-t", "stdio",
"-host", "http://192.168.1.95:3000",
"-token", "8341af0733ab9ce084ea7adf38b76aa9ebc3bd67"
],
"env": {}
},
"csharp-lsp": {
"command": "/usr/local/share/dotnet/dotnet",
"args": [
"run",
"--project", "/Users/timothy/ersatztv/.mcp/csharp-lsp-mcp/csharp-lsp-mcp/src/CSharpLspMcp",
"-c", "Release"
],
"env": {
"PATH": "/usr/local/share/dotnet:/Users/timothy/.dotnet/tools:/usr/bin:/bin:/usr/sbin:/sbin"
}
},
"nuget": {
"command": "/usr/local/share/dotnet/dotnet",
"args": [
"dnx",
"NuGet.Mcp.Server",
"--source", "https://api.nuget.org/v3/index.json",
"--yes"
],
"env": {
"DOTNET_ROOT": "/usr/local/share/dotnet"
}
}
}
}

View File

@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Changed
- Remove BugSnag error reporting integration
- Remove developer's personal Trakt API key
- Users who want to continue to use Trakt must create an API app and set the `Client ID` as the environment variable `TRAKT__CLIENTID`
### Fixed
- Support adding trakt lists using `app.trakt.tv` domain (instead of just `trakt.tv`)
## [26.3.0] - 2026-02-24
### Added

91
CLAUDE.md Normal file
View File

@@ -0,0 +1,91 @@
# ErsatzTV Fork
Custom IPTV channel server for Jellyfin. Forked from [ErsatzTV/ErsatzTV](https://github.com/ErsatzTV/ErsatzTV) after upstream archival (Feb 2026, v26.3.0). Our fork lives on [Gitea](http://192.168.1.95:3000/timothy/ersatztv).
## Architecture
- **Language**: C# / .NET 10, Blazor Server UI (MudBlazor)
- **Pattern**: CQRS via MediatR — queries/commands in `ErsatzTV.Application/`
- **Database**: EF Core (SQLite default, MySQL optional) — context in `ErsatzTV.Infrastructure/Data/TvContext.cs`
- **Media**: FFmpeg via CliWrap, SkiaSharp for logo generation
- **Functional C#**: Language Ext (Option, Either monads throughout)
### Project Layout
| Project | Role |
|---------|------|
| `ErsatzTV/` | ASP.NET Core host, Blazor pages, API controllers, DI setup |
| `ErsatzTV.Application/` | MediatR handlers (business logic) |
| `ErsatzTV.Core/` | Domain entities, interfaces, no infrastructure deps |
| `ErsatzTV.Infrastructure/` | EF Core repos, data access |
| `ErsatzTV.Infrastructure.Sqlite/` | SQLite-specific implementations |
| `ErsatzTV.FFmpeg/` | FFmpeg process wrapper |
| `ErsatzTV.Scanner/` | Media library scanning |
### Key Files
- **M3U generation**: `ErsatzTV.Core/Iptv/ChannelPlaylist.cs``ToM3U()`
- **XMLTV generation**: `ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs`
- **IPTV controller**: `ErsatzTV/Controllers/IptvController.cs``/iptv/*` routes
- **Logo generation**: `ErsatzTV.Core/Images/ChannelLogoGenerator.cs`
- **Channel entities**: `ErsatzTV.Core/Domain/Channel.cs`
- **DB context**: `ErsatzTV.Infrastructure/Data/TvContext.cs`
## Deployment
- **Docker host**: jazz (192.168.1.99), container `ersatztv`, port 8409
- **Config volume**: `~/downloadswarm/ersatztv/` on jazz → `/config` in container
- **SQLite DB**: `/config/ersatztv.sqlite3` (WAL mode, root-owned)
- **Image**: `ghcr.io/ersatztv/ersatztv:latest` (to be replaced with our fork's image)
## Development
```bash
# Build
dotnet build ErsatzTV.sln
# Run locally (needs FFmpeg in PATH)
dotnet run --project ErsatzTV
# Docker build
docker build -f docker/Dockerfile -t ersatztv:dev .
```
## Conventions
- Follow existing MediatR CQRS pattern for new features
- Domain logic in `ErsatzTV.Core`, infrastructure in `ErsatzTV.Infrastructure`
- Keep Blazor pages thin — delegate to MediatR handlers
- Test with xUnit (existing test projects)
- Backlog tracked via [Gitea Issues](http://192.168.1.95:3000/timothy/ersatztv/issues)
## Task Completion Protocol
Every task that closes a Gitea issue MUST complete ALL of these before it is considered done. Use `/done <issue>` to run through this automatically.
1. **Root cause** (bug fixes / incidents only): Document WHY the problem existed, not just what was changed. If root cause is unknown, say so explicitly and open a follow-up investigation issue. Fixing symptoms without understanding causes creates recurring problems.
2. **Comment on issues** as you work — what you found, what approach you're taking, any deviations from the suggested fix.
3. **Push changes**: `git push` all commits before closing. Use `fixes #N` in commit messages to auto-close where appropriate.
4. **Close comment**: Add a structured closing comment on the issue covering: what was done, root cause (if applicable), files changed, anything deferred, follow-up issues created, and which docs were updated.
5. **Close the issue** via API or `fixes #N` commit. Leave open with a comment only if partially addressed.
6. **Update docs**: If the change affects operational behavior, update the relevant Obsidian docs (`~/homelab-docs/`), MEMORY.md, or CLAUDE.md inline — not as a follow-up.
7. **Reply to reviewer** (if from adversarial review): Summary of done/deferred/questions. This triggers the next review cycle.
## Project Boundaries
**ersatztv OWNS**: ErsatzTV fork code (C#/.NET), channel/collection/schedule management, M3U/XMLTV generation, the ErsatzTV skill in server-management.
**ersatztv does NOT own**:
- Docker compose configs → server-management (`~/downloadswarm/stacks/ersatztv/`)
- NFS mounts, Ansible, DNS, networking → server-management
- Content sourcing (yt-dlp downloads, Sonarr/Radarr libraries) → media-management (planned)
- Jellyfin skill → server-management (symlinked)
**For infrastructure changes** (Docker, NFS, ports, Authelia): open an issue in `timothy/server-management`.
**For content/media sourcing questions** (what goes into channels, yt-dlp pipelines): open an issue in `timothy/media-management` once it exists; for now, `timothy/server-management`.
**For plan/audit reviews**: open `~/adversarial-reviewer` before significant architecture changes.
**Full cross-project rules**: `~/homelab-docs/Operations/Project Boundaries.md` (https://docs.tblindustries.be).
**ErsatzTV docs**: `~/homelab-docs/Docker/ErsatzTV.md` + project-local `docs/` (fork strategy, channels, M3U/XMLTV).

View File

@@ -10,7 +10,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bugsnag" Version="4.1.0" />
<PackageReference Include="CliWrap" Version="3.10.0" />
<PackageReference Include="Humanizer.Core" Version="3.0.1" />
<PackageReference Include="MediatR" Version="[12.5.0]" />

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
@@ -8,16 +7,13 @@ namespace ErsatzTV.Application.Maintenance;
public class EmptyTrashHandler : IRequestHandler<EmptyTrash, Either<BaseError, Unit>>
{
private readonly IClient _client;
private readonly IMediaItemRepository _mediaItemRepository;
private readonly ISearchIndex _searchIndex;
public EmptyTrashHandler(
IClient client,
IMediaItemRepository mediaItemRepository,
ISearchIndex searchIndex)
{
_client = client;
_mediaItemRepository = mediaItemRepository;
_searchIndex = searchIndex;
}
@@ -27,7 +23,6 @@ public class EmptyTrashHandler : IRequestHandler<EmptyTrash, Either<BaseError, U
CancellationToken cancellationToken)
{
SearchResult result = await _searchIndex.Search(
_client,
"state:FileNotFound",
string.Empty,
0,

View File

@@ -110,10 +110,10 @@ public partial class AddTraktListHandler : TraktCommandBase, IRequestHandler<Add
return maybeList.Map(_ => Unit.Default);
}
[GeneratedRegex(@"https:\/\/trakt\.tv\/users\/([\w\-_]+)\/(?:lists\/)?([\w\-_]+)")]
[GeneratedRegex(@"https:\/\/(?:app\.)?trakt\.tv\/users\/([\w\-_]+)\/(?:lists\/)?([\w\-_]+)")]
private static partial Regex UriTraktListRegex();
[GeneratedRegex(@"https:\/\/trakt\.tv\/lists\/([\w\-_]+)\/([\w\-_]+)")]
[GeneratedRegex(@"https:\/\/(?:app\.)?trakt\.tv\/lists\/([\w\-_]+)\/([\w\-_]+)")]
private static partial Regex UriTraktListRegex2();
[GeneratedRegex(@"([\w\-_]+)\/(?:lists\/)?([\w\-_]+)")]

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using EFCore.BulkExtensions;
using ErsatzTV.Application.Channels;
using ErsatzTV.Application.Subtitles;
@@ -22,7 +21,6 @@ public class BuildPlayoutHandler : IRequestHandler<BuildPlayout, Either<BaseErro
{
private readonly IBlockPlayoutBuilder _blockPlayoutBuilder;
private readonly IBlockPlayoutFillerBuilder _blockPlayoutFillerBuilder;
private readonly IClient _client;
private readonly IDbContextFactory<TvContext> _dbContextFactory;
private readonly IEntityLocker _entityLocker;
private readonly IExternalJsonPlayoutBuilder _externalJsonPlayoutBuilder;
@@ -35,7 +33,6 @@ public class BuildPlayoutHandler : IRequestHandler<BuildPlayout, Either<BaseErro
private readonly IScriptedPlayoutBuilder _scriptedPlayoutBuilder;
public BuildPlayoutHandler(
IClient client,
IDbContextFactory<TvContext> dbContextFactory,
IPlayoutBuilder playoutBuilder,
IBlockPlayoutBuilder blockPlayoutBuilder,
@@ -49,7 +46,6 @@ public class BuildPlayoutHandler : IRequestHandler<BuildPlayout, Either<BaseErro
ChannelWriter<IBackgroundServiceRequest> workerChannel,
ILogger<BuildPlayoutHandler> logger)
{
_client = client;
_dbContextFactory = dbContextFactory;
_playoutBuilder = playoutBuilder;
_blockPlayoutBuilder = blockPlayoutBuilder;
@@ -348,7 +344,6 @@ public class BuildPlayoutHandler : IRequestHandler<BuildPlayout, Either<BaseErro
newBuildStatus.Success = false;
newBuildStatus.Message = $"Timeout building playout for channel {channelName}";
_client.Notify(ex);
return BaseError.New(
$"Timeout building playout for channel {channelName}; this may be a bug!");
}
@@ -359,7 +354,6 @@ public class BuildPlayoutHandler : IRequestHandler<BuildPlayout, Either<BaseErro
newBuildStatus.Success = false;
newBuildStatus.Message = $"Unexpected error building playout for channel {channelName}: {ex}";
_client.Notify(ex);
return BaseError.New(
$"Unexpected error building playout for channel {channelName}: {ex.Message}");
}

View File

@@ -1,10 +1,9 @@
using Bugsnag;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Infrastructure.Search;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexAllItemsHandler(IClient client, ISearchIndex searchIndex)
public class QuerySearchIndexAllItemsHandler(ISearchIndex searchIndex)
: IRequestHandler<QuerySearchIndexAllItems, SearchResultAllItemsViewModel>
{
public async Task<SearchResultAllItemsViewModel> Handle(
@@ -23,7 +22,7 @@ public class QuerySearchIndexAllItemsHandler(IClient client, ISearchIndex search
await GetIds(LuceneSearchIndex.RemoteStreamType, request.Query, cancellationToken));
private async Task<List<int>> GetIds(string type, string query, CancellationToken cancellationToken) =>
(await searchIndex.Search(client, $"type:{type} AND ({query})", string.Empty, 0, 0, cancellationToken)).Items
(await searchIndex.Search($"type:{type} AND ({query})", string.Empty, 0, 0, cancellationToken)).Items
.Map(i => i.Id)
.ToList();
}

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Data;
@@ -9,7 +8,6 @@ using static ErsatzTV.Application.MediaCards.Mapper;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexArtistsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<QuerySearchIndexArtists, ArtistCardResultsViewModel>
@@ -19,7 +17,6 @@ public class QuerySearchIndexArtistsHandler(
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Extensions;
using ErsatzTV.Core.Interfaces.Emby;
@@ -17,7 +16,6 @@ namespace ErsatzTV.Application.Search;
public class
QuerySearchIndexEpisodesHandler(
IClient client,
ISearchIndex searchIndex,
IPlexPathReplacementService plexPathReplacementService,
IJellyfinPathReplacementService jellyfinPathReplacementService,
@@ -31,7 +29,6 @@ public class
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Data;
@@ -9,7 +8,6 @@ using static ErsatzTV.Application.MediaCards.Mapper;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexImagesHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<QuerySearchIndexImages, ImageCardResultsViewModel>
@@ -19,7 +17,6 @@ public class QuerySearchIndexImagesHandler(
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
@@ -10,7 +9,6 @@ using static ErsatzTV.Application.MediaCards.Mapper;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexMoviesHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: QuerySearchIndexHandlerBase, IRequestHandler<QuerySearchIndexMovies, MovieCardResultsViewModel>
@@ -20,7 +18,6 @@ public class QuerySearchIndexMoviesHandler(
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Extensions;
using ErsatzTV.Core.Interfaces.Emby;
@@ -15,7 +14,6 @@ namespace ErsatzTV.Application.Search;
public class
QuerySearchIndexMusicVideosHandler(
IClient client,
ISearchIndex searchIndex,
IPlexPathReplacementService plexPathReplacementService,
IJellyfinPathReplacementService jellyfinPathReplacementService,
@@ -28,7 +26,6 @@ public class
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Data;
@@ -10,7 +9,6 @@ namespace ErsatzTV.Application.Search;
public class
QuerySearchIndexOtherVideosHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<QuerySearchIndexOtherVideos, OtherVideoCardResultsViewModel>
@@ -20,7 +18,6 @@ public class
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Data;
@@ -9,7 +8,6 @@ using static ErsatzTV.Application.MediaCards.Mapper;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexRemoteStreamsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<QuerySearchIndexRemoteStreams, RemoteStreamCardResultsViewModel>
@@ -19,7 +17,6 @@ public class QuerySearchIndexRemoteStreamsHandler(
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
@@ -11,7 +10,6 @@ namespace ErsatzTV.Application.Search;
public class
QuerySearchIndexSeasonsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: QuerySearchIndexHandlerBase, IRequestHandler<QuerySearchIndexSeasons, TelevisionSeasonCardResultsViewModel>
@@ -21,7 +19,6 @@ public class
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
@@ -11,7 +10,6 @@ namespace ErsatzTV.Application.Search;
public class
QuerySearchIndexShowsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: QuerySearchIndexHandlerBase, IRequestHandler<QuerySearchIndexShows, TelevisionShowCardResultsViewModel>
@@ -21,7 +19,6 @@ public class
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Application.MediaCards;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Data;
@@ -8,7 +7,7 @@ using static ErsatzTV.Application.MediaCards.Mapper;
namespace ErsatzTV.Application.Search;
public class QuerySearchIndexSongsHandler(IClient client, ISearchIndex searchIndex, IDbContextFactory<TvContext> dbContextFactory)
public class QuerySearchIndexSongsHandler(ISearchIndex searchIndex, IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<QuerySearchIndexSongs, SongCardResultsViewModel>
{
public async Task<SongCardResultsViewModel> Handle(
@@ -16,7 +15,6 @@ public class QuerySearchIndexSongsHandler(IClient client, ISearchIndex searchInd
CancellationToken cancellationToken)
{
SearchResult searchResult = await searchIndex.Search(
client,
request.Query,
string.Empty,
(request.PageNumber - 1) * request.PageSize,

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.Globalization;
using Bugsnag;
using ErsatzTV.Application.MediaItems;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Search;
@@ -11,10 +10,9 @@ using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Search;
public class SearchMoviesHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: SearchUsingSearchIndexHandler(client, searchIndex), IRequestHandler<SearchMovies, List<NamedMediaItemViewModel>>
: SearchUsingSearchIndexHandler(searchIndex), IRequestHandler<SearchMovies, List<NamedMediaItemViewModel>>
{
public async Task<List<NamedMediaItemViewModel>> Handle(SearchMovies request, CancellationToken cancellationToken)
{

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.Globalization;
using Bugsnag;
using ErsatzTV.Application.MediaItems;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Infrastructure.Data;
@@ -10,10 +9,9 @@ using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Search;
public class SearchTelevisionSeasonsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: SearchUsingSearchIndexHandler(client, searchIndex),
: SearchUsingSearchIndexHandler(searchIndex),
IRequestHandler<SearchTelevisionSeasons, List<NamedMediaItemViewModel>>
{
public async Task<List<NamedMediaItemViewModel>> Handle(

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.Globalization;
using Bugsnag;
using ErsatzTV.Application.MediaItems;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Search;
@@ -11,10 +10,9 @@ using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Search;
public class SearchTelevisionShowsHandler(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
: SearchUsingSearchIndexHandler(client, searchIndex),
: SearchUsingSearchIndexHandler(searchIndex),
IRequestHandler<SearchTelevisionShows, List<NamedMediaItemViewModel>>
{
public async Task<List<NamedMediaItemViewModel>> Handle(

View File

@@ -1,18 +1,16 @@
using System.Collections.Immutable;
using Bugsnag;
using ErsatzTV.Core.Interfaces.Search;
using ErsatzTV.Infrastructure.Search;
namespace ErsatzTV.Application.Search;
public abstract class SearchUsingSearchIndexHandler(IClient client, ISearchIndex searchIndex)
public abstract class SearchUsingSearchIndexHandler(ISearchIndex searchIndex)
{
private const int PageSize = 10;
protected async Task<ImmutableHashSet<int>> Search(string type, string query, CancellationToken cancellationToken)
{
var searchResult = await searchIndex.Search(
client,
$"type:{type} AND *{query.Replace(" ", @"\ ")}*",
string.Empty,
0,

View File

@@ -1,6 +1,5 @@
using System.IO.Abstractions;
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application.Channels;
using ErsatzTV.Application.Graphics;
using ErsatzTV.Application.Maintenance;
@@ -22,7 +21,6 @@ namespace ErsatzTV.Application.Streaming;
public class StartFFmpegSessionHandler : IRequestHandler<StartFFmpegSession, Either<BaseError, Unit>>
{
private readonly IClient _client;
private readonly IFileSystem _fileSystem;
private readonly IConfigElementRepository _configElementRepository;
private readonly IFFmpegSegmenterService _ffmpegSegmenterService;
@@ -42,7 +40,6 @@ public class StartFFmpegSessionHandler : IRequestHandler<StartFFmpegSession, Eit
IHlsInitSegmentCache hlsInitSegmentCache,
IServiceScopeFactory serviceScopeFactory,
IMediator mediator,
IClient client,
IFileSystem fileSystem,
ILocalFileSystem localFileSystem,
ILogger<StartFFmpegSessionHandler> logger,
@@ -57,7 +54,6 @@ public class StartFFmpegSessionHandler : IRequestHandler<StartFFmpegSession, Eit
_hlsInitSegmentCache = hlsInitSegmentCache;
_serviceScopeFactory = serviceScopeFactory;
_mediator = mediator;
_client = client;
_fileSystem = fileSystem;
_localFileSystem = localFileSystem;
_logger = logger;
@@ -129,7 +125,6 @@ public class StartFFmpegSessionHandler : IRequestHandler<StartFFmpegSession, Eit
_ => new HlsSessionWorker(
_serviceScopeFactory,
_graphicsEngine,
_client,
OutputFormatKind.Hls,
_hlsPlaylistFilter,
_hlsInitSegmentCache,

View File

@@ -5,7 +5,6 @@ using System.IO.Abstractions;
using System.IO.Pipelines;
using System.Text;
using System.Timers;
using Bugsnag;
using CliWrap;
using CliWrap.Buffered;
using ErsatzTV.Application.Channels;
@@ -28,7 +27,6 @@ namespace ErsatzTV.Application.Streaming;
public class HlsSessionWorker : IHlsSessionWorker
{
private static int _workAheadCount;
private readonly IClient _client;
private readonly OutputFormatKind _outputFormatKind;
private readonly IHlsInitSegmentCache _hlsInitSegmentCache;
private readonly Dictionary<long, int> _discontinuityMap = [];
@@ -60,7 +58,6 @@ public class HlsSessionWorker : IHlsSessionWorker
public HlsSessionWorker(
IServiceScopeFactory serviceScopeFactory,
IGraphicsEngine graphicsEngine,
IClient client,
OutputFormatKind outputFormatKind,
IHlsPlaylistFilter hlsPlaylistFilter,
IHlsInitSegmentCache hlsInitSegmentCache,
@@ -73,7 +70,6 @@ public class HlsSessionWorker : IHlsSessionWorker
_serviceScope = serviceScopeFactory.CreateScope();
_mediator = _serviceScope.ServiceProvider.GetRequiredService<IMediator>();
_graphicsEngine = graphicsEngine;
_client = client;
_outputFormatKind = outputFormatKind;
_hlsInitSegmentCache = hlsInitSegmentCache;
_hlsPlaylistFilter = hlsPlaylistFilter;
@@ -660,15 +656,6 @@ public class HlsSessionWorker : IHlsSessionWorker
{
_logger.LogError(ex, "Error transcoding channel {Channel} - {Message}", _channelNumber, ex.Message);
try
{
_client.Notify(ex);
}
catch (Exception)
{
// do nothing
}
return false;
}
finally

View File

@@ -1,6 +1,5 @@
using System.IO.Abstractions;
using System.Text;
using Bugsnag;
using CliWrap;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
@@ -13,7 +12,6 @@ using Newtonsoft.Json;
namespace ErsatzTV.Application.Streaming;
public class GetLastPtsTimeHandler(
IClient client,
IFileSystem fileSystem,
ITempFilePool tempFilePool,
IConfigElementRepository configElementRepository,
@@ -181,9 +179,9 @@ public class GetLastPtsTimeHandler(
logger.LogWarning("Transcode folder is in bad state; troubleshooting info saved to {File}", file);
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
// do nothing
}
}

View File

@@ -7,7 +7,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bugsnag" Version="4.1.0" />
<PackageReference Include="CliWrap" Version="3.10.0" />
<PackageReference Include="LanguageExt.Core" Version="4.4.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.2" />

View File

@@ -1,7 +1,5 @@
using Bugsnag;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Metadata;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
@@ -11,7 +9,7 @@ namespace ErsatzTV.Core.Tests.Metadata;
public class FallbackMetadataProviderTests
{
[SetUp]
public void SetUp() => _fallbackMetadataProvider = new FallbackMetadataProvider(Substitute.For<IClient>());
public void SetUp() => _fallbackMetadataProvider = new FallbackMetadataProvider();
private FallbackMetadataProvider _fallbackMetadataProvider;

View File

@@ -1,4 +1,3 @@
using Bugsnag;
using Dapper;
using Destructurama;
using ErsatzTV.Core.Domain;
@@ -93,8 +92,6 @@ public class ScheduleIntegrationTests
services.AddSingleton<ISearchIndex, LuceneSearchIndex>();
services.AddSingleton<ILanguageCodeCache, LanguageCodeCache>();
services.AddSingleton(_ => Substitute.For<IClient>());
ServiceProvider provider = services.BuildServiceProvider();
IDbContextFactory<TvContext> factory = provider.GetRequiredService<IDbContextFactory<TvContext>>();
@@ -110,7 +107,6 @@ public class ScheduleIntegrationTests
await searchIndex.Initialize(
new LocalFileSystem(
new MockFileSystem(),
provider.GetRequiredService<IClient>(),
provider.GetRequiredService<ILogger<LocalFileSystem>>()),
provider.GetRequiredService<IConfigElementRepository>(),
_cancellationToken);
@@ -123,7 +119,7 @@ public class ScheduleIntegrationTests
var builder = new PlayoutBuilder(
new ConfigElementRepository(factory),
new MediaCollectionRepository(Substitute.For<IClient>(), searchIndex, factory),
new MediaCollectionRepository(searchIndex, factory),
new TelevisionRepository(factory, provider.GetRequiredService<ILogger<TelevisionRepository>>()),
new ArtistRepository(factory),
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>(),
@@ -319,7 +315,7 @@ public class ScheduleIntegrationTests
var builder = new PlayoutBuilder(
new ConfigElementRepository(factory),
new MediaCollectionRepository(Substitute.For<IClient>(), Substitute.For<ISearchIndex>(), factory),
new MediaCollectionRepository(Substitute.For<ISearchIndex>(), factory),
new TelevisionRepository(factory, provider.GetRequiredService<ILogger<TelevisionRepository>>()),
new ArtistRepository(factory),
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>(),

View File

@@ -10,7 +10,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bugsnag" Version="4.1.0" />
<PackageReference Include="Destructurama.Attributed" Version="5.2.0" />
<PackageReference Include="Flurl" Version="4.0.0" />
<PackageReference Include="Humanizer.Core" Version="3.0.1" />

View File

@@ -1,5 +1,4 @@
using System.Diagnostics;
using Bugsnag;
using CliWrap;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.FFmpeg;
@@ -12,7 +11,6 @@ namespace ErsatzTV.Core.FFmpeg;
public class FFmpegProcessService
{
private readonly IClient _client;
private readonly IFFmpegStreamSelector _ffmpegStreamSelector;
private readonly ILogger<FFmpegProcessService> _logger;
private readonly ITempFilePool _tempFilePool;
@@ -20,12 +18,10 @@ public class FFmpegProcessService
public FFmpegProcessService(
IFFmpegStreamSelector ffmpegStreamSelector,
ITempFilePool tempFilePool,
IClient client,
ILogger<FFmpegProcessService> logger)
{
_ffmpegStreamSelector = ffmpegStreamSelector;
_tempFilePool = tempFilePool;
_client = client;
_logger = logger;
}
@@ -131,7 +127,6 @@ public class FFmpegProcessService
catch (Exception ex)
{
_logger.LogWarning(ex, "Error generating song image");
_client.Notify(ex);
return Left(BaseError.New(ex.Message));
}
}

View File

@@ -1,5 +0,0 @@
namespace ErsatzTV.Core.Health.Checks;
public interface IErrorReportsHealthCheck : IHealthCheck
{
}

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Metadata;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Search;
@@ -38,7 +37,6 @@ public interface ISearchIndex : IDisposable
Task<bool> RemoveItems(IEnumerable<int> ids);
Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,
@@ -46,7 +44,6 @@ public interface ISearchIndex : IDisposable
CancellationToken cancellationToken);
Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,

View File

@@ -1,12 +1,11 @@
using System.Globalization;
using System.Text.RegularExpressions;
using Bugsnag;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Metadata;
namespace ErsatzTV.Core.Metadata;
public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadataProvider
public partial class FallbackMetadataProvider : IFallbackMetadataProvider
{
private static readonly Regex SeasonPattern = SeasonNumber();
@@ -203,7 +202,7 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
[GeneratedRegex(@"s(?:eason)?\s?(\d+)(?![e\d])", RegexOptions.IgnoreCase)]
private static partial Regex SeasonNumber();
private List<EpisodeMetadata> GetEpisodeMetadata(string fileName, EpisodeMetadata baseMetadata)
private static List<EpisodeMetadata> GetEpisodeMetadata(string fileName, EpisodeMetadata baseMetadata)
{
var result = new List<EpisodeMetadata> { baseMetadata };
@@ -260,15 +259,15 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
}
}
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
// do nothing
}
return result;
}
private MovieMetadata GetMovieMetadata(string fileName, MovieMetadata metadata)
private static MovieMetadata GetMovieMetadata(string fileName, MovieMetadata metadata)
{
try
{
@@ -283,15 +282,15 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
metadata.DateUpdated = DateTime.UtcNow;
}
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
// do nothing
}
return metadata;
}
private Option<MusicVideoMetadata> GetMusicVideoMetadata(string fileName, MusicVideoMetadata metadata)
private static Option<MusicVideoMetadata> GetMusicVideoMetadata(string fileName, MusicVideoMetadata metadata)
{
try
{
@@ -310,14 +309,13 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
return metadata;
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
return None;
}
}
private Option<OtherVideoMetadata> GetOtherVideoMetadata(string path, OtherVideoMetadata metadata)
private static Option<OtherVideoMetadata> GetOtherVideoMetadata(string path, OtherVideoMetadata metadata)
{
try
{
@@ -348,14 +346,13 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
return metadata;
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
return None;
}
}
private Option<ImageMetadata> GetImageMetadata(string path, ImageMetadata metadata)
private static Option<ImageMetadata> GetImageMetadata(string path, ImageMetadata metadata)
{
try
{
@@ -386,14 +383,13 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
return metadata;
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
return None;
}
}
private Option<RemoteStreamMetadata> GetRemoteStreamMetadata(string path, RemoteStreamMetadata metadata)
private static Option<RemoteStreamMetadata> GetRemoteStreamMetadata(string path, RemoteStreamMetadata metadata)
{
try
{
@@ -424,14 +420,13 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
return metadata;
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
return None;
}
}
private Option<SongMetadata> GetSongMetadata(string path, SongMetadata metadata)
private static Option<SongMetadata> GetSongMetadata(string path, SongMetadata metadata)
{
try
{
@@ -462,14 +457,13 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
return metadata;
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
return None;
}
}
private ShowMetadata GetTelevisionShowMetadata(string fileName, ShowMetadata metadata)
private static ShowMetadata GetTelevisionShowMetadata(string fileName, ShowMetadata metadata)
{
try
{
@@ -484,9 +478,9 @@ public partial class FallbackMetadataProvider(IClient client) : IFallbackMetadat
metadata.DateUpdated = DateTime.UtcNow;
}
}
catch (Exception ex)
catch (Exception)
{
client.Notify(ex);
// do nothing
}
return metadata;

View File

@@ -1,13 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using System.IO.Abstractions;
using System.Security.Cryptography;
using Bugsnag;
using ErsatzTV.Core.Interfaces.Metadata;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Core.Metadata;
public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<LocalFileSystem> logger) : ILocalFileSystem
public class LocalFileSystem(IFileSystem fileSystem, ILogger<LocalFileSystem> logger) : ILocalFileSystem
{
public Unit EnsureFolderExists(string folder)
{
@@ -50,10 +49,9 @@ public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<Loc
{
logger.LogWarning("Unauthorized access exception listing subdirectories of folder {Folder}", folder);
}
catch (Exception ex)
catch (Exception)
{
// do nothing
client.Notify(ex);
}
}
@@ -73,10 +71,9 @@ public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<Loc
{
logger.LogWarning("Unauthorized access exception listing files in folder {Folder}", folder);
}
catch (Exception ex)
catch (Exception)
{
// do nothing
client.Notify(ex);
}
}
@@ -96,10 +93,9 @@ public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<Loc
{
logger.LogWarning("Unauthorized access exception listing files in folder {Folder}", folder);
}
catch (Exception ex)
catch (Exception)
{
// do nothing
client.Notify(ex);
}
}
@@ -123,10 +119,9 @@ public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<Loc
{
logger.LogWarning("Unauthorized access exception listing files in folder {Folder}", folder);
}
catch (Exception ex)
catch (Exception)
{
// do nothing
client.Notify(ex);
}
}
@@ -151,7 +146,6 @@ public class LocalFileSystem(IFileSystem fileSystem, IClient client, ILogger<Loc
}
catch (Exception ex)
{
client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using Bugsnag;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Metadata;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.FFmpeg.Capabilities;
@@ -24,7 +23,6 @@ public class LocalStatisticsProviderTests
Substitute.For<IMetadataRepository>(),
new MockFileSystem(),
Substitute.For<ILocalFileSystem>(),
Substitute.For<IClient>(),
Substitute.For<IHardwareCapabilitiesFactory>(),
Substitute.For<ILogger<LocalStatisticsProvider>>());

View File

@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Bugsnag;
using Dapper;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Repositories;
@@ -14,16 +13,13 @@ namespace ErsatzTV.Infrastructure.Data.Repositories;
public class MediaCollectionRepository : IMediaCollectionRepository
{
private readonly IClient _client;
private readonly IDbContextFactory<TvContext> _dbContextFactory;
private readonly ISearchIndex _searchIndex;
public MediaCollectionRepository(
IClient client,
ISearchIndex searchIndex,
IDbContextFactory<TvContext> dbContextFactory)
{
_client = client;
_searchIndex = searchIndex;
_dbContextFactory = dbContextFactory;
}
@@ -463,7 +459,6 @@ public class MediaCollectionRepository : IMediaCollectionRepository
// elasticsearch doesn't like when we ask for a limit of zero, so use 10,000
SearchResult searchResults = await _searchIndex.Search(
_client,
query,
smartCollectionName,
0,

View File

@@ -1,33 +0,0 @@
using ErsatzTV.Core.Errors;
using ErsatzTV.Core.Health;
using ErsatzTV.Core.Health.Checks;
using Microsoft.Extensions.Options;
namespace ErsatzTV.Infrastructure.Health.Checks;
public class ErrorReportsHealthCheck : BaseHealthCheck, IErrorReportsHealthCheck
{
private readonly IOptions<BugsnagConfiguration> _bugsnagConfiguration;
public ErrorReportsHealthCheck(IOptions<BugsnagConfiguration> bugsnagConfiguration) =>
_bugsnagConfiguration = bugsnagConfiguration;
public override string Title => "Error Reports";
public Task<HealthCheckResult> Check(CancellationToken cancellationToken)
{
if (_bugsnagConfiguration.Value.Enable)
{
return Result(
HealthCheckStatus.Pass,
"Automated error reporting is enabled, thank you! To disable, edit the file appsettings.json or set the Bugsnag:Enable environment variable to false",
"Automated error reporting is enabled, thank you!")
.AsTask();
}
return InfoResult(
"Automated error reporting is disabled. Please enable to support bug fixing efforts!",
"Automated error reporting is disabled")
.AsTask();
}
}

View File

@@ -27,7 +27,6 @@ public class HealthCheckService : IHealthCheckService
IFileNotFoundHealthCheck fileNotFoundHealthCheck,
IUnavailableHealthCheck unavailableHealthCheck,
IVaapiDriverHealthCheck vaapiDriverHealthCheck,
IErrorReportsHealthCheck errorReportsHealthCheck,
IUnifiedDockerHealthCheck unifiedDockerHealthCheck,
IDowngradeHealthCheck downgradeHealthCheck,
IEmptyScheduleHealthCheck emptyScheduleHealthCheck,
@@ -53,8 +52,7 @@ public class HealthCheckService : IHealthCheckService
fileNotFoundHealthCheck,
unavailableHealthCheck,
emptyScheduleHealthCheck,
vaapiDriverHealthCheck,
errorReportsHealthCheck
vaapiDriverHealthCheck
];
}

View File

@@ -4,7 +4,6 @@ using System.Globalization;
using System.IO.Abstractions;
using System.Text;
using System.Text.RegularExpressions;
using Bugsnag;
using CliWrap;
using CliWrap.Buffered;
using ErsatzTV.Core;
@@ -21,7 +20,6 @@ namespace ErsatzTV.Infrastructure.Metadata;
public partial class LocalStatisticsProvider : ILocalStatisticsProvider
{
private readonly IClient _client;
private readonly IHardwareCapabilitiesFactory _hardwareCapabilitiesFactory;
private readonly ILocalFileSystem _localFileSystem;
private readonly ILogger<LocalStatisticsProvider> _logger;
@@ -32,14 +30,12 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
IMetadataRepository metadataRepository,
IFileSystem fileSystem,
ILocalFileSystem localFileSystem,
IClient client,
IHardwareCapabilitiesFactory hardwareCapabilitiesFactory,
ILogger<LocalStatisticsProvider> logger)
{
_metadataRepository = metadataRepository;
_fileSystem = fileSystem;
_localFileSystem = localFileSystem;
_client = client;
_hardwareCapabilitiesFactory = hardwareCapabilitiesFactory;
_logger = logger;
}
@@ -71,7 +67,6 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to refresh statistics for media item {Id}", mediaItem.Id);
_client.Notify(ex);
return BaseError.New(ex.Message);
}
}
@@ -130,7 +125,6 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to get format tags for media item {Id}", mediaItem.Id);
_client.Notify(ex);
return BaseError.New(ex.Message);
}
}
@@ -225,7 +219,6 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to refresh statistics for media item {Id}", mediaItem.Id);
_client.Notify(ex);
return BaseError.New(ex.Message);
}
}
@@ -466,9 +459,8 @@ public partial class LocalStatisticsProvider : ILocalStatisticsProvider
_logger.LogError("Duration analysis failed for media item at {Path}", path);
}
}
catch (Exception ex)
catch (Exception)
{
_client.Notify(ex);
_logger.LogError("Duration analysis failed for media item at {Path}", path);
}
}

View File

@@ -1,5 +1,4 @@
using System.Globalization;
using Bugsnag;
using Elastic.Clients.Elasticsearch.Aggregations;
using Elastic.Clients.Elasticsearch.Core.Bulk;
using Elastic.Clients.Elasticsearch.IndexManagement;
@@ -168,13 +167,11 @@ public class ElasticSearchIndex : ISearchIndex
}
public Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,
int limit,
CancellationToken cancellationToken) => Search(
client,
query,
smartCollectionName,
skip,
@@ -183,7 +180,6 @@ public class ElasticSearchIndex : ISearchIndex
cancellationToken);
public async Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,

View File

@@ -1,5 +1,4 @@
using System.Globalization;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Metadata;
@@ -212,13 +211,11 @@ public sealed class LuceneSearchIndex : ISearchIndex
// default to title field only
public Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,
int limit,
CancellationToken cancellationToken) => Search(
client,
query,
smartCollectionName,
skip,
@@ -227,7 +224,6 @@ public sealed class LuceneSearchIndex : ISearchIndex
cancellationToken);
public async Task<SearchResult> Search(
IClient client,
string query,
string smartCollectionName,
int skip,
@@ -235,15 +231,6 @@ public sealed class LuceneSearchIndex : ISearchIndex
List<string> defaultFields,
CancellationToken cancellationToken)
{
var metadata = new Dictionary<string, string>
{
{ "searchQuery", query },
{ "skip", skip.ToString(CultureInfo.InvariantCulture) },
{ "limit", limit.ToString(CultureInfo.InvariantCulture) }
};
client?.Breadcrumbs?.Leave("SearchIndex.Search", BreadcrumbType.State, metadata);
query ??= string.Empty;
if (string.IsNullOrWhiteSpace(query.Replace("*", string.Empty).Replace("?", string.Empty)) ||

View File

@@ -2,7 +2,6 @@
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using Bugsnag;
using CliWrap;
using CliWrap.Buffered;
using ErsatzTV.Core;
@@ -246,7 +245,6 @@ public class TranscodingTests
{
var localFileSystem = new LocalFileSystem(
new RealFileSystem(),
Substitute.For<IClient>(),
LoggerFactory.CreateLogger<LocalFileSystem>());
var fileSystem = new MockFileSystem();
var tempFilePool = new TempFilePool();
@@ -276,7 +274,6 @@ public class TranscodingTests
var oldService = new FFmpegProcessService(
new FakeStreamSelector(),
tempFilePool,
Substitute.For<IClient>(),
LoggerFactory.CreateLogger<FFmpegProcessService>());
var service = new FFmpegLibraryProcessService(
@@ -368,7 +365,6 @@ public class TranscodingTests
metadataRepository,
fileSystem,
localFileSystem,
Substitute.For<IClient>(),
Substitute.For<IHardwareCapabilitiesFactory>(),
LoggerFactory.CreateLogger<LocalStatisticsProvider>());
@@ -484,7 +480,6 @@ public class TranscodingTests
var localFileSystem = new LocalFileSystem(
new MockFileSystem(),
Substitute.For<IClient>(),
LoggerFactory.CreateLogger<LocalFileSystem>());
var fileSystem = new MockFileSystem();
@@ -533,7 +528,6 @@ public class TranscodingTests
metadataRepository,
fileSystem,
localFileSystem,
Substitute.For<IClient>(),
Substitute.For<IHardwareCapabilitiesFactory>(),
LoggerFactory.CreateLogger<LocalStatisticsProvider>());
@@ -1007,7 +1001,6 @@ public class TranscodingTests
var oldService = new FFmpegProcessService(
new FakeStreamSelector(),
Substitute.For<ITempFilePool>(),
Substitute.For<IClient>(),
LoggerFactory.CreateLogger<FFmpegProcessService>());
var service = new FFmpegLibraryProcessService(

View File

@@ -1,5 +1,4 @@
using System.Globalization;
using Bugsnag;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Metadata;
@@ -61,7 +60,7 @@ public class LocalSubtitlesProviderTests
Substitute.For<IMediaItemRepository>(),
Substitute.For<IMetadataRepository>(),
fileSystem,
new LocalFileSystem(fileSystem, Substitute.For<IClient>(), Substitute.For<ILogger<LocalFileSystem>>()),
new LocalFileSystem(fileSystem, Substitute.For<ILogger<LocalFileSystem>>()),
Substitute.For<ILogger<LocalSubtitlesProvider>>());
List<Subtitle> result = provider.LocateExternalSubtitles(
@@ -115,7 +114,7 @@ public class LocalSubtitlesProviderTests
Substitute.For<IMediaItemRepository>(),
Substitute.For<IMetadataRepository>(),
fileSystem,
new LocalFileSystem(fileSystem, Substitute.For<IClient>(), Substitute.For<ILogger<LocalFileSystem>>()),
new LocalFileSystem(fileSystem, Substitute.For<ILogger<LocalFileSystem>>()),
Substitute.For<ILogger<LocalSubtitlesProvider>>());
List<Subtitle> result = provider.LocateExternalSubtitles(

View File

@@ -1,5 +1,4 @@
using System.Runtime.InteropServices;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.FFmpeg;
@@ -1032,7 +1031,7 @@ public class MovieFolderScannerTests
return new MovieFolderScanner(
_scannerProxy,
fileSystem,
new LocalFileSystem(fileSystem, Substitute.For<IClient>(), Substitute.For<ILogger<LocalFileSystem>>()),
new LocalFileSystem(fileSystem, Substitute.For<ILogger<LocalFileSystem>>()),
_movieRepository,
_localStatisticsProvider,
Substitute.For<ILocalSubtitlesProvider>(),
@@ -1044,7 +1043,6 @@ public class MovieFolderScannerTests
_mediaItemRepository,
Substitute.For<IFFmpegPngService>(),
Substitute.For<ITempFilePool>(),
Substitute.For<IClient>(),
Logger);
}
@@ -1060,7 +1058,7 @@ public class MovieFolderScannerTests
return new MovieFolderScanner(
_scannerProxy,
fileSystem,
new LocalFileSystem(fileSystem, Substitute.For<IClient>(), Substitute.For<ILogger<LocalFileSystem>>()),
new LocalFileSystem(fileSystem, Substitute.For<ILogger<LocalFileSystem>>()),
_movieRepository,
_localStatisticsProvider,
Substitute.For<ILocalSubtitlesProvider>(),
@@ -1072,7 +1070,6 @@ public class MovieFolderScannerTests
_mediaItemRepository,
Substitute.For<IFFmpegPngService>(),
Substitute.For<ITempFilePool>(),
Substitute.For<IClient>(),
Logger);
}
}

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Serilog;
using Shouldly;
@@ -17,7 +15,6 @@ public class ArtistNfoReaderTests
[SetUp]
public void SetUp() => _artistNfoReader = new ArtistNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
_logger);
private readonly ILogger<ArtistNfoReader> _logger;

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Serilog;
using Shouldly;
@@ -17,7 +15,6 @@ public class EpisodeNfoReaderTests
[SetUp]
public void SetUp() => _episodeNfoReader = new EpisodeNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
_logger);
private readonly ILogger<EpisodeNfoReader> _logger;

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
@@ -16,7 +14,6 @@ public class MovieNfoReaderTests
[SetUp]
public void SetUp() => _movieNfoReader = new MovieNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
new NullLogger<MovieNfoReader>());
private MovieNfoReader _movieNfoReader;

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
@@ -16,7 +14,6 @@ public class MusicVideoNfoReaderTests
[SetUp]
public void SetUp() => _musicVideoNfoReader = new MusicVideoNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
new NullLogger<MusicVideoNfoReader>());
private MusicVideoNfoReader _musicVideoNfoReader;

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
@@ -16,7 +14,6 @@ public class OtherVideoNfoReaderTests
[SetUp]
public void SetUp() => _otherVideoNfoReader = new OtherVideoNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
new NullLogger<OtherVideoNfoReader>());
private OtherVideoNfoReader _otherVideoNfoReader;

View File

@@ -1,10 +1,8 @@
using System.Text;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Scanner.Core.Metadata.Nfo;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.IO;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
@@ -16,7 +14,6 @@ public class ShowNfoReaderTests
[SetUp]
public void SetUp() => _showNfoReader = new ShowNfoReader(
new RecyclableMemoryStreamManager(),
Substitute.For<IClient>(),
new NullLogger<ShowNfoReader>());
private ShowNfoReader _showNfoReader;

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -19,7 +18,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class ImageFolderScanner : LocalFolderScanner, IImageFolderScanner
{
private readonly IClient _client;
private readonly IImageRepository _imageRepository;
private readonly ILibraryRepository _libraryRepository;
private readonly IScannerProxy _scannerProxy;
@@ -42,7 +40,6 @@ public class ImageFolderScanner : LocalFolderScanner, IImageFolderScanner
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<ImageFolderScanner> logger) : base(
fileSystem,
localStatisticsProvider,
@@ -51,7 +48,6 @@ public class ImageFolderScanner : LocalFolderScanner, IImageFolderScanner
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -61,7 +57,6 @@ public class ImageFolderScanner : LocalFolderScanner, IImageFolderScanner
_imageRepository = imageRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -310,7 +305,6 @@ public class ImageFolderScanner : LocalFolderScanner, IImageFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using CliWrap;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
@@ -55,7 +54,6 @@ public abstract class LocalFolderScanner
"yml"
}.ToImmutableHashSet(StringComparer.OrdinalIgnoreCase);
private readonly IClient _client;
private readonly IFFmpegPngService _ffmpegPngService;
private readonly IImageCache _imageCache;
@@ -75,7 +73,6 @@ public abstract class LocalFolderScanner
IImageCache imageCache,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger logger)
{
_fileSystem = fileSystem;
@@ -85,7 +82,6 @@ public abstract class LocalFolderScanner
_imageCache = imageCache;
_ffmpegPngService = ffmpegPngService;
_tempFilePool = tempFilePool;
_client = client;
_logger = logger;
}
@@ -129,7 +125,6 @@ public abstract class LocalFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.Message);
}
}
@@ -278,7 +273,6 @@ public abstract class LocalFolderScanner
catch (Exception ex)
{
_logger.LogWarning(ex, "Error refreshing artwork");
_client.Notify(ex);
}
}
@@ -304,7 +298,6 @@ public abstract class LocalFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Extensions;
@@ -19,7 +18,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
{
private readonly IArtistNfoReader _artistNfoReader;
private readonly IArtistRepository _artistRepository;
private readonly IClient _client;
private readonly IEpisodeNfoReader _episodeNfoReader;
private readonly IFallbackMetadataProvider _fallbackMetadataProvider;
private readonly IFileSystem _fileSystem;
@@ -57,7 +55,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
IShowNfoReader showNfoReader,
IOtherVideoNfoReader otherVideoNfoReader,
ILocalStatisticsProvider localStatisticsProvider,
IClient client,
ILogger<LocalMetadataProvider> logger)
{
_metadataRepository = metadataRepository;
@@ -78,7 +75,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
_showNfoReader = showNfoReader;
_otherVideoNfoReader = otherVideoNfoReader;
_localStatisticsProvider = localStatisticsProvider;
_client = client;
_logger = logger;
}
@@ -345,7 +341,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read music video nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
return None;
}
}
@@ -430,7 +425,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read embedded song metadata from {Path}", path);
_client.Notify(ex);
return None;
}
}
@@ -498,7 +492,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read embedded song metadata from {Path}", path);
_client.Notify(ex);
return None;
}
}
@@ -554,7 +547,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read embedded remote stream metadata from {Path}", path);
_client.Notify(ex);
return None;
}
}
@@ -1327,7 +1319,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read TV show nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
return None;
}
}
@@ -1367,7 +1358,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read artist nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
return None;
}
}
@@ -1422,7 +1412,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read TV episode nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
return _fallbackMetadataProvider.GetFallbackMetadata(episode);
}
}
@@ -1509,7 +1498,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read Movie nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
return _fallbackMetadataProvider.GetFallbackMetadata(movie);
}
}
@@ -1583,7 +1571,6 @@ public class LocalMetadataProvider : ILocalMetadataProvider
catch (Exception ex)
{
_logger.LogInformation(ex, "Failed to read OtherVideo nfo metadata from {Path}", nfoFileName);
_client.Notify(ex);
}
return None;

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -20,7 +19,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
{
private readonly IClient _client;
private readonly ILibraryRepository _libraryRepository;
private readonly ILocalChaptersProvider _localChaptersProvider;
private readonly IScannerProxy _scannerProxy;
@@ -48,7 +46,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<MovieFolderScanner> logger)
: base(
fileSystem,
@@ -58,7 +55,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -71,7 +67,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
_metadataRepository = metadataRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -301,7 +296,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -332,7 +326,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -348,7 +341,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -364,7 +356,6 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -20,7 +19,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScanner
{
private readonly IArtistRepository _artistRepository;
private readonly IClient _client;
private readonly ILibraryRepository _libraryRepository;
private readonly ILocalChaptersProvider _localChaptersProvider;
private readonly IMetadataRepository _metadataRepository;
@@ -49,7 +47,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<MusicVideoFolderScanner> logger) : base(
fileSystem,
localStatisticsProvider,
@@ -58,7 +55,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -72,7 +68,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
_musicVideoRepository = musicVideoRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -267,7 +262,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -299,7 +293,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -467,7 +460,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -525,7 +517,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -541,7 +532,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -557,7 +547,6 @@ public class MusicVideoFolderScanner : LocalFolderScanner, IMusicVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class ArtistNfoReader : NfoReader<ArtistNfo>, IArtistNfoReader
{
private readonly IClient _client;
private readonly ILogger<ArtistNfoReader> _logger;
public ArtistNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<ArtistNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -112,7 +108,6 @@ public class ArtistNfoReader : NfoReader<ArtistNfo>, IArtistNfoReader
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class EpisodeNfoReader : NfoReader<EpisodeNfo>, IEpisodeNfoReader
{
private readonly IClient _client;
private readonly ILogger<EpisodeNfoReader> _logger;
public EpisodeNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<EpisodeNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -147,7 +143,6 @@ public class EpisodeNfoReader : NfoReader<EpisodeNfo>, IEpisodeNfoReader
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class MovieNfoReader : NfoReader<MovieNfo>, IMovieNfoReader
{
private readonly IClient _client;
private readonly ILogger<MovieNfoReader> _logger;
public MovieNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<MovieNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -159,7 +155,6 @@ public class MovieNfoReader : NfoReader<MovieNfo>, IMovieNfoReader
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class MusicVideoNfoReader : NfoReader<MusicVideoNfo>, IMusicVideoNfoReader
{
private readonly IClient _client;
private readonly ILogger<MusicVideoNfoReader> _logger;
public MusicVideoNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<MusicVideoNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -147,7 +143,6 @@ public class MusicVideoNfoReader : NfoReader<MusicVideoNfo>, IMusicVideoNfoReade
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class OtherVideoNfoReader : NfoReader<OtherVideoNfo>, IOtherVideoNfoReader
{
private readonly IClient _client;
private readonly ILogger<OtherVideoNfoReader> _logger;
public OtherVideoNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<OtherVideoNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -159,7 +155,6 @@ public class OtherVideoNfoReader : NfoReader<OtherVideoNfo>, IOtherVideoNfoReade
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,5 +1,4 @@
using System.Xml;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Errors;
using ErsatzTV.Scanner.Core.Interfaces.Metadata.Nfo;
@@ -10,16 +9,13 @@ namespace ErsatzTV.Scanner.Core.Metadata.Nfo;
public class ShowNfoReader : NfoReader<ShowNfo>, IShowNfoReader
{
private readonly IClient _client;
private readonly ILogger<ShowNfoReader> _logger;
public ShowNfoReader(
RecyclableMemoryStreamManager recyclableMemoryStreamManager,
IClient client,
ILogger<ShowNfoReader> logger)
: base(recyclableMemoryStreamManager, logger)
{
_client = client;
_logger = logger;
}
@@ -140,7 +136,6 @@ public class ShowNfoReader : NfoReader<ShowNfo>, IShowNfoReader
}
catch (Exception ex)
{
_client.Notify(ex);
return new FailedToReadNfo(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -19,7 +18,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScanner
{
private readonly IClient _client;
private readonly ILibraryRepository _libraryRepository;
private readonly ILocalChaptersProvider _localChaptersProvider;
private readonly IMetadataRepository _metadataRepository;
@@ -47,7 +45,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<OtherVideoFolderScanner> logger) : base(
fileSystem,
localStatisticsProvider,
@@ -56,7 +53,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -69,7 +65,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
_otherVideoRepository = otherVideoRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -316,7 +311,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -332,7 +326,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -348,7 +341,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -379,7 +371,6 @@ public class OtherVideoFolderScanner : LocalFolderScanner, IOtherVideoFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -22,7 +21,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolderScanner
{
private readonly IClient _client;
private readonly ILibraryRepository _libraryRepository;
private readonly IScannerProxy _scannerProxy;
private readonly IFileSystem _fileSystem;
@@ -46,7 +44,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<RemoteStreamFolderScanner> logger) : base(
fileSystem,
localStatisticsProvider,
@@ -55,7 +52,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -66,7 +62,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
_remoteStreamRepository = remoteStreamRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -337,7 +332,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -375,7 +369,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -406,7 +399,6 @@ public class RemoteStreamFolderScanner : LocalFolderScanner, IRemoteStreamFolder
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -19,7 +18,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
{
private readonly IClient _client;
private readonly ILibraryRepository _libraryRepository;
private readonly IScannerProxy _scannerProxy;
private readonly IFileSystem _fileSystem;
@@ -43,7 +41,6 @@ public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
ILogger<SongFolderScanner> logger) : base(
fileSystem,
localStatisticsProvider,
@@ -52,7 +49,6 @@ public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -63,7 +59,6 @@ public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
_songRepository = songRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_logger = logger;
}
@@ -278,7 +273,6 @@ public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -332,7 +326,6 @@ public class SongFolderScanner : LocalFolderScanner, ISongFolderScanner
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using System.IO.Abstractions;
using Bugsnag;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
@@ -19,7 +18,6 @@ namespace ErsatzTV.Scanner.Core.Metadata;
public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScanner
{
private readonly IClient _client;
private readonly IFallbackMetadataProvider _fallbackMetadataProvider;
private readonly ILibraryRepository _libraryRepository;
private readonly ILocalChaptersProvider _localChaptersProvider;
@@ -48,7 +46,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
IMediaItemRepository mediaItemRepository,
IFFmpegPngService ffmpegPngService,
ITempFilePool tempFilePool,
IClient client,
IFallbackMetadataProvider fallbackMetadataProvider,
ILogger<TelevisionFolderScanner> logger) : base(
fileSystem,
@@ -58,7 +55,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
imageCache,
ffmpegPngService,
tempFilePool,
client,
logger)
{
_scannerProxy = scannerProxy;
@@ -71,7 +67,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
_metadataRepository = metadataRepository;
_libraryRepository = libraryRepository;
_mediaItemRepository = mediaItemRepository;
_client = client;
_fallbackMetadataProvider = fallbackMetadataProvider;
_logger = logger;
}
@@ -407,7 +402,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -483,7 +477,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -515,7 +508,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -545,7 +537,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -578,7 +569,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -592,7 +582,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}
@@ -606,7 +595,6 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan
}
catch (Exception ex)
{
_client.Notify(ex);
return BaseError.New(ex.ToString());
}
}

View File

@@ -1,6 +1,4 @@
using System.IO.Abstractions;
using Bugsnag;
using Bugsnag.Payload;
using Dapper;
using ErsatzTV.Core;
using ErsatzTV.Core.Emby;
@@ -51,7 +49,6 @@ using Serilog.Events;
using Serilog.Formatting.Compact;
using Testably.Abstractions;
using Exception = System.Exception;
using IConfiguration = Bugsnag.IConfiguration;
namespace ErsatzTV.Scanner;
@@ -254,8 +251,6 @@ public class Program
services.AddSingleton<SearchQueryParser>();
services.AddSingleton<ISearchIndex, LuceneSearchIndex>();
services.AddSingleton<RecyclableMemoryStreamManager>();
// TODO: real bugsnag?
services.AddSingleton<IClient>(_ => new BugsnagNoopClient());
services.AddSingleton<IScannerProxy, ScannerProxy>();
services.AddSingleton<ILanguageCodeCache, LanguageCodeCache>();
@@ -271,43 +266,4 @@ public class Program
})
.UseSerilog();
}
private class BugsnagNoopClient : IClient
{
public void Notify(Exception exception)
{
}
public void Notify(Exception exception, Middleware callback)
{
}
public void Notify(Exception exception, Severity severity)
{
}
public void Notify(Exception exception, Severity severity, Middleware callback)
{
}
public void Notify(Exception exception, HandledState handledState)
{
}
public void Notify(Exception exception, HandledState handledState, Middleware callback)
{
}
public void Notify(Report report, Middleware callback)
{
}
public void BeforeNotify(Middleware middleware)
{
}
public IBreadcrumbs Breadcrumbs => new Breadcrumbs(Configuration);
public ISessionTracker SessionTracking => new SessionTracker(Configuration);
public IConfiguration Configuration => new Configuration();
}
}

View File

@@ -32,7 +32,6 @@
<!-- <PackageReference Include="EntityFrameworkProfiler.Appender" Version="6.0.6049" /> -->
<PackageReference Include="Blazored.FluentValidation" Version="2.2.0" />
<PackageReference Include="BlazorSortable" Version="5.2.1" />
<PackageReference Include="Bugsnag.AspNet.Core" Version="4.1.0" />
<PackageReference Include="Chronic.Core" Version="0.4.0" />
<PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" />

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Emby;
using ErsatzTV.Core;
@@ -71,19 +70,6 @@ public class EmbyService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to process Emby background service request");
try
{
using (IServiceScope scope = _serviceScopeFactory.CreateScope())
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Streaming;
using ErsatzTV.Application.Troubleshooting;
@@ -61,16 +60,6 @@ public class FFmpegWorkerService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to handle ffmpeg worker request");
try
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Jellyfin;
using ErsatzTV.Core;
@@ -71,19 +70,6 @@ public class JellyfinService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to process Jellyfin background service request");
try
{
using (IServiceScope scope = _serviceScopeFactory.CreateScope())
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Plex;
using ErsatzTV.Core;
@@ -74,19 +73,6 @@ public class PlexService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to process plex background service request");
try
{
using (IServiceScope scope = _serviceScopeFactory.CreateScope())
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Emby;
using ErsatzTV.Application.Jellyfin;
@@ -90,17 +89,6 @@ public class ScannerService : BackgroundService
catch (Exception ex) when (ex is not (TaskCanceledException or OperationCanceledException))
{
_logger.LogWarning(ex, "Failed to process scanner background service request");
try
{
using IServiceScope scope = _serviceScopeFactory.CreateScope();
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,6 +1,5 @@
using System.Globalization;
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Channels;
using ErsatzTV.Application.Emby;
@@ -143,19 +142,6 @@ public class SchedulerService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Error during scheduler run");
try
{
using (IServiceScope scope = _serviceScopeFactory.CreateScope())
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
}
catch (Exception)
{
// do nothing
}
}
}
@@ -190,19 +176,6 @@ public class SchedulerService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Error during scheduler run");
try
{
using (IServiceScope scope = _serviceScopeFactory.CreateScope())
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
}
catch (Exception)
{
// do nothing
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Search;
using ErsatzTV.Core;
@@ -157,16 +156,6 @@ public class SearchIndexService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to handle search index batch worker request");
try
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Threading.Channels;
using Bugsnag;
using ErsatzTV.Application;
using ErsatzTV.Application.Channels;
using ErsatzTV.Application.FFmpeg;
@@ -137,16 +136,6 @@ public class WorkerService : BackgroundService
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to process background service request");
try
{
IClient client = scope.ServiceProvider.GetRequiredService<IClient>();
client.Notify(ex);
}
catch (Exception)
{
// do nothing
}
}
}
}

View File

@@ -7,7 +7,6 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Channels;
using BlazorSortable;
using Bugsnag.AspNet.Core;
using Dapper;
using ErsatzTV.Application;
using ErsatzTV.Application.Channels;
@@ -132,25 +131,6 @@ public class Startup
options.KnownProxies.Clear();
});
services.AddBugsnag(configuration =>
{
configuration.ApiKey = bugsnagConfig.ApiKey;
configuration.ProjectNamespaces = new[] { "ErsatzTV" };
configuration.AppVersion = Assembly.GetEntryAssembly()
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion ?? "unknown";
configuration.AutoNotify = true;
configuration.NotifyReleaseStages = new[] { "public", "develop" };
#if DEBUG || DEBUG_NO_SYNC
configuration.ReleaseStage = "develop";
#else
// effectively "disable" by tweaking app config
configuration.ReleaseStage = bugsnagConfig.Enable ? "public" : "private";
#endif
});
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(FileSystemLayout.DataProtectionFolder));
services.AddOpenApi("v1", options => { options.ShouldInclude += a => a.GroupName == "general"; });
@@ -774,7 +754,6 @@ public class Startup
services.AddScoped<IFileNotFoundHealthCheck, FileNotFoundHealthCheck>();
services.AddScoped<IUnavailableHealthCheck, UnavailableHealthCheck>();
services.AddScoped<IVaapiDriverHealthCheck, VaapiDriverHealthCheck>();
services.AddScoped<IErrorReportsHealthCheck, ErrorReportsHealthCheck>();
services.AddScoped<IUnifiedDockerHealthCheck, UnifiedDockerHealthCheck>();
services.AddScoped<IDowngradeHealthCheck, DowngradeHealthCheck>();
services.AddScoped<IEmptyScheduleHealthCheck, EmptyScheduleHealthCheck>();

View File

@@ -15,12 +15,5 @@
"WithThreadId"
]
},
"AllowedHosts": "*",
"Trakt": {
"ClientId": "e30585c7db49eaf1bd80d7ce5296d5de0bb33e1166f323cd7202412a605c609a"
},
"Bugsnag": {
"ApiKey": "f59f3cc93cce91210a5c0f047eb2047c",
"Enable": true
}
"AllowedHosts": "*"
}

98
docs/channels.md Normal file
View File

@@ -0,0 +1,98 @@
# Channel Architecture
## Channel Entity
Defined in `ErsatzTV.Core/Domain/Channel.cs`. Key fields:
- **Identity**: `Number` (e.g., "1", "2.1"), `Name`, `UniqueId` (GUID for M3U/XMLTV)
- **Encoding**: `FFmpegProfileId` — video/audio codec, bitrate, resolution, hardware acceleration
- **Streaming**: `StreamingMode` (TransportStream, HLS Direct, HLS Segmenter, TS Hybrid)
- **Behavior**: `PlayoutMode` (Continuous vs OnDemand), `IdleBehavior` (StopOnDisconnect vs KeepRunning)
- **Visual**: `WatermarkId`, `FallbackFillerId`, artwork (logos)
- **Mirroring**: `PlayoutSource` (Generated vs Mirror) — a mirror channel copies another with optional time offset
- **Display**: `Group`, `Categories`, `ShowInEpg`, `IsEnabled`
- **Audio/Subtitle defaults**: preferred language codes, subtitle mode
## Content Sources
Channels get content through a **Playout****ProgramSchedule****ProgramScheduleItem** chain.
### Collection Types
| Type | Description |
|------|-------------|
| `Collection` | Manual grouping of media items with custom playback order |
| `MultiCollection` | Aggregate of collections + smart collections |
| `SmartCollection` | Query-based (Lucene.Net) dynamic filtering |
| `Playlist` | Ordered items with per-item config (count, fillers, playback order) |
| `TelevisionShow` / `TelevisionSeason` | Structured TV hierarchy |
| `Movie`, `Episode`, `MusicVideo`, `OtherVideo`, `Song`, `Image` | Individual media items |
| `RerunCollection` | Wraps any collection with separate first-run/rerun playback orders |
| `SearchQuery` | Dynamic results from a search |
| `RemoteStream` | External stream URLs |
### Media Sources
Media items are imported from configured libraries (Jellyfin, Plex, Emby, or local filesystem). Each source type has its own entity variants (e.g., `JellyfinMovie`, `PlexEpisode`).
## Scheduling
### Schedule Kinds
- **Classic**: Traditional ProgramSchedule with items — the most common
- **Block**: Template-based block scheduling
- **Sequential**: Strict sequential ordering
- **Scripted**: External script-driven playout
- **ExternalJson**: Playout defined by external JSON file
### Schedule Item Types
Each `ProgramScheduleItem` is one of four concrete types:
1. **One** — Play exactly 1 item per cycle
2. **Multiple** — Play N items (fixed count, collection size, or playlist item size)
3. **Duration** — Fill a time window (with tail mode: none, offline, slate, or filler)
4. **Flood** — Play items continuously until the next fixed-start item
Items can have `StartType` of Fixed (anchored to clock time) or Dynamic (follows previous item).
### Playback Orders
`Chronological`, `Random`, `Shuffle`, `ShuffleInOrder`, `MultiEpisodeShuffle`, `SeasonEpisode`, `RandomRotation`, `Marathon` (group by show/season/artist/album/director).
### Filler System
`FillerPreset` defines content to fill gaps. Each schedule item can have:
- **PreRoll** — before main content
- **MidRoll** — during (chapter breaks)
- **PostRoll** — after main content
- **Tail** — pad remaining time in a duration block
- **Fallback** — channel-level default when nothing else available
Filler modes: Duration, Count, Pad (to nearest minute), RandomCount.
### Alternate Schedules
`ProgramScheduleAlternate` overrides the main schedule for specific days of week, days of month, months of year, or date ranges. Useful for seasonal programming or weekend variations.
## Playout Pipeline
```
Channel
└── Playout
├── ProgramSchedule
│ └── ProgramScheduleItems (One|Multiple|Duration|Flood)
│ └── Content source (Collection, Playlist, SmartCollection, etc.)
├── PlayoutItems (generated — the actual timeline)
│ └── MediaItem + start/finish times + filler kind + watermarks
├── PlayoutGaps (time periods with no content)
└── ProgramScheduleAlternates (day/date overrides)
```
The scheduling engine (`ErsatzTV.Core/Scheduling/`) resolves schedule items into concrete `PlayoutItem` entries with precise start/finish times. Each `PlayoutItem` references a specific `MediaItem` and includes trim points (`InPoint`/`OutPoint`), filler classification, and per-item audio/subtitle overrides.
## Watermarks
`ChannelWatermark` supports modes: Permanent, Intermittent, OpacityExpression. Image sources: custom upload, channel logo, or built-in resource. Positioned with percentage-based margins and z-index.
Note: `ChannelLogoGenerator.GenerateChannelLogoUrl()` hardcodes `localhost` for watermark logo fetching — see issue #1 for details.

58
docs/ci-cd.md Normal file
View File

@@ -0,0 +1,58 @@
# CI/CD Details for ErsatzTV Fork
## Upstream GitHub Actions (to adapt for Gitea)
### Workflows
| File | Trigger | Purpose |
|------|---------|---------|
| `ci.yml` | Push to main | Version calc → docker.yml + artifacts.yml |
| `release.yml` | GitHub Release | Same but with release version tags |
| `docker.yml` | Reusable workflow | Multi-arch Docker build+push (amd64, arm32v7, arm64) |
| `artifacts.yml` | Reusable workflow | Platform binaries (macOS DMG, Windows exe, Linux) |
| `pr.yml` | Pull request | Build+test on Linux, Windows, Mac |
### What to keep for Gitea fork
- **Docker build**: Simplify to amd64-only (jazz is x86_64), push to Gitea registry or local registry
- **PR checks**: Build + test on Linux only (single runner on jazz)
- **Drop**: macOS/Windows artifacts, code signing, multi-arch, GHCR/DockerHub push
### Build Steps (from pr.yml — the test workflow)
```bash
dotnet restore
sed -i '/Scanner/d' ErsatzTV/ErsatzTV.csproj # strip Scanner project ref
dotnet build --configuration Release --no-restore
dotnet test --blame-hang-timeout "2m" --no-restore --verbosity normal
```
### Docker Build (from docker.yml)
- Uses `docker/build-push-action@v5`
- Dockerfile: `docker/Dockerfile` (amd64), `docker/arm32v7/Dockerfile`, `docker/arm64/Dockerfile`
- Build arg: `INFO_VERSION` for version stamp
- Base image: `ghcr.io/ersatztv/ersatztv-ffmpeg:7.1.1` (custom ffmpeg)
- Needs Java in build stage (OpenAPI generator)
- Multi-stage: ffmpeg base → .NET runtime → build → final
### Image References to Update
- `jasongdove/ersatztv` → fork's registry image name
- `ghcr.io/ersatztv/ersatztv` → Gitea registry or local registry
- `ghcr.io/ersatztv/ersatztv-ffmpeg:7.1.1` — still needed as base; could mirror locally
### Gitea Actions Compatibility Notes
- Gitea Actions is GitHub Actions compatible but some actions need replacements
- `actions/checkout@v4` → works in Gitea Actions
- `actions/setup-dotnet@v4` → works in Gitea Actions
- `docker/login-action@v3` → needs Gitea registry credentials instead
- `docker/build-push-action@v5` → works but target registry changes
- `actions/upload-artifact@v4` / `download-artifact@v4` → works in Gitea Actions
- Reusable workflows (`workflow_call`) → supported in Gitea Actions
### Container Registry Options (from server-management#172)
1. **Gitea built-in** (Packages feature) — images at `192.168.1.95:3000/timothy/<package>`, needs HTTPS or `--insecure-registry`
2. **Local Docker registry**`registry:2` on jazz at port 5000
### Runner Setup (from server-management#172)
- `gitea/act_runner:latest` container on jazz
- Needs Docker socket for DinD builds
- Register via Gitea Admin → Runners → token
- Labels: `ubuntu-latest`, `docker`
- jazz has 128GB RAM, plenty for .NET builds (2-4GB)

68
docs/fork-strategy.md Normal file
View File

@@ -0,0 +1,68 @@
# Fork Maintenance Strategy
Upstream ErsatzTV was archived February 2026 at v26.3.0. This fork is maintained independently on [Gitea](http://192.168.1.95:3000/timothy/ersatztv).
## Divergence Policy
We diverge freely from upstream's final state. There is no upstream to merge from, so maintaining merge compatibility serves no purpose. All changes are our own.
## Security & Dependency Updates
### .NET Runtime
- **Current**: .NET 10.0 (LTS candidate, supported through Nov 2028)
- **Upgrade path**: When .NET 11 ships (Nov 2026), upgrade by updating `TargetFramework` across all projects and `global.json`. The `rollForward: latestMinor` setting in `global.json` handles patch versions automatically.
- **Key constraint**: EF Core is pinned to `[9.0.12,10)` — a .NET 11 upgrade will likely require bumping to EF Core 10.x simultaneously.
### NuGet Packages
- No central package management (`Directory.Packages.props`) — versions are declared per-project. This means bulk updates require editing multiple .csproj files.
- Upstream had a GitHub Dependabot config (`.github/dependabot.yml`) that is not active on Gitea.
- **Current approach**: Manual periodic audits. Run `dotnet list package --outdated` to check for updates.
- **Future consideration**: Add a Gitea Actions workflow for dependency scanning, or adopt `Directory.Packages.props` to centralize version management.
### Docker Base Images
- .NET SDK/runtime images (`mcr.microsoft.com/dotnet/sdk:10.0-noble-amd64`) — update when .NET patches ship.
- FFmpeg image: forked separately at [timothy/ersatztv-ffmpeg](http://192.168.1.95:3000/timothy/ersatztv-ffmpeg). Currently `192.168.1.95:3000/timothy/ersatztv-ffmpeg:7.1.1`. The main Dockerfile still references the upstream `ghcr.io` image and needs updating.
### CVE Response
1. Check if the CVE affects a dependency we use (most NuGet advisories are noise)
2. Update the package version in the relevant .csproj file(s)
3. Build, run tests, deploy to test environment (port 8410)
4. Promote to prod after verification
## EF Core Migrations
- **SQLite**: 196 migrations (primary, Feb 2021 Feb 2026)
- **MySQL**: 153 migrations (secondary, Aug 2023 Feb 2026, parity maintained)
### Adding New Migrations
```bash
# SQLite (primary)
dotnet ef migrations add MigrationName \
--project ErsatzTV.Infrastructure.Sqlite \
--startup-project ErsatzTV
# MySQL (if maintaining parity)
dotnet ef migrations add MigrationName \
--project ErsatzTV.Infrastructure.MySql \
--startup-project ErsatzTV
```
We only use SQLite in the homelab. MySQL migrations can be maintained for completeness but are not tested in deployment.
## Feature Development
New features follow the existing CQRS/MediatR pattern. No compatibility constraints — we own the entire codebase now. Track work via [Gitea Issues](http://192.168.1.95:3000/timothy/ersatztv/issues).
## Key Risks
| Risk | Mitigation |
|------|------------|
| EF Core major version gap | Pin to `[9.x,10)` range; bump when .NET upgrade forces it |
| Lucene.Net stuck on beta (`4.8.0-beta00017`) | Monitor for stable release; functional as-is |
| SkiaSharp native deps | Pinned with `NativeAssets.Linux.NoDependencies`; test on Linux after updates |
| OpenAPI generator JAR (`7.15.0`) | Hardcoded in Dockerfile; update manually when needed |

96
docs/m3u-xmltv.md Normal file
View File

@@ -0,0 +1,96 @@
# M3U/XMLTV Integration
## Overview
ErsatzTV serves M3U playlists and XMLTV guide data via HTTP endpoints. Jellyfin consumes these as an IPTV tuner source.
## Endpoints
| Route | Purpose |
|-------|---------|
| `GET /iptv/channels.m3u` | M3U playlist (channel list + stream URLs) |
| `GET /iptv/xmltv.xml` | XMLTV guide (EPG data) |
| `GET /iptv/logos/{fileName}.jpg` | Uploaded channel logos |
| `GET /iptv/logos/gen?text={name}` | Generated text logos (SkiaSharp, 200x100 PNG) |
| `GET /iptv/channel/{number}.ts` | Transport stream |
| `GET /iptv/channel/{number}.m3u8` | HLS stream |
All defined in `ErsatzTV/Controllers/IptvController.cs` (streams) and `ErsatzTV/Controllers/ArtworkController.cs` (logo generation).
## M3U Generation
**Code**: `ErsatzTV.Core/Iptv/ChannelPlaylist.cs``ToM3U()`
The controller captures `Request.Scheme`, `Request.Host`, and `Request.PathBase` from the incoming HTTP request and passes them through MediatR to the playlist builder. All URLs in the M3U output use the request-derived host — they are **not** hardcoded.
Each channel entry includes:
- `tvg-id` — channel number as identifier
- `tvg-chno` — channel number for ordering
- `tvg-name` — channel display name
- `tvg-logo` — logo URL (uploaded artwork or generated text logo)
- `tvc-stream-vcodec` / `tvc-stream-acodec` — codec hints from FFmpeg profile
- `CUID` — base64-encoded UniqueId
- `group-title` — channel group for categorization
- Stream URL (format depends on channel's streaming mode)
The XMLTV guide URL is included as an `#EXTM3U` header attribute.
## XMLTV Generation
**Code**: `ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs`
XMLTV data is pre-generated from Scriban templates (`ErsatzTV/Resources/Templates/_channel.sbntxt`) and cached as XML fragments. At request time, the handler:
1. Reads cached fragments from disk
2. Substitutes `{RequestBase}` with the actual `scheme://host/base` from the request
3. Substitutes `{AccessTokenUri}` with version + optional auth token
4. Filters channels by `ShowInEpg`
5. Combines channel list + program entries into the final XML
## Jellyfin Integration
### Tuner Setup
In Jellyfin, add an IPTV tuner pointing to:
```
http://ersatztv:8409/iptv/channels.m3u
```
Jellyfin reads the M3U to discover channels and their stream URLs. The `Host` header in Jellyfin's request determines what host appears in all embedded URLs — so the hostname used in the tuner URL matters.
### Guide Data
Jellyfin fetches the XMLTV URL embedded in the M3U header for EPG data. This provides program titles, descriptions, and timing for the TV guide.
### Guide Refresh
Jellyfin periodically refreshes the guide data. Channel logos are fetched from the `tvg-logo` URLs in the M3U. If those URLs are unreachable from Jellyfin's network context, logos break.
## Logo URL Issue (Gitea #1)
### The Problem
Channel logos break after Jellyfin guide refreshes. The issue was originally reported as hardcoded `localhost` in `tvg-logo` URLs.
### Investigation Findings
The M3U and XMLTV generation paths **correctly** use request-derived host:
- `ChannelPlaylist.ToM3U()` builds logo URLs from `_scheme`, `_host`, `_baseUrl` (all from the request)
- `GetChannelGuideHandler` substitutes `{RequestBase}` at request time
The **actual** hardcoded `localhost` is in `ChannelLogoGenerator.GenerateChannelLogoUrl()` (`ErsatzTV.Core/Images/ChannelLogoGenerator.cs`, line 82):
```csharp
$"http://localhost:{Settings.StreamingPort}{GetRoute}?{GetRouteQueryParamName}={channel.WebEncodedName}"
```
This method is called only by `WatermarkSelector.cs` (lines 219, 268, 317, 385) — for watermark overlays during transcoding, **not** for M3U/XMLTV output. Since FFmpeg runs on the same host as ErsatzTV, `localhost` is correct for watermarks.
### Possible Explanations
1. The M3U tuner URL in Jellyfin may use a hostname that doesn't resolve correctly from Jellyfin's container (e.g., `localhost` instead of `ersatztv`)
2. There may be a reverse proxy or Docker network issue stripping/rewriting the Host header
3. The issue may actually be about watermarks appearing with broken logos, not M3U `tvg-logo`
### Current Workaround
A script downloads logos from ErsatzTV and base64-uploads them directly to Jellyfin's `/Items/{id}/Images/Primary` API, bypassing the M3U logo URLs entirely. Documented in `server-management` repo (issue #171).