mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-13 13:52:16 +01:00
update active recordings
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Rssdp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Net;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Rssdp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace Rssdp.Infrastructure
|
||||
/// Returns an enumerable set of strings, each one being a description of an invalid property on the specified root device.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param>
|
||||
System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpRootDevice device);
|
||||
System.Collections.Generic.List<string> GetValidationErrors(SsdpRootDevice device);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerable set of strings, each one being a description of an invalid property on the specified device.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="SsdpDevice"/> to validate.</param>
|
||||
System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpDevice device);
|
||||
System.Collections.Generic.List<string> GetValidationErrors(SsdpDevice device);
|
||||
|
||||
/// <summary>
|
||||
/// Validates the specified device and throws an <see cref="System.InvalidOperationException"/> if there are any validation errors.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace Rssdp.Infrastructure
|
||||
|
||||
if (_enableMultiSocketBinding)
|
||||
{
|
||||
foreach (var address in _networkManager.GetLocalIpAddresses().ToList())
|
||||
foreach (var address in _networkManager.GetLocalIpAddresses())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
@@ -283,7 +282,7 @@ namespace Rssdp
|
||||
/// </summary>
|
||||
/// <seealso cref="AddDevice"/>
|
||||
/// <seealso cref="RemoveDevice"/>
|
||||
public IEnumerable<SsdpDevice> Devices
|
||||
public IList<SsdpDevice> Devices
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
@@ -466,7 +465,7 @@ namespace Rssdp
|
||||
|
||||
private static void WriteIcons(XmlWriter writer, SsdpDevice device)
|
||||
{
|
||||
if (device.Icons.Any())
|
||||
if (device.Icons.Count > 0)
|
||||
{
|
||||
writer.WriteStartElement("iconList");
|
||||
|
||||
@@ -489,7 +488,7 @@ namespace Rssdp
|
||||
|
||||
private void WriteChildDevices(XmlWriter writer, SsdpDevice parentDevice)
|
||||
{
|
||||
if (parentDevice.Devices.Any())
|
||||
if (parentDevice.Devices.Count > 0)
|
||||
{
|
||||
writer.WriteStartElement("deviceList");
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Rssdp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,17 +543,9 @@ namespace Rssdp.Infrastructure
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<DiscoveredSsdpDevice> GetUnexpiredDevices()
|
||||
{
|
||||
lock (_Devices)
|
||||
{
|
||||
return (from device in _Devices where !device.IsExpired() select device).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private bool DeviceDied(string deviceUsn, bool expired)
|
||||
{
|
||||
IEnumerable<DiscoveredSsdpDevice> existingDevices = null;
|
||||
List<DiscoveredSsdpDevice> existingDevices = null;
|
||||
lock (_Devices)
|
||||
{
|
||||
existingDevices = FindExistingDeviceNotifications(_Devices, deviceUsn);
|
||||
@@ -565,7 +557,7 @@ namespace Rssdp.Infrastructure
|
||||
}
|
||||
}
|
||||
|
||||
if (existingDevices != null && existingDevices.Any())
|
||||
if (existingDevices != null && existingDevices.Count > 0)
|
||||
{
|
||||
foreach (var removedDevice in existingDevices)
|
||||
{
|
||||
@@ -591,12 +583,29 @@ namespace Rssdp.Infrastructure
|
||||
|
||||
private static DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn)
|
||||
{
|
||||
return (from d in devices where d.NotificationType == notificationType && d.Usn == usn select d).FirstOrDefault();
|
||||
foreach (var d in devices)
|
||||
{
|
||||
if (d.NotificationType == notificationType && d.Usn == usn)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static IEnumerable<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
|
||||
private static List<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
|
||||
{
|
||||
return (from d in devices where d.Usn == usn select d).ToArray();
|
||||
var list = new List<DiscoveredSsdpDevice>();
|
||||
|
||||
foreach (var d in devices)
|
||||
{
|
||||
if (d.Usn == usn)
|
||||
{
|
||||
list.Add(d);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Rssdp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Rssdp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Rssdp.Infrastructure;
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace Rssdp.Infrastructure
|
||||
/// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param>
|
||||
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
|
||||
/// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns>
|
||||
public IEnumerable<string> GetValidationErrors(SsdpRootDevice device)
|
||||
public List<string> GetValidationErrors(SsdpRootDevice device)
|
||||
{
|
||||
if (device == null) throw new ArgumentNullException("device");
|
||||
|
||||
var retVal = GetValidationErrors((SsdpDevice)device) as IList<string>;
|
||||
var retVal = GetValidationErrors((SsdpDevice)device);
|
||||
|
||||
if (device.Location == null)
|
||||
retVal.Add("Location cannot be null.");
|
||||
@@ -49,7 +49,7 @@ namespace Rssdp.Infrastructure
|
||||
/// <param name="device">The <see cref="SsdpDevice"/> to validate.</param>
|
||||
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
|
||||
/// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns>
|
||||
public IEnumerable<string> GetValidationErrors(SsdpDevice device)
|
||||
public List<string> GetValidationErrors(SsdpDevice device)
|
||||
{
|
||||
if (device == null) throw new ArgumentNullException("device");
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Rssdp.Infrastructure
|
||||
if (String.IsNullOrEmpty(device.ModelName))
|
||||
retVal.Add("ModelName is required.");
|
||||
|
||||
if (device.Icons.Any())
|
||||
if (device.Icons.Count > 0)
|
||||
ValidateIcons(device, retVal);
|
||||
|
||||
ValidateChildDevices(device, retVal);
|
||||
@@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure
|
||||
public void ThrowIfDeviceInvalid(SsdpDevice device)
|
||||
{
|
||||
var errors = this.GetValidationErrors(device);
|
||||
if (errors != null && errors.Any()) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors));
|
||||
if (errors != null && errors.Count > 0) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user