jellyfin/MediaBrowser.Model/Dlna/SearchCriteria.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2014-04-20 05:21:08 +00:00
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;
}
}
}
}
}