jellyfin/MediaBrowser.Dlna/Didl/Filter.cs

36 lines
915 B
C#
Raw Normal View History

2014-06-05 04:32:40 +02:00
using MediaBrowser.Model.Extensions;
using System;
2014-04-20 07:21:08 +02:00
using System.Collections.Generic;
2014-06-29 21:59:52 +02:00
using System.Linq;
2014-04-20 07:21:08 +02:00
2014-06-29 21:59:52 +02:00
namespace MediaBrowser.Dlna.Didl
2014-04-20 07:21:08 +02:00
{
public class Filter
{
private readonly List<string> _fields;
private readonly bool _all;
2014-04-23 17:35:31 +02:00
public Filter()
: this("*")
{
}
2014-04-20 07:21:08 +02:00
public Filter(string filter)
{
_all = StringHelper.EqualsIgnoreCase(filter, "*");
2014-04-20 07:21:08 +02:00
2014-06-29 21:59:52 +02:00
var list = (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
_fields = list;
2014-04-20 07:21:08 +02:00
}
public bool Contains(string field)
{
2014-06-22 07:52:31 +02:00
// Don't bother with this. Some clients (media monkey) use the filter and then don't display very well when very little data comes back.
return true;
//return _all || ListHelper.ContainsIgnoreCase(_fields, field);
2014-04-20 07:21:08 +02:00
}
}
}