diff --git a/Kyoo/Controllers/FileSystems/FileSystemComposite.cs b/Kyoo/Controllers/FileSystems/FileSystemComposite.cs index c7bda72a..20a7f67d 100644 --- a/Kyoo/Controllers/FileSystems/FileSystemComposite.cs +++ b/Kyoo/Controllers/FileSystems/FileSystemComposite.cs @@ -175,12 +175,15 @@ namespace Kyoo.Controllers Track track => _GetFileSystemForPath(track.Episode.Show.Path, out string _), _ => _GetFileSystemForPath(_options.CurrentValue.MetadataPath, out string _) }; - string path = await fs.GetExtraDirectory(resource); - if (resource is IResource res) - path ??= Combine(_options.CurrentValue.MetadataPath, res.Slug, typeof(T).Name); - else - path ??= Combine(_options.CurrentValue.MetadataPath, typeof(T).Name); - await CreateDirectory(path); + string path = await fs.GetExtraDirectory(resource) + ?? resource switch + { + Season season => await GetExtraDirectory(season.Show), + Episode episode => await GetExtraDirectory(episode.Show), + Track track => await GetExtraDirectory(track.Episode), + IResource res => Combine(_options.CurrentValue.MetadataPath, typeof(T).Name, res.Slug), + _ => Combine(_options.CurrentValue.MetadataPath, typeof(T).Name) + }; return path; } } diff --git a/Kyoo/Controllers/FileSystems/LocalFileSystem.cs b/Kyoo/Controllers/FileSystems/LocalFileSystem.cs index 9c085582..71dac41d 100644 --- a/Kyoo/Controllers/FileSystems/LocalFileSystem.cs +++ b/Kyoo/Controllers/FileSystems/LocalFileSystem.cs @@ -127,9 +127,9 @@ namespace Kyoo.Controllers return Task.FromResult(resource switch { Show show => Combine(show.Path, "Extra"), - Season season => Combine(season.Show.Path, "Extra", "Season"), - Episode episode => Combine(episode.Show.Path, "Extra", "Episode"), - Track track => Combine(track.Episode.Show.Path, "Track"), + Season season => Combine(season.Show.Path, "Extra"), + Episode episode => Combine(episode.Show.Path, "Extra"), + Track track => Combine(track.Episode.Show.Path, "Extra"), _ => null }); } diff --git a/Kyoo/Controllers/ThumbnailsManager.cs b/Kyoo/Controllers/ThumbnailsManager.cs index f6be0171..142ee236 100644 --- a/Kyoo/Controllers/ThumbnailsManager.cs +++ b/Kyoo/Controllers/ThumbnailsManager.cs @@ -94,9 +94,18 @@ namespace Kyoo.Controllers Images.Poster => "poster.jpg", Images.Logo => "logo.jpg", Images.Thumbnail => "thumbnail.jpg", + Images.Trailer => "trailer.mp4", _ => $"{imageID}.jpg" }; - + + imageName = item switch + { + Season season => $"season-{season.SeasonNumber}-{imageName}", + Episode episode => _files.Combine("Thumbnails", + $"{Path.GetFileNameWithoutExtension(episode.Path)}-{imageName}"), + _ => imageName + }; + return _files.Combine(await _files.GetExtraDirectory(item), imageName); } }