mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Merge pull request #1435 from softworkz/SeriesDetectionV2
Auto-Organize - Feature to remember/persist series matching in manual organization dialog: Changed to match against plain library name instead of library item GUID.
This commit is contained in:
commit
61ac8151ff
4 changed files with 12 additions and 15 deletions
|
@ -78,8 +78,8 @@ namespace MediaBrowser.Controller.FileOrganization
|
|||
/// <summary>
|
||||
/// Deletes a smart match entry.
|
||||
/// </summary>
|
||||
/// <param name="Id">Item Id.</param>
|
||||
/// <param name="ItemName">Item name.</param>
|
||||
/// <param name="matchString">The match string to delete.</param>
|
||||
void DeleteSmartMatchEntry(string Id, string matchString);
|
||||
void DeleteSmartMatchEntry(string ItemName, string matchString);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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<Series>()
|
||||
.FirstOrDefault(i => string.Equals(i.Id.ToString("N"), info.Id));
|
||||
.FirstOrDefault(i => string.Equals(i.Name, info.ItemName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue