switch to DateTimeOffset
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace MediaBrowser.Plugins.VuPlus
|
||||
private String tvBouquetSRef;
|
||||
List<ChannelInfo> tvChannelInfos = new List<ChannelInfo>();
|
||||
|
||||
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
|
||||
/// <param name="endDateUtc">end date/time</param>
|
||||
/// <param name="cancellationToken">The CancellationToken</param>
|
||||
/// <returns>IEnumerable<ProgramInfo></returns>
|
||||
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||
public async Task<IEnumerable<ProgramInfo>> 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();
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
|
||||
<AssemblyVersion>3.1.8</AssemblyVersion>
|
||||
<FileVersion>3.1.8</FileVersion>
|
||||
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
|
||||
<AssemblyVersion>3.1.9</AssemblyVersion>
|
||||
<FileVersion>3.1.9</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Configuration\configPage.html" />
|
||||
<None Remove="Images\thumb.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Configuration\configPage.html" />
|
||||
<EmbeddedResource Include="Images\thumb.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="mediabrowser.server.core" Version="3.3.28" />
|
||||
<PackageReference Include="mediabrowser.server.core" Version="3.6.0.36-beta" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Plugin
|
||||
/// </summary>
|
||||
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
public class Plugin : BasePlugin<PluginConfiguration>, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<string>();
|
||||
|
||||
@@ -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<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
|
||||
@@ -410,12 +410,12 @@ namespace MediaBrowser.Plugins.VuPlus
|
||||
/// <summary>
|
||||
/// The start date of the recording, in UTC.
|
||||
/// </summary>
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTimeOffset StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The end date of the recording, in UTC.
|
||||
/// </summary>
|
||||
public DateTime EndDate { get; set; }
|
||||
public DateTimeOffset EndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the program identifier.
|
||||
@@ -462,7 +462,7 @@ namespace MediaBrowser.Plugins.VuPlus
|
||||
/// Gets or sets the original air date.
|
||||
/// </summary>
|
||||
/// <value>The original air date.</value>
|
||||
public DateTime? OriginalAirDate { get; set; }
|
||||
public DateTimeOffset? OriginalAirDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value>The date last updated.</value>
|
||||
public DateTime DateLastUpdated { get; set; }
|
||||
public DateTimeOffset DateLastUpdated { get; set; }
|
||||
|
||||
public MyRecordingInfo()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user