diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-02-07 00:15:26 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-02-07 00:15:26 -0500 |
| commit | 0e49ccfd077bf114a2a663249d81a2891c46639d (patch) | |
| tree | bdd85319f0a705d4fdfe5fec8c37a4b5361b14e6 /MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs | |
| parent | b398b4eaabad357027dbcf2a210edcada8a984fd (diff) | |
update smart match feature
Diffstat (limited to 'MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs index 3dd6a9be0..ce388bd8e 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs @@ -140,12 +140,12 @@ namespace MediaBrowser.Server.Implementations.FileOrganization var options = GetAutoOrganizeptions(); - var items = options.SmartMatchInfos.Skip(query.StartIndex ?? 0).Take(query.Limit ?? Int32.MaxValue); + var items = options.SmartMatchInfos.Skip(query.StartIndex ?? 0).Take(query.Limit ?? Int32.MaxValue).ToArray(); return new QueryResult<SmartMatchInfo>() { - Items = items.ToArray(), - TotalRecordCount = items.Count() + Items = items, + TotalRecordCount = options.SmartMatchInfos.Length }; } @@ -165,14 +165,19 @@ namespace MediaBrowser.Server.Implementations.FileOrganization var options = GetAutoOrganizeptions(); - SmartMatchInfo info = options.SmartMatchInfos.Find(i => i.Id == Id); + SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.Id, IdString)); if (info != null && info.MatchStrings.Contains(matchString)) { - info.MatchStrings.Remove(matchString); - if (info.MatchStrings.Count == 0) + var list = info.MatchStrings.ToList(); + list.Remove(matchString); + info.MatchStrings = list.ToArray(); + + if (info.MatchStrings.Length == 0) { - options.SmartMatchInfos.Remove(info); + var infos = options.SmartMatchInfos.ToList(); + infos.Remove(info); + options.SmartMatchInfos = infos.ToArray(); } _config.SaveAutoOrganizeOptions(options); |
