From a2e9686898a828bb07eef2690956b61d760c3761 Mon Sep 17 00:00:00 2001 From: knackebrot Date: Wed, 29 Jun 2022 00:40:16 +0200 Subject: [PATCH] Update for Jellyfin 10.8 - Change branding from Vu+ to Enigma2 - Fix wrong default hostname - Add new options UseLoginForStreams, UseHTTPSForStreams - Use new GUID to avoid clashing with the older version of plugin --- ....VuPlus.sln => Jellyfin.Plugin.Enigma2.sln | 6 +- .../Configuration/PluginConfiguration.cs | 9 +- .../Configuration/configPage.html | 70 +++-- .../Helpers/GeneralHelpers.cs | 2 +- .../Images/thumb.png | Bin .../Jellyfin.Plugin.Enigma2.csproj | 20 +- .../LiveTvService.cs | 245 +++++++++--------- .../Plugin.cs | 14 +- .../RecordingsChannel.cs | 41 ++- build.yaml | 16 +- 10 files changed, 226 insertions(+), 197 deletions(-) rename MediaBrowser.Plugins.VuPlus.sln => Jellyfin.Plugin.Enigma2.sln (81%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/Configuration/PluginConfiguration.cs (82%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/Configuration/configPage.html (71%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/Helpers/GeneralHelpers.cs (97%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/Images/thumb.png (100%) rename MediaBrowser.Plugins.VuPlus/MediaBrowser.Plugins.VuPlus.csproj => Jellyfin.Plugin.Enigma2/Jellyfin.Plugin.Enigma2.csproj (60%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/LiveTvService.cs (85%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/Plugin.cs (72%) rename {MediaBrowser.Plugins.VuPlus => Jellyfin.Plugin.Enigma2}/RecordingsChannel.cs (94%) diff --git a/MediaBrowser.Plugins.VuPlus.sln b/Jellyfin.Plugin.Enigma2.sln similarity index 81% rename from MediaBrowser.Plugins.VuPlus.sln rename to Jellyfin.Plugin.Enigma2.sln index 52c2370..88575b7 100644 --- a/MediaBrowser.Plugins.VuPlus.sln +++ b/Jellyfin.Plugin.Enigma2.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31105.61 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaBrowser.Plugins.VuPlus", "MediaBrowser.Plugins.VuPlus\MediaBrowser.Plugins.VuPlus.csproj", "{52B1ABDF-09C1-450E-B808-BBA0A9C19848}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.Plugin.Enigma2", "Jellyfin.Plugin.Enigma2\Jellyfin.Plugin.Enigma2.csproj", "{52B1ABDF-09C1-450E-B808-BBA0A9C19848}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A968FB09-8732-407C-8748-6DB383EB5D91}" ProjectSection(SolutionItems) = preProject diff --git a/MediaBrowser.Plugins.VuPlus/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.Enigma2/Configuration/PluginConfiguration.cs similarity index 82% rename from MediaBrowser.Plugins.VuPlus/Configuration/PluginConfiguration.cs rename to Jellyfin.Plugin.Enigma2/Configuration/PluginConfiguration.cs index f83283a..57972b4 100644 --- a/MediaBrowser.Plugins.VuPlus/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.Enigma2/Configuration/PluginConfiguration.cs @@ -1,6 +1,6 @@ using MediaBrowser.Model.Plugins; -namespace MediaBrowser.Plugins.VuPlus.Configuration +namespace Jellyfin.Plugin.Enigma2.Configuration { /// /// Class PluginConfiguration @@ -12,7 +12,9 @@ namespace MediaBrowser.Plugins.VuPlus.Configuration public string WebInterfacePort { get; set; } public string WebInterfaceUsername { get; set; } public string WebInterfacePassword { get; set; } + public bool UseLoginForStreams { get; set; } public bool UseSecureHTTPS { get; set; } + public bool UseSecureHTTPSForStreams { get; set; } public bool OnlyOneBouquet { get; set; } public string TVBouquet { get; set; } public bool ZapToChannel { get; set; } @@ -26,12 +28,14 @@ namespace MediaBrowser.Plugins.VuPlus.Configuration public PluginConfiguration() { - HostName = "http://localhost"; + HostName = "localhost"; StreamingPort = "8001"; WebInterfacePort = "8000"; WebInterfaceUsername = ""; WebInterfacePassword = ""; + UseLoginForStreams = false; UseSecureHTTPS = false; + UseSecureHTTPSForStreams = false; OnlyOneBouquet = true; TVBouquet = "Favourites (TV)"; ZapToChannel = false; @@ -41,7 +45,6 @@ namespace MediaBrowser.Plugins.VuPlus.Configuration RecordingPath = ""; EnableDebugLogging = false; - } } } diff --git a/MediaBrowser.Plugins.VuPlus/Configuration/configPage.html b/Jellyfin.Plugin.Enigma2/Configuration/configPage.html similarity index 71% rename from MediaBrowser.Plugins.VuPlus/Configuration/configPage.html rename to Jellyfin.Plugin.Enigma2/Configuration/configPage.html index 106e093..810208b 100644 --- a/MediaBrowser.Plugins.VuPlus/Configuration/configPage.html +++ b/Jellyfin.Plugin.Enigma2/Configuration/configPage.html @@ -1,46 +1,56 @@ - Vu+ + Enigma2 -
+
-

VuPlus

+

Enigma2

-
+
- +
The host name (address) or ip address of your receiver
- +
The Streaming port of your receiver eg. 8001
- +
- The web Interface port of your receiver eg. 8000 + The web interface port of your receiver eg. 8000
- +
- The web Interface username of your receiver (optional) + The web interface username of your receiver (optional)
- +
- The web Interface password of your receiver (optional) + The web interface password of your receiver (optional) +
+
+ +
+ +
+ Use web interface login for streaming
@@ -54,6 +64,16 @@
+
+ +
+ Use HTTPS to connect to streaming port +
+
+
/// The homepage url. - public string HomePageUrl => "http://www.VuPlus.com/"; + public string HomePageUrl => "https://github.com/oe-alliance"; /// /// Gets the name. /// /// The name. - public string Name => "VuPlus"; + public string Name => "Enigma2"; public async Task GetRecordingStream(string recordingId, string mediaSourceId, CancellationToken cancellationToken) @@ -1560,7 +1565,7 @@ namespace MediaBrowser.Plugins.VuPlus public async Task CopyFilesAsync(StreamReader source, StreamWriter destination) { - _logger.LogInformation("[VuPlus] Start CopyFiles Async"); + _logger.LogInformation("[Enigma2] Start CopyFiles Async"); var buffer = new char[0x1000]; int numRead; while ((numRead = await source.ReadAsync(buffer, 0, buffer.Length)) != 0) @@ -1583,7 +1588,7 @@ namespace MediaBrowser.Plugins.VuPlus /// public async Task> GetSeriesTimersAsync(CancellationToken cancellationToken) { - _logger.LogInformation("[VuPlus] Start GetSeriesTimersAsync"); + _logger.LogInformation("[Enigma2] Start GetSeriesTimersAsync"); var seriesTimerInfo = new List(); return seriesTimerInfo; diff --git a/MediaBrowser.Plugins.VuPlus/Plugin.cs b/Jellyfin.Plugin.Enigma2/Plugin.cs similarity index 72% rename from MediaBrowser.Plugins.VuPlus/Plugin.cs rename to Jellyfin.Plugin.Enigma2/Plugin.cs index 95a4d8d..572bed4 100644 --- a/MediaBrowser.Plugins.VuPlus/Plugin.cs +++ b/Jellyfin.Plugin.Enigma2/Plugin.cs @@ -4,9 +4,9 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; -using MediaBrowser.Plugins.VuPlus.Configuration; +using Jellyfin.Plugin.Enigma2.Configuration; -namespace MediaBrowser.Plugins.VuPlus +namespace Jellyfin.Plugin.Enigma2 { /// /// Class Plugin @@ -25,15 +25,15 @@ namespace MediaBrowser.Plugins.VuPlus /// Gets the name of the plugin /// /// The name. - public override string Name => "VuPlus"; + public override string Name => "Enigma2"; /// /// Gets the description. /// /// The description. - public override string Description => "Provides live tv using Vu+ / Enigma2 pvr as a back-end."; + public override string Description => "Provides live TV using Enigma2 PVR as a back-end."; - private Guid _id = new Guid("9564ac10-af23-39bc-449f-624f23cfa48f"); + private Guid _id = new Guid("193f29f9-ea6c-4595-a6f6-55e79d7c590a"); public override Guid Id => _id; /// @@ -48,8 +48,8 @@ namespace MediaBrowser.Plugins.VuPlus { new PluginPageInfo { - Name = "vuplus", - EmbeddedResourcePath = "MediaBrowser.Plugins.VuPlus.Configuration.configPage.html" + Name = "enigma2", + EmbeddedResourcePath = "Jellyfin.Plugin.Enigma2.Configuration.configPage.html" } }; } diff --git a/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs b/Jellyfin.Plugin.Enigma2/RecordingsChannel.cs similarity index 94% rename from MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs rename to Jellyfin.Plugin.Enigma2/RecordingsChannel.cs index add2615..56a5b66 100644 --- a/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs +++ b/Jellyfin.Plugin.Enigma2/RecordingsChannel.cs @@ -15,7 +15,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.MediaInfo; -namespace MediaBrowser.Plugins.VuPlus +namespace Jellyfin.Plugin.Enigma2 { public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia, ISupportsMediaProbe, IHasFolderAttributes { @@ -26,11 +26,11 @@ namespace MediaBrowser.Plugins.VuPlus _liveTvManager = liveTvManager; } - public string Name => "VuPlus Recordings"; + public string Name => "Enigma2 Recordings"; public string[] Attributes => new[] { "Recordings" }; - public string Description => "VuPlus Recordings"; + public string Description => "Enigma2 Recordings"; public string DataVersion => "1"; @@ -181,14 +181,10 @@ namespace MediaBrowser.Plugins.VuPlus var service = GetService(); var allRecordings = await service.GetAllRecordingsAsync(cancellationToken).ConfigureAwait(false); - var result = new ChannelItemResult() + return new ChannelItemResult() { - Items = new List() + Items = allRecordings.Where(filter).Select(ConvertToChannelItem).ToList() }; - - result.Items.AddRange(allRecordings.Where(filter).Select(ConvertToChannelItem)); - - return result; } private ChannelItemInfo ConvertToChannelItem(MyRecordingInfo item) @@ -207,7 +203,7 @@ namespace MediaBrowser.Plugins.VuPlus //HomePageUrl = item.HomePageUrl Id = item.Id, //IndexNumber = item.IndexNumber, - MediaType = item.ChannelType == Model.LiveTv.ChannelType.TV ? ChannelMediaType.Video : ChannelMediaType.Audio, + MediaType = item.ChannelType == ChannelType.TV ? ChannelMediaType.Video : ChannelMediaType.Audio, MediaSources = new List { new MediaSourceInfo @@ -225,7 +221,7 @@ namespace MediaBrowser.Plugins.VuPlus DateModified = item.DateLastUpdated, Overview = item.Overview, //People = item.People - IsLiveStream = item.Status == Model.LiveTv.RecordingStatus.InProgress, + IsLiveStream = item.Status == RecordingStatus.InProgress, Etag = item.Status.ToString() }; @@ -237,16 +233,14 @@ namespace MediaBrowser.Plugins.VuPlus var service = GetService(); var allRecordings = await service.GetAllRecordingsAsync(cancellationToken).ConfigureAwait(false); - var result = new ChannelItemResult() - { - Items = new List() - }; var series = allRecordings .Where(i => i.IsSeries) .ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase); - result.Items.AddRange(series.OrderBy(i => i.Key).Select(i => new ChannelItemInfo + var items = new List(); + + items.AddRange(series.OrderBy(i => i.Key).Select(i => new ChannelItemInfo { Name = i.Key, FolderType = ChannelFolderType.Container, @@ -259,7 +253,7 @@ namespace MediaBrowser.Plugins.VuPlus if (kids != null) { - result.Items.Add(new ChannelItemInfo + items.Add(new ChannelItemInfo { Name = "Kids", FolderType = ChannelFolderType.Container, @@ -272,7 +266,7 @@ namespace MediaBrowser.Plugins.VuPlus var movies = allRecordings.FirstOrDefault(i => i.IsMovie); if (movies != null) { - result.Items.Add(new ChannelItemInfo + items.Add(new ChannelItemInfo { Name = "Movies", FolderType = ChannelFolderType.Container, @@ -285,7 +279,7 @@ namespace MediaBrowser.Plugins.VuPlus var news = allRecordings.FirstOrDefault(i => i.IsNews); if (news != null) { - result.Items.Add(new ChannelItemInfo + items.Add(new ChannelItemInfo { Name = "News", FolderType = ChannelFolderType.Container, @@ -298,7 +292,7 @@ namespace MediaBrowser.Plugins.VuPlus var sports = allRecordings.FirstOrDefault(i => i.IsSports); if (sports != null) { - result.Items.Add(new ChannelItemInfo + items.Add(new ChannelItemInfo { Name = "Sports", FolderType = ChannelFolderType.Container, @@ -311,7 +305,7 @@ namespace MediaBrowser.Plugins.VuPlus var other = allRecordings.FirstOrDefault(i => !i.IsSports && !i.IsNews && !i.IsMovie && !i.IsKids && !i.IsSeries); if (other != null) { - result.Items.Add(new ChannelItemInfo + items.Add(new ChannelItemInfo { Name = "Others", FolderType = ChannelFolderType.Container, @@ -321,7 +315,10 @@ namespace MediaBrowser.Plugins.VuPlus }); } - return result; + return new ChannelItemResult() + { + Items = items + }; } } public class MyRecordingInfo diff --git a/build.yaml b/build.yaml index 6a02794..54e7dd4 100644 --- a/build.yaml +++ b/build.yaml @@ -1,27 +1,27 @@ --- # The name of the plugin; official plugins always start "jellyfin-plugin-" -name: "jellyfin-plugin-vuplus" +name: "jellyfin-plugin-enigma2" # The GUID of the plugin, found in Plugin.cs -guid: "9564ac10-af23-39bc-449f-624f23cfa48f" +guid: "193f29f9-ea6c-4595-a6f6-55e79d7c590a" # The version of the plugin, starting at 1. Note that the AssemblyVersion # and FileVersion flags in the `.csproj` file must have two additional # fiels, e.g. 1.0.0 to be built correctly. -version: "4.0.0.0" # Please increment with each pull request +version: "5.0.0.0" # Please increment with each pull request # The supported Jellyfin version, usually the earliest binary-compatible # version. Based on the Jellyfin components from NuGet. -targetAbi: "10.7.0.0" # The earliest binary-compatible version +targetAbi: "10.8.0.0" # The earliest binary-compatible version -framework: "net5.0" +framework: "net6.0" # The owner name of the plugin, "jellyfin" for official plugins. Change # to your own name if you wish to remain a 3rd-party plugin. owner: "knackebrot" # A short description of the plugin -overview: "VU+" +overview: "Enigma2" # A longer and more detailed description of the plugin; use multiple # lines as required for readability. @@ -35,10 +35,10 @@ category: "Live TV" # Include the main output file, as well as any dependency `.dll`s that # might be required for the plugin to run. artifacts: - - "MediaBrowser.Plugins.VuPlus.dll" + - "Jellyfin.Plugin.Enigma2.dll" # Build information values for the build infrastructure; these should # not need to be changed usually. build_type: "dotnet" dotnet_configuration: "Release" -dotnet_framework: "net5.0" +dotnet_framework: "net6.0"