Skip to content

Commit 309e7c4

Browse files
authored
Merge pull request #13 from tiagoqpinto/jellyfin
Add Transcoding option to settings
2 parents a2e9686 + 0933687 commit 309e7c4

File tree

6 files changed

+102
-24
lines changed

6 files changed

+102
-24
lines changed

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

Jellyfin.Plugin.Enigma2/Configuration/PluginConfiguration.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public class PluginConfiguration : BasePluginConfiguration
2323

2424
public string RecordingPath { get; set; }
2525

26+
public bool TranscodedStream { get; set; }
27+
28+
public string TranscodingPort { get; set; }
29+
2630
public bool EnableDebugLogging { get; set; }
2731

2832

@@ -44,6 +48,9 @@ public PluginConfiguration()
4448

4549
RecordingPath = "";
4650

51+
TranscodedStream = false;
52+
TranscodingPort = "8002";
53+
4754
EnableDebugLogging = false;
4855
}
4956
}

Jellyfin.Plugin.Enigma2/Configuration/configPage.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,22 @@ <h1>Enigma2</h1>
127127
</div>
128128
</div>
129129

130+
<div class="checkboxContainer checkboxContainer-withDescription">
131+
<label>
132+
<input is="emby-checkbox" type="checkbox" id="chkTranscodedStream" />
133+
<span>Request Transcoded Stream</span>
134+
</label>
135+
<div class="fieldDescription checkboxFieldDescription">
136+
Request Transcoded Stream (h264, 720p, 1Mpbs and mp4 as default)
137+
</div>
138+
</div>
139+
<div class="inputContainer">
140+
<input is="emby-input" id="txtTranscodingPort" type="text" label="Enigma2 transcoding port:" />
141+
<div class="fieldDescription">
142+
The Transcoding port of your receiver eg. 8002
143+
</div>
144+
</div>
145+
130146
<label class="checkboxContainer">
131147
<input is="emby-checkbox" type="checkbox" id="chkDebugLogging" />
132148
<span>Enable Enigma2 debug logging</span>
@@ -163,6 +179,8 @@ <h1>Enigma2</h1>
163179
document.getElementById('chkFetchPiconsFromWebInterface').checked = config.FetchPiconsFromWebInterface || false;
164180
document.getElementById('txtPiconsPath').value = config.PiconsPath || "";
165181
document.getElementById('txtRecordingPath').value = config.RecordingPath || "";
182+
document.getElementById('chkTranscodedStream').checked = config.TranscodedStream || false;
183+
document.getElementById('txtTranscodingPort').value = config.TranscodingPort || "";
166184
document.getElementById('chkDebugLogging').checked = config.EnableDebugLogging || false;
167185

168186
Dashboard.hideLoadingMsg();
@@ -187,6 +205,8 @@ <h1>Enigma2</h1>
187205
config.FetchPiconsFromWebInterface = document.getElementById('chkFetchPiconsFromWebInterface').checked;
188206
config.PiconsPath = document.getElementById('txtPiconsPath').value;
189207
config.RecordingPath = document.getElementById('txtRecordingPath').value;
208+
config.TranscodedStream = document.getElementById('chkTranscodedStream').checked;
209+
config.TranscodingPort = document.getElementById('txtTranscodingPort').value;
190210
config.EnableDebugLogging = document.getElementById('chkDebugLogging').checked;
191211

192212
ApiClient.updatePluginConfiguration(Enigma2ConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult);

Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0</TargetFrameworks>
5-
<AssemblyVersion>5.0.0.0</AssemblyVersion>
6-
<FileVersion>5.0.0.0</FileVersion>
5+
<AssemblyVersion>5.0.1.0</AssemblyVersion>
6+
<FileVersion>5.0.1.0</FileVersion>
77
</PropertyGroup>
88

99
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'">

Jellyfin.Plugin.Enigma2/LiveTvService.cs

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ private async Task EnsureConnectionAsync(CancellationToken cancellationToken)
101101
throw new InvalidOperationException("Enigma2 Streaming Port must be configured.");
102102
}
103103

104+
if (config.TranscodedStream && string.IsNullOrEmpty(config.TranscodingPort))
105+
{
106+
_logger.LogError("[Enigma2] Transcoding Port must be configured.");
107+
throw new InvalidOperationException("Enigma2 Transcoding Port must be configured.");
108+
}
109+
104110
if (string.IsNullOrEmpty(config.WebInterfacePort))
105111
{
106112
_logger.LogError("[Enigma2] Web Interface Port must be configured.");
@@ -552,6 +558,7 @@ public async Task<List<ChannelInfo>> GetChannelsForTVBouquetAsync(CancellationTo
552558
/// <returns>Task{IEnumerable{RecordingInfo}}</returns>
553559
public async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken)
554560
{
561+
await Task.Delay(0); //to avoid await warnings
555562
return new List<RecordingInfo>();
556563
}
557564

@@ -1127,8 +1134,15 @@ public async Task<MediaSourceInfo> GetChannelStream(string channelOid, string me
11271134
protocol = "https";
11281135
}
11291136

1130-
var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.StreamingPort;
1137+
var streamingPort = Plugin.Instance.Configuration.StreamingPort;
1138+
1139+
if (Plugin.Instance.Configuration.TranscodedStream)
1140+
{
1141+
streamingPort = Plugin.Instance.Configuration.TranscodingPort;
1142+
}
11311143

1144+
var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + streamingPort;
1145+
11321146
//check if we need to zap to channel - single tuner
11331147
if (Plugin.Instance.Configuration.ZapToChannel)
11341148
{
@@ -1137,11 +1151,17 @@ public async Task<MediaSourceInfo> GetChannelStream(string channelOid, string me
11371151

11381152
if (Plugin.Instance.Configuration.UseLoginForStreams && !string.IsNullOrEmpty(Plugin.Instance.Configuration.WebInterfaceUsername))
11391153
{
1140-
baseUrl = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.StreamingPort;
1154+
baseUrl = protocol + "://" + Plugin.Instance.Configuration.WebInterfaceUsername + ":" + Plugin.Instance.Configuration.WebInterfacePassword + "@" + Plugin.Instance.Configuration.HostName + ":" + streamingPort;
1155+
}
1156+
1157+
var trancodingUrl = "";
1158+
if (Plugin.Instance.Configuration.TranscodedStream)
1159+
{
1160+
trancodingUrl = "?bitrate=1000000?width=1280?height=720?vcodec=h264?aspectratio=2?interlaced=0.mp4";
11411161
}
11421162

11431163
_liveStreams++;
1144-
var streamUrl = string.Format("{0}/{1}", baseUrl, channelOid);
1164+
var streamUrl = string.Format("{0}/{1}{2}", baseUrl, channelOid, trancodingUrl);
11451165
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetChannelStream url: {0}", streamUrl));
11461166

11471167
return new MediaSourceInfo
@@ -1258,6 +1278,7 @@ public async Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken ca
12581278
{
12591279
_logger.LogInformation("[Enigma2] Start GetNewTimerDefaultsAsync");
12601280

1281+
await Task.Delay(0); //to avoid await warnings
12611282
var seriesTimerInfo = new SeriesTimerInfo();
12621283

12631284
return seriesTimerInfo;
@@ -1553,12 +1574,14 @@ public async Task<LiveTvServiceStatusInfo> GetStatusInfoAsync(CancellationToken
15531574

15541575
public async Task<MediaSourceInfo> GetRecordingStream(string recordingId, string mediaSourceId, CancellationToken cancellationToken)
15551576
{
1577+
await Task.Delay(0); //to avoid await warnings
15561578
throw new NotImplementedException();
15571579
}
15581580

15591581

15601582
public async Task CloseLiveStream(string id, CancellationToken cancellationToken)
15611583
{
1584+
await Task.Delay(0); //to avoid await warnings
15621585
throw new NotImplementedException();
15631586
}
15641587

@@ -1589,7 +1612,7 @@ public Task RecordLiveStream(string id, CancellationToken cancellationToken)
15891612
public async Task<IEnumerable<SeriesTimerInfo>> GetSeriesTimersAsync(CancellationToken cancellationToken)
15901613
{
15911614
_logger.LogInformation("[Enigma2] Start GetSeriesTimersAsync");
1592-
1615+
await Task.Delay(0); //to avoid await warnings
15931616
var seriesTimerInfo = new List<SeriesTimerInfo>();
15941617
return seriesTimerInfo;
15951618
}
@@ -1603,6 +1626,7 @@ public async Task<IEnumerable<SeriesTimerInfo>> GetSeriesTimersAsync(Cancellatio
16031626
/// <returns></returns>
16041627
public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
16051628
{
1629+
await Task.Delay(0); //to avoid await warnings
16061630
throw new NotImplementedException();
16071631
}
16081632

@@ -1615,6 +1639,7 @@ public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken
16151639
/// <returns></returns>
16161640
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
16171641
{
1642+
await Task.Delay(0); //to avoid await warnings
16181643
throw new NotImplementedException();
16191644
}
16201645

@@ -1627,6 +1652,7 @@ public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken
16271652
/// <returns></returns>
16281653
public async Task UpdateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
16291654
{
1655+
await Task.Delay(0); //to avoid await warnings
16301656
throw new NotImplementedException();
16311657
}
16321658

@@ -1639,27 +1665,11 @@ public async Task UpdateTimerAsync(TimerInfo info, CancellationToken cancellatio
16391665
/// <returns></returns>
16401666
public async Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken)
16411667
{
1668+
await Task.Delay(0); //to avoid await warnings
16421669
throw new NotImplementedException();
16431670
}
16441671

16451672

1646-
/// <summary>
1647-
/// Get the DefaultScheduleSettings
1648-
/// </summary>
1649-
/// <param name="cancellationToken">The CancellationToken</param>
1650-
/// <returns></returns>
1651-
//private async Task<ScheduleSettings> GetDefaultScheduleSettings(CancellationToken cancellationToken)
1652-
//{
1653-
// throw new NotImplementedException();
1654-
//}
1655-
1656-
1657-
public event EventHandler DataSourceChanged;
1658-
1659-
1660-
public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
1661-
1662-
16631673
public Task ResetTuner(string id, CancellationToken cancellationToken)
16641674
{
16651675
throw new NotImplementedException();

build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ guid: "193f29f9-ea6c-4595-a6f6-55e79d7c590a"
88
# The version of the plugin, starting at 1. Note that the AssemblyVersion
99
# and FileVersion flags in the `.csproj` file must have two additional
1010
# fiels, e.g. 1.0.0 to be built correctly.
11-
version: "5.0.0.0" # Please increment with each pull request
11+
version: "5.0.1.0" # Please increment with each pull request
1212

1313
# The supported Jellyfin version, usually the earliest binary-compatible
1414
# version. Based on the Jellyfin components from NuGet.

0 commit comments

Comments
 (0)