From f226d94012cbe0ce0855efadc561ec4fb215fc94 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 23 Mar 2014 16:49:05 -0400 Subject: add more dlna options --- MediaBrowser.Model/Configuration/DlnaOptions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/Configuration/DlnaOptions.cs b/MediaBrowser.Model/Configuration/DlnaOptions.cs index b2503ebc7e..893e377faf 100644 --- a/MediaBrowser.Model/Configuration/DlnaOptions.cs +++ b/MediaBrowser.Model/Configuration/DlnaOptions.cs @@ -4,11 +4,13 @@ namespace MediaBrowser.Model.Configuration public class DlnaOptions { public bool EnablePlayTo { get; set; } - public bool EnablePlayToDebugLogging { get; set; } + public bool EnableDebugLogging { get; set; } + public int ClientDiscoveryIntervalSeconds { get; set; } public DlnaOptions() { EnablePlayTo = true; + ClientDiscoveryIntervalSeconds = 30; } } } -- cgit v1.2.3 From 787f5e8382af65279dfc05e0b23ac9ec874c80ad Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 23 Mar 2014 18:21:49 -0400 Subject: updated nuget --- MediaBrowser.Model/ApiClient/IApiClient.cs | 2 +- MediaBrowser.Model/Configuration/DlnaOptions.cs | 2 +- MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs | 104 +----------------------- MediaBrowser.Model/LiveTv/TimerInfoDto.cs | 92 +++++++++++---------- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 7 files changed, 58 insertions(+), 152 deletions(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 91ac67a1f7..8de54f34a9 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -1030,7 +1030,7 @@ namespace MediaBrowser.Model.ApiClient /// The timer. /// The cancellation token. /// Task. - Task CreateLiveTvTimerAsync(TimerInfoDto timer, CancellationToken cancellationToken); + Task CreateLiveTvTimerAsync(BaseTimerInfoDto timer, CancellationToken cancellationToken); /// /// Updates the live tv timer asynchronous. diff --git a/MediaBrowser.Model/Configuration/DlnaOptions.cs b/MediaBrowser.Model/Configuration/DlnaOptions.cs index 893e377faf..b6398239fa 100644 --- a/MediaBrowser.Model/Configuration/DlnaOptions.cs +++ b/MediaBrowser.Model/Configuration/DlnaOptions.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Configuration public DlnaOptions() { EnablePlayTo = true; - ClientDiscoveryIntervalSeconds = 30; + ClientDiscoveryIntervalSeconds = 60; } } } diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index 0198cc3995..393233c1bf 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -1,80 +1,14 @@ -using System; +using MediaBrowser.Model.Entities; +using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Runtime.Serialization; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.LiveTv { [DebuggerDisplay("Name = {Name}")] - public class SeriesTimerInfoDto : INotifyPropertyChanged + public class SeriesTimerInfoDto : BaseTimerInfoDto { - /// - /// Id of the recording. - /// - public string Id { get; set; } - - /// - /// Gets or sets the external identifier. - /// - /// The external identifier. - public string ExternalId { get; set; } - - /// - /// ChannelId of the recording. - /// - public string ChannelId { get; set; } - - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } - - /// - /// Gets or sets the external channel identifier. - /// - /// The external channel identifier. - public string ExternalChannelId { get; set; } - - /// - /// ChannelName of the recording. - /// - public string ChannelName { get; set; } - - /// - /// Gets or sets the program identifier. - /// - /// The program identifier. - public string ProgramId { get; set; } - - /// - /// Gets or sets the external program identifier. - /// - /// The external program identifier. - public string ExternalProgramId { get; set; } - - /// - /// Name of the recording. - /// - public string Name { get; set; } - - /// - /// Description of the recording. - /// - public string Overview { get; set; } - - /// - /// The start date of the recording, in UTC. - /// - public DateTime StartDate { get; set; } - - /// - /// The end date of the recording, in UTC. - /// - public DateTime EndDate { get; set; } - /// /// Gets or sets a value indicating whether [record any time]. /// @@ -105,36 +39,6 @@ namespace MediaBrowser.Model.LiveTv /// The day pattern. public DayPattern? DayPattern { get; set; } - /// - /// Gets or sets the priority. - /// - /// The priority. - public int Priority { get; set; } - - /// - /// Gets or sets the pre padding seconds. - /// - /// The pre padding seconds. - public int PrePaddingSeconds { get; set; } - - /// - /// Gets or sets the post padding seconds. - /// - /// The post padding seconds. - public int PostPaddingSeconds { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is pre padding required. - /// - /// true if this instance is pre padding required; otherwise, false. - public bool IsPrePaddingRequired { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is post padding required. - /// - /// true if this instance is post padding required; otherwise, false. - public bool IsPostPaddingRequired { get; set; } - /// /// Gets or sets the image tags. /// @@ -156,7 +60,5 @@ namespace MediaBrowser.Model.LiveTv ImageTags = new Dictionary(); Days = new List(); } - - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index a330f44d8e..137c957192 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -3,8 +3,47 @@ using System.ComponentModel; namespace MediaBrowser.Model.LiveTv { - public class TimerInfoDto : INotifyPropertyChanged + public class TimerInfoDto : BaseTimerInfoDto { + /// + /// Gets or sets the status. + /// + /// The status. + public RecordingStatus Status { get; set; } + + /// + /// Gets or sets the series timer identifier. + /// + /// The series timer identifier. + public string SeriesTimerId { get; set; } + + /// + /// Gets or sets the external series timer identifier. + /// + /// The external series timer identifier. + public string ExternalSeriesTimerId { get; set; } + + /// + /// Gets or sets the run time ticks. + /// + /// The run time ticks. + public long? RunTimeTicks { get; set; } + + /// + /// Gets or sets the program information. + /// + /// The program information. + public ProgramInfoDto ProgramInfo { get; set; } + + } + + public class BaseTimerInfoDto : INotifyPropertyChanged + { + /// + /// Occurs when a property value changes. + /// + public event PropertyChangedEventHandler PropertyChanged; + /// /// Id of the recording. /// @@ -26,18 +65,12 @@ namespace MediaBrowser.Model.LiveTv /// /// The external channel identifier. public string ExternalChannelId { get; set; } - + /// /// ChannelName of the recording. /// public string ChannelName { get; set; } - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } - /// /// Gets or sets the program identifier. /// @@ -49,7 +82,7 @@ namespace MediaBrowser.Model.LiveTv /// /// The external program identifier. public string ExternalProgramId { get; set; } - + /// /// Name of the recording. /// @@ -71,22 +104,16 @@ namespace MediaBrowser.Model.LiveTv public DateTime EndDate { get; set; } /// - /// Gets or sets the status. - /// - /// The status. - public RecordingStatus Status { get; set; } - - /// - /// Gets or sets the series timer identifier. + /// Gets or sets the name of the service. /// - /// The series timer identifier. - public string SeriesTimerId { get; set; } + /// The name of the service. + public string ServiceName { get; set; } /// - /// Gets or sets the external series timer identifier. + /// Gets or sets the priority. /// - /// The external series timer identifier. - public string ExternalSeriesTimerId { get; set; } + /// The priority. + public int Priority { get; set; } /// /// Gets or sets the pre padding seconds. @@ -111,28 +138,5 @@ namespace MediaBrowser.Model.LiveTv /// /// true if this instance is post padding required; otherwise, false. public bool IsPostPaddingRequired { get; set; } - - /// - /// Gets or sets the run time ticks. - /// - /// The run time ticks. - public long? RunTimeTicks { get; set; } - - /// - /// Gets or sets the priority. - /// - /// The priority. - public int Priority { get; set; } - - /// - /// Gets or sets the program information. - /// - /// The program information. - public ProgramInfoDto ProgramInfo { get; set; } - - /// - /// Occurs when a property value changes. - /// - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 12219e81dc..c550b350c6 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.343 + 3.0.345 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 495dc3f2b8..a6fa5c152c 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.343 + 3.0.345 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 398adc2079..cc87b00300 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.343 + 3.0.345 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - + -- cgit v1.2.3 From 501dedb13cd59dc2683ac4192cd11289bd304cfb Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 24 Mar 2014 08:47:39 -0400 Subject: stub out dlna server --- .../ScheduledTasksWebSocketListener.cs | 22 +- .../Net/BasePeriodicWebSocketListener.cs | 18 +- MediaBrowser.Dlna/MediaBrowser.Dlna.csproj | 9 +- MediaBrowser.Dlna/Server/DlnaServerEntryPoint.cs | 115 +++++++++ MediaBrowser.Dlna/Server/Headers.cs | 164 +++++++++++++ MediaBrowser.Dlna/Server/RawHeaders.cs | 16 ++ MediaBrowser.Dlna/Server/SsdpHandler.cs | 260 +++++++++++++++++++++ MediaBrowser.Dlna/Server/UpnpDevice.cs | 28 +++ MediaBrowser.Model/Configuration/DlnaOptions.cs | 2 + 9 files changed, 623 insertions(+), 11 deletions(-) create mode 100644 MediaBrowser.Dlna/Server/DlnaServerEntryPoint.cs create mode 100644 MediaBrowser.Dlna/Server/Headers.cs create mode 100644 MediaBrowser.Dlna/Server/RawHeaders.cs create mode 100644 MediaBrowser.Dlna/Server/SsdpHandler.cs create mode 100644 MediaBrowser.Dlna/Server/UpnpDevice.cs (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs index c143635bfa..0d3f5dfcdf 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs @@ -39,6 +39,8 @@ namespace MediaBrowser.Api.ScheduledTasks TaskManager = taskManager; } + private bool _lastResponseHadTasksRunning = true; + /// /// Gets the data to send. /// @@ -46,7 +48,25 @@ namespace MediaBrowser.Api.ScheduledTasks /// Task{IEnumerable{TaskInfo}}. protected override Task> GetDataToSend(object state) { - return Task.FromResult(TaskManager.ScheduledTasks + var tasks = TaskManager.ScheduledTasks.ToList(); + + var anyRunning = tasks.Any(i => i.State != TaskState.Idle); + + if (anyRunning) + { + _lastResponseHadTasksRunning = true; + } + else + { + if (!_lastResponseHadTasksRunning) + { + return Task.FromResult>(null); + } + + _lastResponseHadTasksRunning = false; + } + + return Task.FromResult(tasks .OrderBy(i => i.Name) .Select(ScheduledTaskHelpers.GetTaskInfo) .Where(i => !i.IsHidden)); diff --git a/MediaBrowser.Common/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Common/Net/BasePeriodicWebSocketListener.cs index 4ff34cfa12..33d3f368b6 100644 --- a/MediaBrowser.Common/Net/BasePeriodicWebSocketListener.cs +++ b/MediaBrowser.Common/Net/BasePeriodicWebSocketListener.cs @@ -1,11 +1,11 @@ -using System.Globalization; -using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Net; using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.Net; namespace MediaBrowser.Common.Net { @@ -16,6 +16,7 @@ namespace MediaBrowser.Common.Net /// The type of the T state type. public abstract class BasePeriodicWebSocketListener : IWebSocketListener, IDisposable where TStateType : class, new() + where TReturnDataType : class { /// /// The _active connections @@ -144,12 +145,15 @@ namespace MediaBrowser.Common.Net var data = await GetDataToSend(tuple.Item4).ConfigureAwait(false); - await connection.SendAsync(new WebSocketMessage + if (data != null) { - MessageType = Name, - Data = data + await connection.SendAsync(new WebSocketMessage + { + MessageType = Name, + Data = data - }, tuple.Item2.Token).ConfigureAwait(false); + }, tuple.Item2.Token).ConfigureAwait(false); + } tuple.Item5.Release(); } diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index 4eb305e0f9..bea281b614 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -98,6 +98,11 @@ + + + + + @@ -113,9 +118,7 @@ MediaBrowser.Model - - - +