4 Commits
Author SHA1 Message Date
knackebrot d38c1595d8 Update for Jellyfin 10.9 2024-06-22 20:16:55 +02:00
knackebrot 309e7c4110 Merge pull request #13 from tiagoqpinto/jellyfin
Add Transcoding option to settings
2022-08-22 21:42:48 +02:00
Tiago Pinto 09336872ed Add transcoding port setting 2022-08-17 10:59:48 +01:00
Tiago Pinto aff7687078 Add Transcoding option to settings 2022-07-19 15:12:45 +01:00
8 changed files with 174 additions and 64 deletions
+41
View File
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
@@ -23,6 +23,10 @@ namespace Jellyfin.Plugin.Enigma2.Configuration
public string RecordingPath { get; set; } public string RecordingPath { get; set; }
public bool TranscodedStream { get; set; }
public string TranscodingPort { get; set; }
public bool EnableDebugLogging { get; set; } public bool EnableDebugLogging { get; set; }
@@ -44,6 +48,9 @@ namespace Jellyfin.Plugin.Enigma2.Configuration
RecordingPath = ""; RecordingPath = "";
TranscodedStream = false;
TranscodingPort = "8002";
EnableDebugLogging = false; EnableDebugLogging = false;
} }
} }
@@ -127,6 +127,22 @@
</div> </div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input is="emby-checkbox" type="checkbox" id="chkTranscodedStream" />
<span>Request Transcoded Stream</span>
</label>
<div class="fieldDescription checkboxFieldDescription">
Request Transcoded Stream (h264, 720p, 1Mpbs and mp4 as default)
</div>
</div>
<div class="inputContainer">
<input is="emby-input" id="txtTranscodingPort" type="text" label="Enigma2 transcoding port:" />
<div class="fieldDescription">
The Transcoding port of your receiver eg. 8002
</div>
</div>
<label class="checkboxContainer"> <label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="chkDebugLogging" /> <input is="emby-checkbox" type="checkbox" id="chkDebugLogging" />
<span>Enable Enigma2 debug logging</span> <span>Enable Enigma2 debug logging</span>
@@ -163,6 +179,8 @@
document.getElementById('chkFetchPiconsFromWebInterface').checked = config.FetchPiconsFromWebInterface || false; document.getElementById('chkFetchPiconsFromWebInterface').checked = config.FetchPiconsFromWebInterface || false;
document.getElementById('txtPiconsPath').value = config.PiconsPath || ""; document.getElementById('txtPiconsPath').value = config.PiconsPath || "";
document.getElementById('txtRecordingPath').value = config.RecordingPath || ""; document.getElementById('txtRecordingPath').value = config.RecordingPath || "";
document.getElementById('chkTranscodedStream').checked = config.TranscodedStream || false;
document.getElementById('txtTranscodingPort').value = config.TranscodingPort || "";
document.getElementById('chkDebugLogging').checked = config.EnableDebugLogging || false; document.getElementById('chkDebugLogging').checked = config.EnableDebugLogging || false;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
@@ -187,6 +205,8 @@
config.FetchPiconsFromWebInterface = document.getElementById('chkFetchPiconsFromWebInterface').checked; config.FetchPiconsFromWebInterface = document.getElementById('chkFetchPiconsFromWebInterface').checked;
config.PiconsPath = document.getElementById('txtPiconsPath').value; config.PiconsPath = document.getElementById('txtPiconsPath').value;
config.RecordingPath = document.getElementById('txtRecordingPath').value; config.RecordingPath = document.getElementById('txtRecordingPath').value;
config.TranscodedStream = document.getElementById('chkTranscodedStream').checked;
config.TranscodingPort = document.getElementById('txtTranscodingPort').value;
config.EnableDebugLogging = document.getElementById('chkDebugLogging').checked; config.EnableDebugLogging = document.getElementById('chkDebugLogging').checked;
ApiClient.updatePluginConfiguration(Enigma2ConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult); ApiClient.updatePluginConfiguration(Enigma2ConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult);
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<AssemblyVersion>5.0.0.0</AssemblyVersion> <AssemblyVersion>6.0.0.0</AssemblyVersion>
<FileVersion>5.0.0.0</FileVersion> <FileVersion>6.0.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'">
@@ -11,6 +11,10 @@
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Configuration\configPage.html" /> <None Remove="Configuration\configPage.html" />
</ItemGroup> </ItemGroup>
@@ -20,12 +24,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Jellyfin.Common" Version="10.8.0" /> <PackageReference Include="Jellyfin.Common" Version="10.9.0" />
<PackageReference Include="Jellyfin.Naming" Version="10.8.0" /> <PackageReference Include="Jellyfin.Naming" Version="10.9.0" />
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" /> <PackageReference Include="Jellyfin.Controller" Version="10.9.0" />
<PackageReference Include="Jellyfin.Model" Version="10.8.0" /> <PackageReference Include="Jellyfin.Model" Version="10.9.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+66 -49
View File
@@ -35,12 +35,15 @@ namespace Jellyfin.Plugin.Enigma2
public DateTime LastRecordingChange = DateTime.MinValue; public DateTime LastRecordingChange = DateTime.MinValue;
private readonly HttpClient _httpClient; private IHttpClientFactory _httpClientFactory;
public static LiveTvService Instance { get; private set; }
public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory) public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory)
{ {
_logger = logger; _logger = logger;
_httpClient = GetHttpClient(httpClientFactory); _httpClientFactory = httpClientFactory;
Instance = this;
} }
@@ -49,7 +52,7 @@ namespace Jellyfin.Plugin.Enigma2
/// </summary> /// </summary>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
private async Task EnsureConnectionAsync(CancellationToken cancellationToken) public async Task EnsureConnectionAsync(CancellationToken cancellationToken)
{ {
_logger.LogInformation("[Enigma2] Start EnsureConnectionAsync"); _logger.LogInformation("[Enigma2] Start EnsureConnectionAsync");
@@ -101,6 +104,12 @@ namespace Jellyfin.Plugin.Enigma2
throw new InvalidOperationException("Enigma2 Streaming Port must be configured."); throw new InvalidOperationException("Enigma2 Streaming Port must be configured.");
} }
if (config.TranscodedStream && string.IsNullOrEmpty(config.TranscodingPort))
{
_logger.LogError("[Enigma2] Transcoding Port must be configured.");
throw new InvalidOperationException("Enigma2 Transcoding Port must be configured.");
}
if (string.IsNullOrEmpty(config.WebInterfacePort)) if (string.IsNullOrEmpty(config.WebInterfacePort))
{ {
_logger.LogError("[Enigma2] Web Interface Port must be configured."); _logger.LogError("[Enigma2] Web Interface Port must be configured.");
@@ -145,9 +154,9 @@ namespace Jellyfin.Plugin.Enigma2
/// </summary> /// </summary>
/// <param name="httpClientFactory"></param> /// <param name="httpClientFactory"></param>
/// <returns></returns> /// <returns></returns>
private HttpClient GetHttpClient(IHttpClientFactory httpClientFactory) private HttpClient GetHttpClient()
{ {
var httpClient = httpClientFactory.CreateClient(NamedClient.Default); var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
httpClient.DefaultRequestHeaders.UserAgent.Add( httpClient.DefaultRequestHeaders.UserAgent.Add(
new ProductInfoHeaderValue(Name, Plugin.Instance.Version.ToString())); new ProductInfoHeaderValue(Name, Plugin.Instance.Version.ToString()));
@@ -183,7 +192,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/getservices", baseUrl); var url = string.Format("{0}/web/getservices", baseUrl);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] InitiateSession url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] InitiateSession url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -284,7 +293,7 @@ namespace Jellyfin.Plugin.Enigma2
baseUrlPicon = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort; baseUrlPicon = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort;
} }
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -448,7 +457,7 @@ namespace Jellyfin.Plugin.Enigma2
baseUrlPicon = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort; baseUrlPicon = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort;
} }
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -549,10 +558,11 @@ namespace Jellyfin.Plugin.Enigma2
/// Gets the Recordings async /// Gets the Recordings async
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{RecordingInfo}}</returns> /// <returns>Task{IEnumerable{MyRecordingInfo}}</returns>
public async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken) public async Task<IEnumerable<MyRecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken)
{ {
return new List<RecordingInfo>(); await Task.Delay(0); //to avoid await warnings
return new List<MyRecordingInfo>();
} }
public async Task<IEnumerable<MyRecordingInfo>> GetAllRecordingsAsync(CancellationToken cancellationToken) public async Task<IEnumerable<MyRecordingInfo>> GetAllRecordingsAsync(CancellationToken cancellationToken)
@@ -571,7 +581,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/movielist", baseUrl); var url = string.Format("{0}/web/movielist", baseUrl);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetRecordingsAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetRecordingsAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -750,7 +760,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/moviedelete?sRef={1}", baseUrl, recordingId); var url = string.Format("{0}/web/moviedelete?sRef={1}", baseUrl, recordingId);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] DeleteRecordingAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] DeleteRecordingAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -765,7 +775,7 @@ namespace Jellyfin.Plugin.Enigma2
var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult"); var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult");
foreach (XmlNode xmlNode in e2simplexmlresult) foreach (XmlNode xmlNode in e2simplexmlresult)
{ {
var recordingInfo = new RecordingInfo(); var recordingInfo = new MyRecordingInfo();
var e2state = "?"; var e2state = "?";
var e2statetext = "?"; var e2statetext = "?";
@@ -830,7 +840,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/timerdelete?sRef={1}&begin={2}&end={3}", baseUrl, sRef, begin, end); var url = string.Format("{0}/web/timerdelete?sRef={1}&begin={2}&end={3}", baseUrl, sRef, begin, end);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] CancelTimerAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] CancelTimerAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -845,7 +855,7 @@ namespace Jellyfin.Plugin.Enigma2
var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult"); var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult");
foreach (XmlNode xmlNode in e2simplexmlresult) foreach (XmlNode xmlNode in e2simplexmlresult)
{ {
var recordingInfo = new RecordingInfo(); var recordingInfo = new MyRecordingInfo();
var e2state = "?"; var e2state = "?";
var e2statetext = "?"; var e2statetext = "?";
@@ -913,7 +923,7 @@ namespace Jellyfin.Plugin.Enigma2
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] CreateTimerAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] CreateTimerAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -928,7 +938,7 @@ namespace Jellyfin.Plugin.Enigma2
var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult"); var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult");
foreach (XmlNode xmlNode in e2simplexmlresult) foreach (XmlNode xmlNode in e2simplexmlresult)
{ {
var recordingInfo = new RecordingInfo(); var recordingInfo = new MyRecordingInfo();
var e2state = "?"; var e2state = "?";
var e2statetext = "?"; var e2statetext = "?";
@@ -985,7 +995,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/timerlist", baseUrl); var url = string.Format("{0}/web/timerlist", baseUrl);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetTimersAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetTimersAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -1127,7 +1137,14 @@ namespace Jellyfin.Plugin.Enigma2
protocol = "https"; protocol = "https";
} }
var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.StreamingPort; var streamingPort = Plugin.Instance.Configuration.StreamingPort;
if (Plugin.Instance.Configuration.TranscodedStream)
{
streamingPort = Plugin.Instance.Configuration.TranscodingPort;
}
var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + streamingPort;
//check if we need to zap to channel - single tuner //check if we need to zap to channel - single tuner
if (Plugin.Instance.Configuration.ZapToChannel) if (Plugin.Instance.Configuration.ZapToChannel)
@@ -1137,11 +1154,17 @@ namespace Jellyfin.Plugin.Enigma2
if (Plugin.Instance.Configuration.UseLoginForStreams && !string.IsNullOrEmpty(Plugin.Instance.Configuration.WebInterfaceUsername)) if (Plugin.Instance.Configuration.UseLoginForStreams && !string.IsNullOrEmpty(Plugin.Instance.Configuration.WebInterfaceUsername))
{ {
baseUrl = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.StreamingPort; baseUrl = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + streamingPort;
}
var trancodingUrl = "";
if (Plugin.Instance.Configuration.TranscodedStream)
{
trancodingUrl = "?bitrate=1000000?width=1280?height=720?vcodec=h264?aspectratio=2?interlaced=0.mp4";
} }
_liveStreams++; _liveStreams++;
var streamUrl = string.Format("{0}/{1}", baseUrl, channelOid); var streamUrl = string.Format("{0}/{1}{2}", baseUrl, channelOid, trancodingUrl);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetChannelStream url: {0}", streamUrl)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetChannelStream url: {0}", streamUrl));
return new MediaSourceInfo return new MediaSourceInfo
@@ -1195,7 +1218,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/zap?sRef={1}", baseUrl, channelOid); var url = string.Format("{0}/web/zap?sRef={1}", baseUrl, channelOid);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] ZapToChannel url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] ZapToChannel url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -1210,7 +1233,7 @@ namespace Jellyfin.Plugin.Enigma2
var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult"); var e2simplexmlresult = xml.GetElementsByTagName("e2simplexmlresult");
foreach (XmlNode xmlNode in e2simplexmlresult) foreach (XmlNode xmlNode in e2simplexmlresult)
{ {
var recordingInfo = new RecordingInfo(); var recordingInfo = new MyRecordingInfo();
var e2state = "?"; var e2state = "?";
var e2statetext = "?"; var e2statetext = "?";
@@ -1258,6 +1281,7 @@ namespace Jellyfin.Plugin.Enigma2
{ {
_logger.LogInformation("[Enigma2] Start GetNewTimerDefaultsAsync"); _logger.LogInformation("[Enigma2] Start GetNewTimerDefaultsAsync");
await Task.Delay(0); //to avoid await warnings
var seriesTimerInfo = new SeriesTimerInfo(); var seriesTimerInfo = new SeriesTimerInfo();
return seriesTimerInfo; return seriesTimerInfo;
@@ -1293,7 +1317,7 @@ namespace Jellyfin.Plugin.Enigma2
var url = string.Format("{0}/web/epgservice?sRef={1}", baseUrl, channelId); var url = string.Format("{0}/web/epgservice?sRef={1}", baseUrl, channelId);
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetProgramsAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetProgramsAsync url: {0}", url));
using (var stream = await _httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetHttpClient().GetStreamAsync(url, cancellationToken).ConfigureAwait(false))
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@@ -1455,7 +1479,7 @@ namespace Jellyfin.Plugin.Enigma2
/// </summary> /// </summary>
/// <param name="cancellationToken">The CancellationToken</param> /// <param name="cancellationToken">The CancellationToken</param>
/// <returns>LiveTvServiceStatusInfo</returns> /// <returns>LiveTvServiceStatusInfo</returns>
public async Task<LiveTvServiceStatusInfo> GetStatusInfoAsync(CancellationToken cancellationToken) /*public async Task<LiveTvServiceStatusInfo> GetStatusInfoAsync(CancellationToken cancellationToken)
{ {
_logger.LogInformation("[Enigma2] Start GetStatusInfoAsync Async, retrieve status details"); _logger.LogInformation("[Enigma2] Start GetStatusInfoAsync Async, retrieve status details");
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false); await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
@@ -1534,7 +1558,7 @@ namespace Jellyfin.Plugin.Enigma2
} }
} }
} }*/
/// <summary> /// <summary>
@@ -1553,13 +1577,19 @@ namespace Jellyfin.Plugin.Enigma2
public async Task<MediaSourceInfo> GetRecordingStream(string recordingId, string mediaSourceId, CancellationToken cancellationToken) public async Task<MediaSourceInfo> GetRecordingStream(string recordingId, string mediaSourceId, CancellationToken cancellationToken)
{ {
await Task.Delay(0); //to avoid await warnings
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task CloseLiveStream(string id, CancellationToken cancellationToken) public async Task CloseLiveStream(string id, CancellationToken cancellationToken)
{ {
throw new NotImplementedException(); await Task.Factory.StartNew<string>(() =>
{
_logger.LogDebug("[Enigma2] LiveTvService.CloseLiveStream: closed stream for subscriptionId: {id}", id);
return id;
});
} }
@@ -1589,7 +1619,7 @@ namespace Jellyfin.Plugin.Enigma2
public async Task<IEnumerable<SeriesTimerInfo>> GetSeriesTimersAsync(CancellationToken cancellationToken) public async Task<IEnumerable<SeriesTimerInfo>> GetSeriesTimersAsync(CancellationToken cancellationToken)
{ {
_logger.LogInformation("[Enigma2] Start GetSeriesTimersAsync"); _logger.LogInformation("[Enigma2] Start GetSeriesTimersAsync");
await Task.Delay(0); //to avoid await warnings
var seriesTimerInfo = new List<SeriesTimerInfo>(); var seriesTimerInfo = new List<SeriesTimerInfo>();
return seriesTimerInfo; return seriesTimerInfo;
} }
@@ -1603,6 +1633,7 @@ namespace Jellyfin.Plugin.Enigma2
/// <returns></returns> /// <returns></returns>
public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{ {
await Task.Delay(0); //to avoid await warnings
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -1615,6 +1646,7 @@ namespace Jellyfin.Plugin.Enigma2
/// <returns></returns> /// <returns></returns>
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{ {
await Task.Delay(0); //to avoid await warnings
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -1627,6 +1659,7 @@ namespace Jellyfin.Plugin.Enigma2
/// <returns></returns> /// <returns></returns>
public async Task UpdateTimerAsync(TimerInfo info, CancellationToken cancellationToken) public async Task UpdateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
{ {
await Task.Delay(0); //to avoid await warnings
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -1639,48 +1672,32 @@ namespace Jellyfin.Plugin.Enigma2
/// <returns></returns> /// <returns></returns>
public async Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken) public async Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken)
{ {
await Task.Delay(0); //to avoid await warnings
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// Get the DefaultScheduleSettings
/// </summary>
/// <param name="cancellationToken">The CancellationToken</param>
/// <returns></returns>
//private async Task<ScheduleSettings> GetDefaultScheduleSettings(CancellationToken cancellationToken)
//{
// throw new NotImplementedException();
//}
public event EventHandler DataSourceChanged;
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
public Task ResetTuner(string id, CancellationToken cancellationToken) public Task ResetTuner(string id, CancellationToken cancellationToken)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<ImageStream> GetChannelImageAsync(string channelId, CancellationToken cancellationToken) public Task<Stream> GetChannelImageAsync(string channelId, CancellationToken cancellationToken)
{ {
// Leave as is. This is handled by supplying image url to ChannelInfo // Leave as is. This is handled by supplying image url to ChannelInfo
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<ImageStream> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken) public Task<Stream> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken)
{ {
// Leave as is. This is handled by supplying image url to ProgramInfo // Leave as is. This is handled by supplying image url to ProgramInfo
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<ImageStream> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken) public Task<Stream> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken)
{ {
// Leave as is. This is handled by supplying image url to RecordingInfo // Leave as is. This is handled by supplying image url to RecordingInfo
throw new NotImplementedException(); throw new NotImplementedException();
+6 -5
View File
@@ -7,23 +7,24 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Channels; using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Plugin.Enigma2 namespace Jellyfin.Plugin.Enigma2
{ {
public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia, ISupportsMediaProbe, IHasFolderAttributes public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia, ISupportsMediaProbe, IHasFolderAttributes
{ {
public ILiveTvManager _liveTvManager; private readonly ILogger<LiveTvService> _logger;
public RecordingsChannel(ILiveTvManager liveTvManager) public RecordingsChannel(ILoggerFactory loggerFactory)
{ {
_liveTvManager = liveTvManager; _logger = loggerFactory.CreateLogger<LiveTvService>();
_logger.LogDebug("[Enigma2] RecordingsChannel()");
} }
public string Name => "Enigma2 Recordings"; public string Name => "Enigma2 Recordings";
@@ -110,7 +111,7 @@ namespace Jellyfin.Plugin.Enigma2
private LiveTvService GetService() private LiveTvService GetService()
{ {
return _liveTvManager.Services.OfType<LiveTvService>().First(); return LiveTvService.Instance;
} }
public bool CanDelete(BaseItem item) public bool CanDelete(BaseItem item)
@@ -0,0 +1,20 @@
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller;
using Microsoft.Extensions.DependencyInjection;
using System.Net.Http;
using Jellyfin.Plugin.Enigma2.Helpers;
namespace Jellyfin.Plugin.Enigma2
{
public class ServiceRegistrator : IPluginServiceRegistrator
{
/// <inheritdoc />
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
{
serviceCollection.AddSingleton<ILiveTvService, LiveTvService>();
serviceCollection.AddSingleton<IChannel, RecordingsChannel>();
}
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ guid: "193f29f9-ea6c-4595-a6f6-55e79d7c590a"
# The version of the plugin, starting at 1. Note that the AssemblyVersion # The version of the plugin, starting at 1. Note that the AssemblyVersion
# and FileVersion flags in the `.csproj` file must have two additional # and FileVersion flags in the `.csproj` file must have two additional
# fiels, e.g. 1.0.0 to be built correctly. # fiels, e.g. 1.0.0 to be built correctly.
version: "5.0.0.0" # Please increment with each pull request version: "5.0.1.0" # Please increment with each pull request
# The supported Jellyfin version, usually the earliest binary-compatible # The supported Jellyfin version, usually the earliest binary-compatible
# version. Based on the Jellyfin components from NuGet. # version. Based on the Jellyfin components from NuGet.