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. --- .../Library/FileOrganizationService.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'MediaBrowser.Api/Library/FileOrganizationService.cs') diff --git a/MediaBrowser.Api/Library/FileOrganizationService.cs b/MediaBrowser.Api/Library/FileOrganizationService.cs index 29a982629..a08cc099e 100644 --- a/MediaBrowser.Api/Library/FileOrganizationService.cs +++ b/MediaBrowser.Api/Library/FileOrganizationService.cs @@ -74,6 +74,34 @@ namespace MediaBrowser.Api.Library public bool RememberCorrection { get; set; } } + [Route("/Library/FileOrganizationSmartMatch", "GET", Summary = "Gets smart match entries")] + public class GetSmartMatchInfos : IReturn> + { + /// + /// Skips over a given number of items within the results. Use for paging. + /// + /// The start index. + [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? StartIndex { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? Limit { get; set; } + } + + [Route("/Library/FileOrganizationSmartMatch/{Id}/Delete", "POST", Summary = "Deletes a smart match entry")] + public class DeleteSmartMatchEntry + { + [ApiMember(Name = "Id", Description = "Item ID", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] + public string Id { get; set; } + + [ApiMember(Name = "MatchString", Description = "SmartMatch String", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] + public string MatchString { get; set; } + } + [Authenticated(Roles = "Admin")] public class FileOrganizationService : BaseApiService { @@ -130,5 +158,21 @@ namespace MediaBrowser.Api.Library Task.WaitAll(task); } + + public object Get(GetSmartMatchInfos request) + { + var result = _iFileOrganizationService.GetSmartMatchInfos(new FileOrganizationResultQuery + { + Limit = request.Limit, + StartIndex = request.StartIndex + }); + + return ToOptimizedSerializedResultUsingCache(result); + } + + public void Post(DeleteSmartMatchEntry request) + { + _iFileOrganizationService.DeleteSmartMatchEntry(request.Id, request.MatchString); + } } } -- cgit v1.2.3 From 2247cd87949d4b6909510c7bf629b900fd322a8f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 Feb 2016 12:13:38 -0500 Subject: update auto-organize --- MediaBrowser.Api/Library/FileOrganizationService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Api/Library/FileOrganizationService.cs') diff --git a/MediaBrowser.Api/Library/FileOrganizationService.cs b/MediaBrowser.Api/Library/FileOrganizationService.cs index a08cc099e..c45552baa 100644 --- a/MediaBrowser.Api/Library/FileOrganizationService.cs +++ b/MediaBrowser.Api/Library/FileOrganizationService.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Api.Library public bool RememberCorrection { get; set; } } - [Route("/Library/FileOrganizationSmartMatch", "GET", Summary = "Gets smart match entries")] + [Route("/Library/FileOrganizations/SmartMatches", "GET", Summary = "Gets smart match entries")] public class GetSmartMatchInfos : IReturn> { /// @@ -92,13 +92,13 @@ namespace MediaBrowser.Api.Library public int? Limit { get; set; } } - [Route("/Library/FileOrganizationSmartMatch/{Id}/Delete", "POST", Summary = "Deletes a smart match entry")] + [Route("/Library/FileOrganizations/SmartMatches", "DELETE", Summary = "Deletes a smart match entry")] public class DeleteSmartMatchEntry { - [ApiMember(Name = "Id", Description = "Item ID", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public string Id { get; set; } + [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Name { get; set; } - [ApiMember(Name = "MatchString", Description = "SmartMatch String", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] + [ApiMember(Name = "MatchString", Description = "SmartMatch String", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")] public string MatchString { get; set; } } @@ -172,7 +172,7 @@ namespace MediaBrowser.Api.Library public void Post(DeleteSmartMatchEntry request) { - _iFileOrganizationService.DeleteSmartMatchEntry(request.Id, request.MatchString); + _iFileOrganizationService.DeleteSmartMatchEntry(request.Name, request.MatchString); } } } -- cgit v1.2.3 From 2bd49a779b6b519cd20b273fcfd2fc4471a3bd4f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Feb 2016 01:19:28 -0500 Subject: update delete smart match entry --- MediaBrowser.Api/Library/FileOrganizationService.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'MediaBrowser.Api/Library/FileOrganizationService.cs') diff --git a/MediaBrowser.Api/Library/FileOrganizationService.cs b/MediaBrowser.Api/Library/FileOrganizationService.cs index c45552baa..36a9af772 100644 --- a/MediaBrowser.Api/Library/FileOrganizationService.cs +++ b/MediaBrowser.Api/Library/FileOrganizationService.cs @@ -1,9 +1,11 @@ -using MediaBrowser.Controller.FileOrganization; +using System.Collections.Generic; +using MediaBrowser.Controller.FileOrganization; using MediaBrowser.Controller.Net; using MediaBrowser.Model.FileOrganization; using MediaBrowser.Model.Querying; using ServiceStack; using System.Threading.Tasks; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Api.Library { @@ -95,11 +97,8 @@ namespace MediaBrowser.Api.Library [Route("/Library/FileOrganizations/SmartMatches", "DELETE", Summary = "Deletes a smart match entry")] public class DeleteSmartMatchEntry { - [ApiMember(Name = "Name", Description = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public string Name { get; set; } - - [ApiMember(Name = "MatchString", Description = "SmartMatch String", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")] - public string MatchString { get; set; } + [ApiMember(Name = "Entries", Description = "SmartMatch Entry", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")] + public List Entries { get; set; } } [Authenticated(Roles = "Admin")] @@ -172,7 +171,10 @@ namespace MediaBrowser.Api.Library public void Post(DeleteSmartMatchEntry request) { - _iFileOrganizationService.DeleteSmartMatchEntry(request.Name, request.MatchString); + request.Entries.ForEach(entry => + { + _iFileOrganizationService.DeleteSmartMatchEntry(entry.Name, entry.Value); + }); } } } -- cgit v1.2.3 From d48ba8dbc1e875558f2f5f79aad8f62407054cb7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Feb 2016 01:39:23 -0500 Subject: update smart match tab --- MediaBrowser.Api/Library/FileOrganizationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Api/Library/FileOrganizationService.cs') diff --git a/MediaBrowser.Api/Library/FileOrganizationService.cs b/MediaBrowser.Api/Library/FileOrganizationService.cs index 36a9af772..1224fa957 100644 --- a/MediaBrowser.Api/Library/FileOrganizationService.cs +++ b/MediaBrowser.Api/Library/FileOrganizationService.cs @@ -94,10 +94,10 @@ namespace MediaBrowser.Api.Library public int? Limit { get; set; } } - [Route("/Library/FileOrganizations/SmartMatches", "DELETE", Summary = "Deletes a smart match entry")] + [Route("/Library/FileOrganizations/SmartMatches/Delete", "POST", Summary = "Deletes a smart match entry")] public class DeleteSmartMatchEntry { - [ApiMember(Name = "Entries", Description = "SmartMatch Entry", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")] + [ApiMember(Name = "Entries", Description = "SmartMatch Entry", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] public List Entries { get; set; } } -- cgit v1.2.3