dlna server fixes

This commit is contained in:
Luke Pulverenti
2014-04-20 01:21:08 -04:00
parent a5b3ab9fc5
commit 247400717e
42 changed files with 596 additions and 148 deletions

View File

@@ -6,13 +6,18 @@ namespace MediaBrowser.Model.Configuration
public bool EnablePlayTo { get; set; }
public bool EnableServer { get; set; }
public bool EnableDebugLogging { get; set; }
public bool BlastAliveMessages { get; set; }
public int ClientDiscoveryIntervalSeconds { get; set; }
public int BlastAliveMessageIntervalSeconds { get; set; }
public string DefaultUserId { get; set; }
public DlnaOptions()
{
EnablePlayTo = true;
EnableServer = true;
BlastAliveMessages = true;
ClientDiscoveryIntervalSeconds = 60;
BlastAliveMessageIntervalSeconds = 60;
}
}
}

View File

@@ -40,6 +40,8 @@ namespace MediaBrowser.Model.Dlna
public string SupportedMediaTypes { get; set; }
public string UserId { get; set; }
/// <summary>
/// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.
/// </summary>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Model.Dlna
{
public class Filter
{
private readonly List<string> _fields;
private readonly bool _all;
public Filter(string filter)
{
_all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
_fields = (filter ?? string.Empty)
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.ToList();
}
public bool Contains(string field)
{
return _all || _fields.Contains(field, StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
namespace MediaBrowser.Model.Dlna
{
public class SearchCriteria
{
public SearchType SearchType { get; set; }
public SearchCriteria(string search)
{
if (string.IsNullOrEmpty(search))
{
throw new ArgumentNullException("search");
}
SearchType = SearchType.Unknown;
if (search.IndexOf("upnp:class", StringComparison.OrdinalIgnoreCase) != -1 &&
search.IndexOf("derivedfrom", StringComparison.OrdinalIgnoreCase) != -1)
{
if (search.IndexOf("object.item.audioItem", StringComparison.OrdinalIgnoreCase) != -1)
{
SearchType = SearchType.Audio;
}
else if (search.IndexOf("object.item.imageItem", StringComparison.OrdinalIgnoreCase) != -1)
{
SearchType = SearchType.Image;
}
else if (search.IndexOf("object.item.videoItem", StringComparison.OrdinalIgnoreCase) != -1)
{
SearchType = SearchType.Video;
}
else if (search.IndexOf("object.container.playlistContainer", StringComparison.OrdinalIgnoreCase) != -1)
{
SearchType = SearchType.Playlist;
}
}
}
}
public enum SearchType
{
Unknown = 0,
Audio = 1,
Image = 2,
Video = 3,
Playlist = 4
}
}

View File

@@ -0,0 +1,11 @@

namespace MediaBrowser.Model.Dlna
{
public class SortCriteria
{
public SortCriteria(string value)
{
}
}
}

View File

@@ -73,9 +73,12 @@
<Compile Include="Dlna\DeviceProfileInfo.cs" />
<Compile Include="Dlna\DirectPlayProfile.cs" />
<Compile Include="Dlna\DlnaMaps.cs" />
<Compile Include="Dlna\Filter.cs" />
<Compile Include="Dlna\MediaFormatProfile.cs" />
<Compile Include="Dlna\MediaFormatProfileResolver.cs" />
<Compile Include="Dlna\ResponseProfile.cs" />
<Compile Include="Dlna\SearchCriteria.cs" />
<Compile Include="Dlna\SortCriteria.cs" />
<Compile Include="Dlna\StreamBuilder.cs" />
<Compile Include="Dlna\StreamInfo.cs" />
<Compile Include="Dlna\TranscodingProfile.cs" />