using Jellyfin.Plugin.SRFPlay.Configuration;
using MediaBrowser.Controller.Entities;
namespace Jellyfin.Plugin.SRFPlay.Utilities;
///
/// Extension methods for common plugin operations.
///
public static class Extensions
{
///
/// Gets the SRF URN from the item's provider IDs.
///
/// The base item.
/// The SRF URN, or null if not found or empty.
public static string? GetSrfUrn(this BaseItem item)
{
return item.ProviderIds.TryGetValue("SRF", out var urn) && !string.IsNullOrEmpty(urn)
? urn
: null;
}
///
/// Converts the BusinessUnit enum to its lowercase string representation.
///
/// The business unit.
/// The lowercase string representation.
public static string ToLowerString(this BusinessUnit businessUnit)
{
return businessUnit.ToString().ToLowerInvariant();
}
///
/// Gets the plugin configuration safely, returning null if not available.
///
/// The plugin configuration, or null if not available.
public static PluginConfiguration? GetPluginConfig()
{
return Plugin.Instance?.Configuration;
}
}