using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; namespace Jellyfin.LiveTv; /// /// Helpers for keeping Live TV channel icons in sync with guide data. /// internal static class LiveTvChannelImageHelper { /// /// Applies the channel icon from guide or tuner metadata. /// Called on each guide refresh so remote icons are re-downloaded even when the URL is unchanged. /// /// The channel item. /// The local image path from the tuner, if any. /// The remote image URL from the guide provider, if any. /// true when the item image metadata was updated. internal static bool UpdateChannelImageIfNeeded(BaseItem item, string? imagePath, string? imageUrl) { var newImageSource = !string.IsNullOrWhiteSpace(imagePath) ? imagePath : imageUrl; if (string.IsNullOrWhiteSpace(newImageSource)) { return false; } item.SetImagePath(ImageType.Primary, newImageSource); return true; } }