From 3a868e28b3e3d9f0a13fc38c680047010d627b0f Mon Sep 17 00:00:00 2001 From: softworkz Date: Wed, 23 Sep 2015 06:12:46 +0200 Subject: Auto-Organize: Added feature to remember/persist series matching in manual organization dialog #2 When a filename cannot be auto-matched to an existing series name, the organization must be performed manually. Unfortunately not just once, but again and again for each episode coming in. This change proposes a simple but solid method to optionally persist the matching condition from within the manual organization dialog. This approach will make Emby "learn" how to organize files in the future without user interaction. --- .../FileOrganization/IFileOrganizationService.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'MediaBrowser.Controller/FileOrganization') diff --git a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs index ff22b0cdc..8d7f4e117 100644 --- a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs +++ b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs @@ -67,5 +67,19 @@ namespace MediaBrowser.Controller.FileOrganization /// The cancellation token. /// Task. Task SaveResult(FileOrganizationResult result, CancellationToken cancellationToken); + + /// + /// Returns a list of smart match entries + /// + /// The query. + /// IEnumerable{SmartMatchInfo}. + QueryResult GetSmartMatchInfos(FileOrganizationResultQuery query); + + /// + /// Deletes a smart match entry. + /// + /// Item Id. + /// The match string to delete. + void DeleteSmartMatchEntry(string Id, string matchString); } } -- cgit v1.2.3 From 59c9081f4b25b96f7cc9203a319ad19328651772 Mon Sep 17 00:00:00 2001 From: softworkz Date: Mon, 8 Feb 2016 02:25:10 +0100 Subject: Auto-Organize - Feature to remember/persist series matching in manual organization dialog: Changed to match against plain library name inste --- .../FileOrganization/IFileOrganizationService.cs | 4 ++-- MediaBrowser.Model/FileOrganization/SmartMatchInfo.cs | 4 ++-- .../FileOrganization/EpisodeFileOrganizer.cs | 9 ++++----- .../FileOrganization/FileOrganizationService.cs | 10 ++++------ 4 files changed, 12 insertions(+), 15 deletions(-) (limited to 'MediaBrowser.Controller/FileOrganization') diff --git a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs index 8d7f4e117..daa670d83 100644 --- a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs +++ b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs @@ -78,8 +78,8 @@ namespace MediaBrowser.Controller.FileOrganization /// /// Deletes a smart match entry. /// - /// Item Id. + /// Item name. /// The match string to delete. - void DeleteSmartMatchEntry(string Id, string matchString); + void DeleteSmartMatchEntry(string ItemName, string matchString); } } diff --git a/MediaBrowser.Model/FileOrganization/SmartMatchInfo.cs b/MediaBrowser.Model/FileOrganization/SmartMatchInfo.cs index a6bc66e49..28c99b89b 100644 --- a/MediaBrowser.Model/FileOrganization/SmartMatchInfo.cs +++ b/MediaBrowser.Model/FileOrganization/SmartMatchInfo.cs @@ -3,8 +3,8 @@ namespace MediaBrowser.Model.FileOrganization { public class SmartMatchInfo { - public string Id { get; set; } - public string Name { get; set; } + public string ItemName { get; set; } + public string DisplayName { get; set; } public FileOrganizerType OrganizerType { get; set; } public string[] MatchStrings { get; set; } diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs index 6509b016a..bbbdcd4b3 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs @@ -301,15 +301,14 @@ namespace MediaBrowser.Server.Implementations.FileOrganization private void SaveSmartMatchString(string matchString, Series series, AutoOrganizeOptions options) { - var seriesIdString = series.Id.ToString("N"); - SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.Id, seriesIdString)); + SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.ItemName, series.Name)); if (info == null) { info = new SmartMatchInfo(); - info.Id = series.Id.ToString("N"); + info.ItemName = series.Name; info.OrganizerType = FileOrganizerType.Episode; - info.Name = series.Name; + info.DisplayName = series.Name; var list = options.SmartMatchInfos.ToList(); list.Add(info); options.SmartMatchInfos = list.ToArray(); @@ -499,7 +498,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization series = _libraryManager.RootFolder .GetRecursiveChildren(i => i is Series) .Cast() - .FirstOrDefault(i => string.Equals(i.Id.ToString("N"), info.Id)); + .FirstOrDefault(i => string.Equals(i.Name, info.ItemName)); } } diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs index ce388bd8e..cf1387b0e 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs @@ -149,13 +149,11 @@ namespace MediaBrowser.Server.Implementations.FileOrganization }; } - public void DeleteSmartMatchEntry(string IdString, string matchString) + public void DeleteSmartMatchEntry(string itemName, string matchString) { - Guid Id; - - if (!Guid.TryParse(IdString, out Id)) + if (string.IsNullOrEmpty(itemName)) { - throw new ArgumentNullException("Id"); + throw new ArgumentNullException("itemName"); } if (string.IsNullOrEmpty(matchString)) @@ -165,7 +163,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization var options = GetAutoOrganizeptions(); - SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.Id, IdString)); + SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.ItemName, itemName)); if (info != null && info.MatchStrings.Contains(matchString)) { -- cgit v1.2.3