mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing some issues with the crawler & most issues of the ressource editor
This commit is contained in:
parent
c084208013
commit
a6d3107329
@ -24,7 +24,7 @@ namespace Kyoo.Models
|
||||
|
||||
public bool IsMovie { get; set; }
|
||||
|
||||
public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
||||
[EditableRelation] public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore] public int? StudioID { get; set; }
|
||||
|
@ -160,16 +160,14 @@ namespace Kyoo.Controllers
|
||||
if (old == null)
|
||||
throw new ItemNotFound($"No resource found with the ID {edited.ID}.");
|
||||
|
||||
IEnumerable<NavigationEntry> relations = Database.Entry(old).Collections
|
||||
.Concat(Database.Entry(old).Navigations);
|
||||
foreach (NavigationEntry navigation in relations)
|
||||
if (navigation.Metadata.PropertyInfo.GetCustomAttribute<EditableRelation>() != null)
|
||||
foreach (NavigationEntry navigation in Database.Entry(old).Navigations)
|
||||
if (navigation.Metadata.PropertyInfo.GetCustomAttribute<EditableRelation>() != null
|
||||
&& navigation.Metadata.GetGetter().GetClrValue(edited) != default)
|
||||
await navigation.LoadAsync();
|
||||
|
||||
if (resetOld)
|
||||
Utility.Nullify(old);
|
||||
Utility.Complete(old, edited);
|
||||
// TODO Validation set values & setting values trigger a change round in the OEM. A change round should only be triggered if the item is actually different.
|
||||
await Validate(old);
|
||||
await Database.SaveChangesAsync();
|
||||
return old;
|
||||
|
@ -8,7 +8,6 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Kyoo.Models.Exceptions;
|
||||
using Kyoo.Models.Watch;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kyoo.Controllers
|
||||
@ -122,17 +121,15 @@ namespace Kyoo.Controllers
|
||||
.GroupBy(Path.GetDirectoryName)
|
||||
.ToList();
|
||||
|
||||
IEnumerable<Task> tasks = shows
|
||||
.Select(x => x.First())
|
||||
.Select(x => RegisterFile(x, x.Substring(path.Length), library, cancellationToken));
|
||||
foreach (Task[] showTasks in tasks.BatchBy(_parallelTasks))
|
||||
await Task.WhenAll(showTasks);
|
||||
IEnumerable<string> tasks = shows.Select(x => x.First());
|
||||
foreach (string[] showTasks in tasks.BatchBy(_parallelTasks))
|
||||
await Task.WhenAll(showTasks
|
||||
.Select(x => RegisterFile(x, x.Substring(path.Length), library, cancellationToken)));
|
||||
|
||||
tasks = shows
|
||||
.SelectMany(x => x.Skip(1))
|
||||
.Select(x => RegisterFile(x, x.Substring(path.Length), library, cancellationToken));
|
||||
foreach (Task[] episodeTasks in tasks.BatchBy(_parallelTasks * 2))
|
||||
await Task.WhenAll(episodeTasks);
|
||||
tasks = shows.SelectMany(x => x.Skip(1));
|
||||
foreach (string[] episodeTasks in tasks.BatchBy(_parallelTasks * 2))
|
||||
await Task.WhenAll(episodeTasks
|
||||
.Select(x => RegisterFile(x, x.Substring(path.Length), library, cancellationToken)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +230,7 @@ namespace Kyoo.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
await libraryManager.RegisterShow(show);
|
||||
show = await libraryManager.RegisterShow(show);
|
||||
}
|
||||
catch (DuplicatedItemException)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user