Solving a bug with collections

This commit is contained in:
Zoe Roux 2020-01-27 23:38:35 +01:00
parent 994992c9aa
commit e8510a55c0
2 changed files with 4 additions and 2 deletions

View File

@ -149,7 +149,6 @@ namespace Kyoo.Controllers
if (!libraryManager.IsCollectionRegistered(Utility.ToSlug(collectionName), out long collectionID)) if (!libraryManager.IsCollectionRegistered(Utility.ToSlug(collectionName), out long collectionID))
{ {
Collection collection = await metadataProvider.GetCollectionFromName(collectionName, library); Collection collection = await metadataProvider.GetCollectionFromName(collectionName, library);
collection.Name = collection.Name ?? collectionName;
collectionID = libraryManager.RegisterCollection(collection); collectionID = libraryManager.RegisterCollection(collection);
} }
libraryManager.AddShowToCollection(showID, collectionID); libraryManager.AddShowToCollection(showID, collectionID);

View File

@ -53,7 +53,10 @@ namespace Kyoo.Controllers
public async Task<Collection> GetCollectionFromName(string name, Library library) public async Task<Collection> GetCollectionFromName(string name, Library library)
{ {
return await GetMetadata(provider => provider.GetCollectionFromName(name), library, $"the collection {name}"); Collection collection = await GetMetadata(provider => provider.GetCollectionFromName(name), library, $"the collection {name}");
collection.Name ??= name;
collection.Slug ??= Utility.ToSlug(name);
return collection;
} }
public async Task<Show> GetShowFromName(string showName, string showPath, Library library) public async Task<Show> GetShowFromName(string showName, string showPath, Library library)