first commit
🏗️ Build Plugin / call (push) Failing after 0s
📝 Create/Update Release Draft & Release Bump PR / call (push) Failing after 0s
🧪 Test Plugin / call (push) Failing after 0s
🔬 Run CodeQL / call (push) Failing after 0s

This commit is contained in:
2025-11-12 22:05:36 +01:00
parent d544b71939
commit ac6a3842dd
46 changed files with 5891 additions and 499 deletions
@@ -0,0 +1,145 @@
using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.SRFPlay.Configuration;
/// <summary>
/// Business unit options for SRF content.
/// </summary>
public enum BusinessUnit
{
/// <summary>
/// SRF (Swiss Radio and Television - German).
/// </summary>
SRF,
/// <summary>
/// RTS (Radio Télévision Suisse - French).
/// </summary>
RTS,
/// <summary>
/// RSI (Radiotelevisione svizzera - Italian).
/// </summary>
RSI,
/// <summary>
/// RTR (Radiotelevisiun Svizra Rumantscha - Romansh).
/// </summary>
RTR,
/// <summary>
/// SWI (Swiss World International).
/// </summary>
SWI
}
/// <summary>
/// Quality preference for video streams.
/// </summary>
public enum QualityPreference
{
/// <summary>
/// Automatic quality selection.
/// </summary>
Auto,
/// <summary>
/// Standard definition.
/// </summary>
SD,
/// <summary>
/// High definition.
/// </summary>
HD
}
/// <summary>
/// Plugin configuration.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
/// </summary>
public PluginConfiguration()
{
// Set default options
BusinessUnit = BusinessUnit.SRF;
QualityPreference = QualityPreference.Auto;
ContentRefreshIntervalHours = 6;
ExpirationCheckIntervalHours = 24;
CacheDurationMinutes = 60;
EnableLatestContent = true;
EnableTrendingContent = true;
EnableCategoryFolders = true;
EnabledTopics = new System.Collections.Generic.List<string>();
}
/// <summary>
/// Gets or sets the business unit to fetch content from.
/// </summary>
public BusinessUnit BusinessUnit { get; set; }
/// <summary>
/// Gets or sets the preferred video quality.
/// </summary>
public QualityPreference QualityPreference { get; set; }
/// <summary>
/// Gets or sets the content refresh interval in hours.
/// </summary>
public int ContentRefreshIntervalHours { get; set; }
/// <summary>
/// Gets or sets the expiration check interval in hours.
/// </summary>
public int ExpirationCheckIntervalHours { get; set; }
/// <summary>
/// Gets or sets the metadata cache duration in minutes.
/// </summary>
public int CacheDurationMinutes { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable latest content discovery.
/// </summary>
public bool EnableLatestContent { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable trending content discovery.
/// </summary>
public bool EnableTrendingContent { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to use a proxy for API requests.
/// </summary>
public bool UseProxy { get; set; }
/// <summary>
/// Gets or sets the proxy server address (e.g., http://proxy.example.com:8080).
/// </summary>
public string ProxyAddress { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the proxy username (optional).
/// </summary>
public string ProxyUsername { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the proxy password (optional).
/// </summary>
public string ProxyPassword { get; set; } = string.Empty;
/// <summary>
/// Gets or sets a value indicating whether to enable category/topic folders in the channel.
/// </summary>
public bool EnableCategoryFolders { get; set; }
/// <summary>
/// Gets or sets the list of enabled topic IDs. If empty, all topics are shown.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Required for configuration serialization")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "Configuration DTO")]
public System.Collections.Generic.List<string> EnabledTopics { get; set; }
}
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SRF Play</title>
</head>
<body>
<div id="SRFPlayConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<form id="SRFPlayConfigForm">
<div class="selectContainer">
<label class="selectLabel" for="BusinessUnit">Business Unit</label>
<select is="emby-select" id="BusinessUnit" name="BusinessUnit" class="emby-select-withcolor emby-select">
<option id="optSRF" value="SRF">SRF (German)</option>
<option id="optRTS" value="RTS">RTS (French)</option>
<option id="optRSI" value="RSI">RSI (Italian)</option>
<option id="optRTR" value="RTR">RTR (Romansh)</option>
<option id="optSWI" value="SWI">SWI (International)</option>
</select>
<div class="fieldDescription">Select the Swiss broadcasting unit to fetch content from</div>
</div>
<div class="selectContainer">
<label class="selectLabel" for="QualityPreference">Quality Preference</label>
<select is="emby-select" id="QualityPreference" name="QualityPreference" class="emby-select-withcolor emby-select">
<option id="optAuto" value="Auto">Automatic</option>
<option id="optSD" value="SD">Standard Definition</option>
<option id="optHD" value="HD">High Definition</option>
</select>
<div class="fieldDescription">Preferred video quality for playback</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ContentRefreshIntervalHours">Content Refresh Interval (hours)</label>
<input id="ContentRefreshIntervalHours" name="ContentRefreshIntervalHours" type="number" is="emby-input" min="1" max="168" />
<div class="fieldDescription">How often to check for new content (1-168 hours)</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ExpirationCheckIntervalHours">Expiration Check Interval (hours)</label>
<input id="ExpirationCheckIntervalHours" name="ExpirationCheckIntervalHours" type="number" is="emby-input" min="1" max="168" />
<div class="fieldDescription">How often to check for expired content (1-168 hours)</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="CacheDurationMinutes">Cache Duration (minutes)</label>
<input id="CacheDurationMinutes" name="CacheDurationMinutes" type="number" is="emby-input" min="5" max="1440" />
<div class="fieldDescription">How long to cache metadata (5-1440 minutes)</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="EnableLatestContent" name="EnableLatestContent" type="checkbox" is="emby-checkbox" />
<span>Enable Latest Content</span>
</label>
<div class="fieldDescription">Automatically discover and add latest videos</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="EnableTrendingContent" name="EnableTrendingContent" type="checkbox" is="emby-checkbox" />
<span>Enable Trending Content</span>
</label>
<div class="fieldDescription">Automatically discover and add trending videos</div>
</div>
<br />
<h2>Proxy Settings</h2>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="UseProxy" name="UseProxy" type="checkbox" is="emby-checkbox" />
<span>Use Proxy</span>
</label>
<div class="fieldDescription">Route all SRF API requests through a proxy server</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ProxyAddress">Proxy Address</label>
<input id="ProxyAddress" name="ProxyAddress" type="text" is="emby-input" />
<div class="fieldDescription">Proxy server address (e.g., http://proxy.example.com:8080 or socks5://proxy.example.com:1080)</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ProxyUsername">Proxy Username (Optional)</label>
<input id="ProxyUsername" name="ProxyUsername" type="text" is="emby-input" autocomplete="off" />
<div class="fieldDescription">Username for proxy authentication (leave empty if not required)</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="ProxyPassword">Proxy Password (Optional)</label>
<input id="ProxyPassword" name="ProxyPassword" type="password" is="emby-input" autocomplete="off" />
<div class="fieldDescription">Password for proxy authentication (leave empty if not required)</div>
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
<span>Save</span>
</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
var SRFPlayConfig = {
pluginUniqueId: 'a4b12f86-8c3d-4e9a-b7f2-1d5e6c8a9b4f'
};
document.querySelector('#SRFPlayConfigPage')
.addEventListener('pageshow', function() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(SRFPlayConfig.pluginUniqueId).then(function (config) {
document.querySelector('#BusinessUnit').value = config.BusinessUnit;
document.querySelector('#QualityPreference').value = config.QualityPreference;
document.querySelector('#ContentRefreshIntervalHours').value = config.ContentRefreshIntervalHours;
document.querySelector('#ExpirationCheckIntervalHours').value = config.ExpirationCheckIntervalHours;
document.querySelector('#CacheDurationMinutes').value = config.CacheDurationMinutes;
document.querySelector('#EnableLatestContent').checked = config.EnableLatestContent;
document.querySelector('#EnableTrendingContent').checked = config.EnableTrendingContent;
document.querySelector('#UseProxy').checked = config.UseProxy || false;
document.querySelector('#ProxyAddress').value = config.ProxyAddress || '';
document.querySelector('#ProxyUsername').value = config.ProxyUsername || '';
document.querySelector('#ProxyPassword').value = config.ProxyPassword || '';
Dashboard.hideLoadingMsg();
});
});
document.querySelector('#SRFPlayConfigForm')
.addEventListener('submit', function(e) {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(SRFPlayConfig.pluginUniqueId).then(function (config) {
config.BusinessUnit = document.querySelector('#BusinessUnit').value;
config.QualityPreference = document.querySelector('#QualityPreference').value;
config.ContentRefreshIntervalHours = parseInt(document.querySelector('#ContentRefreshIntervalHours').value);
config.ExpirationCheckIntervalHours = parseInt(document.querySelector('#ExpirationCheckIntervalHours').value);
config.CacheDurationMinutes = parseInt(document.querySelector('#CacheDurationMinutes').value);
config.EnableLatestContent = document.querySelector('#EnableLatestContent').checked;
config.EnableTrendingContent = document.querySelector('#EnableTrendingContent').checked;
config.UseProxy = document.querySelector('#UseProxy').checked;
config.ProxyAddress = document.querySelector('#ProxyAddress').value;
config.ProxyUsername = document.querySelector('#ProxyUsername').value;
config.ProxyPassword = document.querySelector('#ProxyPassword').value;
ApiClient.updatePluginConfiguration(SRFPlayConfig.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});
e.preventDefault();
return false;
});
</script>
</div>
</body>
</html>