commit
bb306606f8
|
@ -7,6 +7,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -91,6 +92,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
|
||||||
public DateTime DateLastActivity { get; private set; }
|
public DateTime DateLastActivity { get; private set; }
|
||||||
|
public Action OnDeviceUnavailable { get; set; }
|
||||||
|
|
||||||
public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config)
|
public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config)
|
||||||
{
|
{
|
||||||
|
@ -134,6 +136,9 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
private async void RefreshVolume()
|
private async void RefreshVolume()
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await GetVolume().ConfigureAwait(false);
|
await GetVolume().ConfigureAwait(false);
|
||||||
|
@ -149,6 +154,9 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
private bool _timerActive;
|
private bool _timerActive;
|
||||||
private void RestartTimer()
|
private void RestartTimer()
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_timerActive)
|
if (!_timerActive)
|
||||||
{
|
{
|
||||||
lock (_timerLock)
|
lock (_timerLock)
|
||||||
|
@ -169,6 +177,9 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void RestartTimerInactive()
|
private void RestartTimerInactive()
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_timerActive)
|
if (_timerActive)
|
||||||
{
|
{
|
||||||
lock (_timerLock)
|
lock (_timerLock)
|
||||||
|
@ -398,6 +409,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
#region Get data
|
#region Get data
|
||||||
|
|
||||||
private int _successiveStopCount;
|
private int _successiveStopCount;
|
||||||
|
private int _connectFailureCount;
|
||||||
private async void TimerCallback(object sender)
|
private async void TimerCallback(object sender)
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed)
|
||||||
|
@ -435,6 +447,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_connectFailureCount = 0;
|
||||||
|
|
||||||
if (_disposed)
|
if (_disposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -455,8 +469,33 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name);
|
||||||
|
|
||||||
|
_successiveStopCount++;
|
||||||
|
_connectFailureCount++;
|
||||||
|
|
||||||
|
if (_successiveStopCount >= maxSuccessiveStopReturns)
|
||||||
|
{
|
||||||
|
RestartTimerInactive();
|
||||||
|
}
|
||||||
|
if (_connectFailureCount >= maxSuccessiveStopReturns)
|
||||||
|
{
|
||||||
|
if (OnDeviceUnavailable != null)
|
||||||
|
{
|
||||||
|
OnDeviceUnavailable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name);
|
_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name);
|
||||||
|
|
||||||
_successiveStopCount++;
|
_successiveStopCount++;
|
||||||
|
|
|
@ -103,11 +103,25 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_device.PlaybackProgress += _device_PlaybackProgress;
|
_device.PlaybackProgress += _device_PlaybackProgress;
|
||||||
_device.PlaybackStopped += _device_PlaybackStopped;
|
_device.PlaybackStopped += _device_PlaybackStopped;
|
||||||
_device.MediaChanged += _device_MediaChanged;
|
_device.MediaChanged += _device_MediaChanged;
|
||||||
|
_device.OnDeviceUnavailable = OnDeviceUnavailable;
|
||||||
|
|
||||||
_device.Start();
|
_device.Start();
|
||||||
|
|
||||||
_deviceDiscovery.DeviceLeft += _deviceDiscovery_DeviceLeft;
|
_deviceDiscovery.DeviceLeft += _deviceDiscovery_DeviceLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDeviceUnavailable()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_sessionManager.ReportSessionEnded(_session.Id);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Could throw if the session is already gone
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _deviceDiscovery_DeviceLeft(object sender, SsdpMessageEventArgs e)
|
void _deviceDiscovery_DeviceLeft(object sender, SsdpMessageEventArgs e)
|
||||||
{
|
{
|
||||||
string nts;
|
string nts;
|
||||||
|
@ -125,14 +139,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1 ||
|
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1)
|
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
try
|
OnDeviceUnavailable();
|
||||||
{
|
|
||||||
_sessionManager.ReportSessionEnded(_session.Id);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Could throw if the session is already gone
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,6 +654,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_device.PlaybackStopped -= _device_PlaybackStopped;
|
_device.PlaybackStopped -= _device_PlaybackStopped;
|
||||||
_device.MediaChanged -= _device_MediaChanged;
|
_device.MediaChanged -= _device_MediaChanged;
|
||||||
_deviceDiscovery.DeviceLeft -= _deviceDiscovery_DeviceLeft;
|
_deviceDiscovery.DeviceLeft -= _deviceDiscovery_DeviceLeft;
|
||||||
|
_device.OnDeviceUnavailable = null;
|
||||||
|
|
||||||
_device.Dispose();
|
_device.Dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,11 @@
|
||||||
public class LibraryOptions
|
public class LibraryOptions
|
||||||
{
|
{
|
||||||
public bool EnableArchiveMediaFiles { get; set; }
|
public bool EnableArchiveMediaFiles { get; set; }
|
||||||
|
public bool EnablePhotos { get; set; }
|
||||||
|
|
||||||
|
public LibraryOptions()
|
||||||
|
{
|
||||||
|
EnablePhotos = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
if (item.IsFolder)
|
if (item.IsFolder)
|
||||||
{
|
{
|
||||||
if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel))
|
if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel) && !(item is AggregateFolder))
|
||||||
{
|
{
|
||||||
if (item.SourceType != SourceType.Library)
|
if (item.SourceType != SourceType.Library)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,8 +34,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||||
// Must be an image file within a photo collection
|
// Must be an image file within a photo collection
|
||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) ||
|
||||||
string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
|
(string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos))
|
||||||
{
|
{
|
||||||
if (IsImageFile(args.Path, _imageProcessor))
|
if (IsImageFile(args.Path, _imageProcessor))
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,6 +101,12 @@
|
||||||
<Content Include="dashboard-ui\autoorganizesmart.html">
|
<Content Include="dashboard-ui\autoorganizesmart.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\components\appfooter\appfooter.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\components\appfooter\appfooter.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\components\apphost.js">
|
<Content Include="dashboard-ui\components\apphost.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user