update naming project

This commit is contained in:
Luke Pulverenti 2015-05-10 00:29:04 -04:00
parent 0a62c66685
commit 1e7b3af9c2
9 changed files with 76 additions and 15 deletions

View File

@ -11,6 +11,7 @@ namespace MediaBrowser.Dlna.Profiles
Name = "WDTV Live"; Name = "WDTV Live";
TimelineOffsetSeconds = 5; TimelineOffsetSeconds = 5;
IgnoreTranscodeByteRangeRequests = true;
Identification = new DeviceIdentification Identification = new DeviceIdentification
{ {

View File

@ -118,10 +118,7 @@ namespace MediaBrowser.Dlna.Ssdp
public void Start() public void Start()
{ {
_socket = CreateMulticastSocket(); RestartSocketListener();
_logger.Info("SSDP service started");
Receive();
ReloadAliveNotifier(); ReloadAliveNotifier();
} }
@ -289,6 +286,56 @@ namespace MediaBrowser.Dlna.Ssdp
} }
} }
private void RestartSocketListener()
{
if (_isDisposed)
{
StopSocketRetryTimer();
return;
}
try
{
_socket = CreateMulticastSocket();
_logger.Info("MultiCast socket created");
StopSocketRetryTimer();
Receive();
}
catch (Exception ex)
{
_logger.ErrorException("Error creating MultiCast socket", ex);
//StartSocketRetryTimer();
}
}
private Timer _socketRetryTimer;
private readonly object _socketRetryLock = new object();
private void StartSocketRetryTimer()
{
lock (_socketRetryLock)
{
if (_socketRetryTimer == null)
{
_socketRetryTimer = new Timer(s => RestartSocketListener(), null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));
}
}
}
private void StopSocketRetryTimer()
{
lock (_socketRetryLock)
{
if (_socketRetryTimer != null)
{
_socketRetryTimer.Dispose();
_socketRetryTimer = null;
}
}
}
private void Receive() private void Receive()
{ {
try try
@ -297,10 +344,15 @@ namespace MediaBrowser.Dlna.Ssdp
EndPoint endpoint = new IPEndPoint(IPAddress.Any, SSDPPort); EndPoint endpoint = new IPEndPoint(IPAddress.Any, SSDPPort);
_socket.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref endpoint, ReceiveCallback, buffer); _socket.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref endpoint, ReceiveCallback,
buffer);
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
if (!_isDisposed)
{
//StartSocketRetryTimer();
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -348,6 +400,13 @@ namespace MediaBrowser.Dlna.Ssdp
OnMessageReceived(args); OnMessageReceived(args);
} }
catch (ObjectDisposedException)
{
if (!_isDisposed)
{
//StartSocketRetryTimer();
}
}
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException("Failed to read SSDP message", ex); _logger.ErrorException("Failed to read SSDP message", ex);

View File

@ -38,7 +38,7 @@ namespace MediaBrowser.MediaEncoding.Probing
var internalStreams = data.streams ?? new MediaStreamInfo[] { }; var internalStreams = data.streams ?? new MediaStreamInfo[] { };
info.MediaStreams = internalStreams.Select(s => GetMediaStream(s, data.format)) info.MediaStreams = internalStreams.Select(s => GetMediaStream(isAudio, s, data.format))
.Where(i => i != null) .Where(i => i != null)
.ToList(); .ToList();
@ -94,7 +94,7 @@ namespace MediaBrowser.MediaEncoding.Probing
/// <param name="streamInfo">The stream info.</param> /// <param name="streamInfo">The stream info.</param>
/// <param name="formatInfo">The format info.</param> /// <param name="formatInfo">The format info.</param>
/// <returns>MediaStream.</returns> /// <returns>MediaStream.</returns>
private MediaStream GetMediaStream(MediaStreamInfo streamInfo, MediaFormatInfo formatInfo) private MediaStream GetMediaStream(bool isAudio, MediaStreamInfo streamInfo, MediaFormatInfo formatInfo)
{ {
var stream = new MediaStream var stream = new MediaStream
{ {
@ -129,7 +129,7 @@ namespace MediaBrowser.MediaEncoding.Probing
} }
else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase)) else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase))
{ {
stream.Type = (streamInfo.codec_name ?? string.Empty).IndexOf("mjpeg", StringComparison.OrdinalIgnoreCase) != -1 stream.Type = isAudio
? MediaStreamType.EmbeddedImage ? MediaStreamType.EmbeddedImage
: MediaStreamType.Video; : MediaStreamType.Video;

View File

@ -76,6 +76,7 @@ namespace MediaBrowser.Model.Dlna
public bool RequiresPlainFolders { get; set; } public bool RequiresPlainFolders { get; set; }
public bool EnableMSMediaReceiverRegistrar { get; set; } public bool EnableMSMediaReceiverRegistrar { get; set; }
public bool IgnoreTranscodeByteRangeRequests { get; set; }
public XmlAttribute[] XmlRootAttributes { get; set; } public XmlAttribute[] XmlRootAttributes { get; set; }

View File

@ -52,7 +52,7 @@ namespace MediaBrowser.Providers.MediaInfo
return ItemUpdateType.MetadataImport; return ItemUpdateType.MetadataImport;
} }
private const string SchemaVersion = "2"; private const string SchemaVersion = "3";
private async Task<Model.MediaInfo.MediaInfo> GetMediaInfo(BaseItem item, CancellationToken cancellationToken) private async Task<Model.MediaInfo.MediaInfo> GetMediaInfo(BaseItem item, CancellationToken cancellationToken)
{ {

View File

@ -17,7 +17,6 @@ using MediaBrowser.Model.Querying;
using MoreLinq; using MoreLinq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;

View File

@ -48,8 +48,9 @@
<Reference Include="Interfaces.IO"> <Reference Include="Interfaces.IO">
<HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath> <HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
</Reference> </Reference>
<Reference Include="MediaBrowser.Naming"> <Reference Include="MediaBrowser.Naming, Version=1.0.5607.1779, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.35\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.36\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mono.Nat, Version=1.2.24.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Mono.Nat, Version=1.2.24.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" /> <package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
<package id="MediaBrowser.Naming" version="1.0.0.35" targetFramework="net45" /> <package id="MediaBrowser.Naming" version="1.0.0.36" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" /> <package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
<package id="morelinq" version="1.1.0" targetFramework="net45" /> <package id="morelinq" version="1.1.0" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" /> <package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
//[assembly: AssemblyVersion("3.0.*")] [assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyVersion("3.0.5607.0")] //[assembly: AssemblyVersion("3.0.5607.0")]