3 Commits
Author SHA1 Message Date
Luke Pulverenti a08bbd0f31 3.2.1 2019-08-12 14:04:56 -04:00
Luke Pulverenti f7a7fced43 update recordings on schedule 2019-05-09 13:14:09 -04:00
Luke Pulverenti 46ea3e4c21 switch to DateTimeOffset 2018-09-07 15:22:39 -04:00
6 changed files with 79 additions and 70 deletions
@@ -140,16 +140,16 @@
$('#txtWebInterfacePort', page).val(config.WebInterfacePort || "");
$('#txtWebInterfaceUsername', page).val(config.WebInterfaceUsername || "");
$('#txtWebInterfacePassword', page).val(config.WebInterfacePassword || "");
$('#chkUseSecureHTTPS', page).checked(config.UseSecureHTTPS || false).checkboxradio("refresh");
$('#chkOnlyOneBouquet', page).checked(config.OnlyOneBouquet || false).checkboxradio("refresh");
$('#txtTVBouquet', page).val(config.TVBouquet || "");
$('#chkZapToChannel', page).checked(config.ZapToChannel || false).checkboxradio("refresh");
$('#chkFetchPiconsFromWebInterface', page).checked(config.FetchPiconsFromWebInterface || false).checkboxradio("refresh");
page.querySelector('#chkUseSecureHTTPS').checked = config.UseSecureHTTPS || false;
page.querySelector('#chkOnlyOneBouquet').checked = config.OnlyOneBouquet || false;
page.querySelector('#txtTVBouquet', page).val(config.TVBouquet || "");
page.querySelector('#chkZapToChannel').checked = config.ZapToChannel || false;
page.querySelector('#chkFetchPiconsFromWebInterface').checked = config.FetchPiconsFromWebInterface || false;
$('#txtPiconsPath', page).val(config.PiconsPath || "");
$('#txtRecordingPath', page).val(config.RecordingPath || "");
$('#chkDebugLogging', page).checked(config.EnableDebugLogging || false).checkboxradio("refresh");
page.querySelector('#chkDebugLogging').checked = config.EnableDebugLogging || false;
Dashboard.hideLoadingMsg();
});
@@ -169,7 +169,7 @@
//}
//reset TV bouquet reference if Only 1 Bouquet not set
//if ($('#chkOnlyOneBouquet', form).checked()) {
//if (form.querySelector('#chkOnlyOneBouquet').checked) {
//}
//else
//{
@@ -181,16 +181,16 @@
config.WebInterfacePort = $('#txtWebInterfacePort', form).val();
config.WebInterfaceUsername = $('#txtWebInterfaceUsername', form).val();
config.WebInterfacePassword = $('#txtWebInterfacePassword', form).val();
config.UseSecureHTTPS = $('#chkUseSecureHTTPS', form).checked();
config.OnlyOneBouquet = $('#chkOnlyOneBouquet', form).checked();
config.UseSecureHTTPS = form.querySelector('#chkUseSecureHTTPS').checked;
config.OnlyOneBouquet = form.querySelector('#chkOnlyOneBouquet').checked;
config.TVBouquet = $('#txtTVBouquet', form).val();
config.ZapToChannel = $('#chkZapToChannel', form).checked();
config.FetchPiconsFromWebInterface = $('#chkFetchPiconsFromWebInterface', form).checked();
config.ZapToChannel = form.querySelector('#chkZapToChannel').checked;
config.FetchPiconsFromWebInterface = form.querySelector('#chkFetchPiconsFromWebInterface').checked;
config.PiconsPath = $('#txtPiconsPath', form).val();
config.RecordingPath = $('#txtRecordingPath', form).val();
config.EnableDebugLogging = $('#chkDebugLogging', form).checked();
config.EnableDebugLogging = form.querySelector('#chkDebugLogging').checked;
ApiClient.updatePluginConfiguration(VuPlusConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});
@@ -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);
}
}
}
+8 -8
View File
@@ -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.2.1</AssemblyVersion>
<FileVersion>3.2.1</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="4.1.0.26" />
<PackageReference Include="System.Memory" Version="4.5.2" />
</ItemGroup>
</Project>
+17 -1
View File
@@ -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;
}
}
}
}
@@ -18,13 +18,41 @@ using MediaBrowser.Model.LiveTv;
namespace MediaBrowser.Plugins.VuPlus
{
public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia, ISupportsMediaProbe, IHasFolderAttributes
public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia, ISupportsMediaProbe, IHasFolderAttributes, IHasChangeEvent
{
public ILiveTvManager _liveTvManager;
public event EventHandler ContentChanged;
private Timer _updateTimer;
public void OnContentChanged()
{
if (ContentChanged != null)
{
ContentChanged(this, EventArgs.Empty);
}
}
private void OnUpdateTimerCallback(object state)
{
OnContentChanged();
}
public RecordingsChannel(ILiveTvManager liveTvManager)
{
_liveTvManager = liveTvManager;
var interval = TimeSpan.FromMinutes(15);
_updateTimer = new Timer(OnUpdateTimerCallback, null, interval, interval);
}
public void Dispose()
{
if (_updateTimer != null)
{
_updateTimer.Dispose();
_updateTimer = null;
}
}
public string Name
@@ -71,7 +99,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 +141,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
});
@@ -153,13 +181,6 @@ namespace MediaBrowser.Plugins.VuPlus
return GetService().DeleteRecordingAsync(id, cancellationToken);
}
public async Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken)
{
var result = await GetChannelItems(new InternalChannelItemQuery(), i => true, cancellationToken).ConfigureAwait(false);
return result.Items.OrderByDescending(i => i.DateCreated ?? DateTime.MinValue);
}
public Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(query.FolderId))
@@ -410,12 +431,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 +483,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 +566,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()
{