diff --git a/MediaBrowser.Plugins.VuPlus/Helpers/GeneralHelpers.cs b/MediaBrowser.Plugins.VuPlus/Helpers/GeneralHelpers.cs index 8d229a8..b36f036 100644 --- a/MediaBrowser.Plugins.VuPlus/Helpers/GeneralHelpers.cs +++ b/MediaBrowser.Plugins.VuPlus/Helpers/GeneralHelpers.cs @@ -37,35 +37,4 @@ namespace MediaBrowser.Plugins.VuPlus.Helpers } } - - public static class RecordingHelper - { - - } - - public static class ApiHelper - { - private static readonly DateTime UnixEpoch = - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - - public static long GetCurrentUnixTimestampMillis() - { - return (long)(DateTime.UtcNow - UnixEpoch).TotalMilliseconds; - } - - public static DateTime DateTimeFromUnixTimestampMillis(long millis) - { - return UnixEpoch.AddMilliseconds(millis); - } - - public static long GetCurrentUnixTimestampSeconds(DateTime date) - { - return (long)(date - UnixEpoch).TotalSeconds; - } - - public static DateTime DateTimeFromUnixTimestampSeconds(long seconds) - { - return UnixEpoch.AddSeconds(seconds); - } - } } diff --git a/MediaBrowser.Plugins.VuPlus/LiveTvService.cs b/MediaBrowser.Plugins.VuPlus/LiveTvService.cs index 32a012f..34b632a 100644 --- a/MediaBrowser.Plugins.VuPlus/LiveTvService.cs +++ b/MediaBrowser.Plugins.VuPlus/LiveTvService.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Plugins.VuPlus private String tvBouquetSRef; List tvChannelInfos = new List(); - public DateTime LastRecordingChange = DateTime.MinValue; + public DateTimeOffset LastRecordingChange = DateTimeOffset.MinValue; public LiveTvService(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogger logger) { @@ -675,7 +675,7 @@ namespace MediaBrowser.Plugins.VuPlus recordingInfo.CommunityRating = 0; long sdated = Int64.Parse(e2time); - DateTime sdate = ApiHelper.DateTimeFromUnixTimestampSeconds(sdated); + var sdate = DateTimeOffset.FromUnixTimeSeconds(sdated); recordingInfo.StartDate = sdate.ToUniversalTime(); //length in format mm:ss @@ -683,7 +683,7 @@ namespace MediaBrowser.Plugins.VuPlus long mins = Int64.Parse(words[0]); long seconds = Int64.Parse(words[1]); long edated = Int64.Parse(e2time) + (mins * 60) + (seconds); - DateTime edate = ApiHelper.DateTimeFromUnixTimestampSeconds(edated); + var edate = DateTimeOffset.FromUnixTimeSeconds(edated); recordingInfo.EndDate = edate.ToUniversalTime(); //recordingInfo.EpisodeTitle = e2title; @@ -1098,7 +1098,7 @@ namespace MediaBrowser.Plugins.VuPlus timerInfo.ChannelId = e2servicereference; long edated = Int64.Parse(e2timeend); - DateTime edate = ApiHelper.DateTimeFromUnixTimestampSeconds(edated); + var edate = DateTimeOffset.FromUnixTimeSeconds(edated); timerInfo.EndDate = edate.ToUniversalTime(); timerInfo.Id = e2servicereference + "~" + e2eit + "~" + e2timebegin + "~" + e2timeend + "~" + count; @@ -1114,7 +1114,7 @@ namespace MediaBrowser.Plugins.VuPlus timerInfo.SeriesTimerId = null; long sdated = Int64.Parse(e2timebegin); - DateTime sdate = ApiHelper.DateTimeFromUnixTimestampSeconds(sdated); + var sdate = DateTimeOffset.FromUnixTimeSeconds(sdated); timerInfo.StartDate = sdate.ToUniversalTime(); if (e2state == "0") @@ -1316,7 +1316,7 @@ namespace MediaBrowser.Plugins.VuPlus /// end date/time /// The CancellationToken /// IEnumerable - public async Task> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) + public async Task> GetProgramsAsync(string channelId, DateTimeOffset startDateUtc, DateTimeOffset endDateUtc, CancellationToken cancellationToken) { _logger.Info("[VuPlus] Start GetProgramsAsync"); await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false); @@ -1420,7 +1420,7 @@ namespace MediaBrowser.Plugins.VuPlus } long sdated = Int64.Parse(e2eventstart); - DateTime sdate = ApiHelper.DateTimeFromUnixTimestampSeconds(sdated); + var sdate = DateTimeOffset.FromUnixTimeSeconds(sdated); // Check whether the current element is within the time range passed if (sdate > endDateUtc) @@ -1463,7 +1463,7 @@ namespace MediaBrowser.Plugins.VuPlus programInfo.Overview = e2eventdescriptionextended; long edated = Int64.Parse(e2eventstart) + Int64.Parse(e2eventduration); - DateTime edate = ApiHelper.DateTimeFromUnixTimestampSeconds(edated); + var edate = DateTimeOffset.FromUnixTimeSeconds(edated); programInfo.StartDate = sdate.ToUniversalTime(); programInfo.EndDate = edate.ToUniversalTime(); diff --git a/MediaBrowser.Plugins.VuPlus/MediaBrowser.Plugins.VuPlus.csproj b/MediaBrowser.Plugins.VuPlus/MediaBrowser.Plugins.VuPlus.csproj index 7f798ed..a05fa48 100644 --- a/MediaBrowser.Plugins.VuPlus/MediaBrowser.Plugins.VuPlus.csproj +++ b/MediaBrowser.Plugins.VuPlus/MediaBrowser.Plugins.VuPlus.csproj @@ -1,21 +1,24 @@ - netstandard2.0;net46 - 3.1.8 - 3.1.8 + netstandard2.0; + 3.1.9 + 3.1.9 + + - + + diff --git a/MediaBrowser.Plugins.VuPlus/Plugin.cs b/MediaBrowser.Plugins.VuPlus/Plugin.cs index 3c61780..e53065c 100644 --- a/MediaBrowser.Plugins.VuPlus/Plugin.cs +++ b/MediaBrowser.Plugins.VuPlus/Plugin.cs @@ -5,13 +5,15 @@ using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; using MediaBrowser.Plugins.VuPlus.Configuration; +using System.IO; +using MediaBrowser.Model.Drawing; namespace MediaBrowser.Plugins.VuPlus { /// /// Class Plugin /// - public class Plugin : BasePlugin, IHasWebPages + public class Plugin : BasePlugin, IHasWebPages, IHasThumbImage { public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer) @@ -63,5 +65,19 @@ namespace MediaBrowser.Plugins.VuPlus } }; } + + public Stream GetThumbImage() + { + var type = GetType(); + return type.Assembly.GetManifestResourceStream(type.Namespace + ".Images.thumb.png"); + } + + public ImageFormat ThumbImageFormat + { + get + { + return ImageFormat.Png; + } + } } } diff --git a/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs b/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs index be2b2f8..ad9ef31 100644 --- a/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs +++ b/MediaBrowser.Plugins.VuPlus/RecordingsChannel.cs @@ -71,7 +71,7 @@ namespace MediaBrowser.Plugins.VuPlus public string GetCacheKey(string userId) { - var now = DateTime.UtcNow; + var now = DateTimeOffset.UtcNow; var values = new List(); @@ -113,7 +113,7 @@ namespace MediaBrowser.Plugins.VuPlus { return Task.FromResult(new DynamicImageResponse { - Path = "https://github.com/CompoUK/MediaBrowser.Plugins.VuPlus/blob/master/src/Images/Vu+.png?raw=true", + Path = "https://github.com/MediaBrowser/MediaBrowser.Plugins.VuPlus/raw/master/MediaBrowser.Plugins.VuPlus/Images/thumb.png", Protocol = MediaProtocol.Http, HasImage = true }); @@ -157,7 +157,7 @@ namespace MediaBrowser.Plugins.VuPlus { var result = await GetChannelItems(new InternalChannelItemQuery(), i => true, cancellationToken).ConfigureAwait(false); - return result.Items.OrderByDescending(i => i.DateCreated ?? DateTime.MinValue); + return result.Items.OrderByDescending(i => i.DateCreated ?? DateTimeOffset.MinValue); } public Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken) @@ -410,12 +410,12 @@ namespace MediaBrowser.Plugins.VuPlus /// /// The start date of the recording, in UTC. /// - public DateTime StartDate { get; set; } + public DateTimeOffset StartDate { get; set; } /// /// The end date of the recording, in UTC. /// - public DateTime EndDate { get; set; } + public DateTimeOffset EndDate { get; set; } /// /// Gets or sets the program identifier. @@ -462,7 +462,7 @@ namespace MediaBrowser.Plugins.VuPlus /// Gets or sets the original air date. /// /// The original air date. - public DateTime? OriginalAirDate { get; set; } + public DateTimeOffset? OriginalAirDate { get; set; } /// /// Gets or sets a value indicating whether this instance is movie. @@ -545,7 +545,7 @@ namespace MediaBrowser.Plugins.VuPlus /// Gets or sets the date last updated. /// /// The date last updated. - public DateTime DateLastUpdated { get; set; } + public DateTimeOffset DateLastUpdated { get; set; } public MyRecordingInfo() {