the one-line fix: contributing to ErsatzTV
One line. That’s the entirety of Jason’s contribution to ErsatzTV, and it’s still a story worth telling.
ErsatzTV is an open source project - not his, he’s just a user of it - that turns a personal media library into something resembling actual live TV: channels, a program guide, scheduling, the works. It’s the kind of tool that fits naturally into a homelab, and he runs it as part of his.
the bug
At some point, some of his movies stopped showing up when ErsatzTV synced with Emby, his media server. Not all of them - just some. The kind of intermittent, huh-that’s-weird problem that’s easy to shrug off and work around with a rescan.
Instead, he traced it. The issue was in how ErsatzTV’s Emby client decided whether a “movie” item from Emby was actually usable: it checked whether every one of the item’s media sources had a Protocol field equal to exactly “File.” If a movie happened to be served up through anything else, ErsatzTV silently dropped it, as if it didn’t exist at all.
That’s a narrow, brittle check. What actually matters isn’t the transport protocol Emby happens to report - it’s whether the item has any media source at all. So the fix was exactly one line:
- if (item.MediaSources.Any(ms => ms.Protocol != "File")) + if (item.MediaSources is null || item.MediaSources.Count == 0)
Instead of rejecting anything that isn’t strictly “File” protocol, only reject it if there’s genuinely nothing there to play. Small change, correct root cause, no side effects.
why this is worth a post
It’s not a big project. There’s no README, no release history, no version number to point to. But it’s a good example of a habit that shows up everywhere else in this series: don’t patch the symptom, find out why the thing is actually broken, then fix that. Jason didn’t work around the missing movies by reorganizing his library - he found the one wrong assumption in someone else’s code, wrote the smallest possible fix for it, and sent it upstream where the next person hitting the same bug just… wouldn’t.
It got merged. That’s the whole story.