FileSystem: Using a single folder for shows-content

This commit is contained in:
Zoe Roux 2021-08-04 20:19:31 +02:00
parent 87e1b5aca1
commit b60046eddc
3 changed files with 22 additions and 10 deletions

View File

@ -175,12 +175,15 @@ namespace Kyoo.Controllers
Track track => _GetFileSystemForPath(track.Episode.Show.Path, out string _), Track track => _GetFileSystemForPath(track.Episode.Show.Path, out string _),
_ => _GetFileSystemForPath(_options.CurrentValue.MetadataPath, out string _) _ => _GetFileSystemForPath(_options.CurrentValue.MetadataPath, out string _)
}; };
string path = await fs.GetExtraDirectory(resource); string path = await fs.GetExtraDirectory(resource)
if (resource is IResource res) ?? resource switch
path ??= Combine(_options.CurrentValue.MetadataPath, res.Slug, typeof(T).Name); {
else Season season => await GetExtraDirectory(season.Show),
path ??= Combine(_options.CurrentValue.MetadataPath, typeof(T).Name); Episode episode => await GetExtraDirectory(episode.Show),
await CreateDirectory(path); 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; return path;
} }
} }

View File

@ -127,9 +127,9 @@ namespace Kyoo.Controllers
return Task.FromResult(resource switch return Task.FromResult(resource switch
{ {
Show show => Combine(show.Path, "Extra"), Show show => Combine(show.Path, "Extra"),
Season season => Combine(season.Show.Path, "Extra", "Season"), Season season => Combine(season.Show.Path, "Extra"),
Episode episode => Combine(episode.Show.Path, "Extra", "Episode"), Episode episode => Combine(episode.Show.Path, "Extra"),
Track track => Combine(track.Episode.Show.Path, "Track"), Track track => Combine(track.Episode.Show.Path, "Extra"),
_ => null _ => null
}); });
} }

View File

@ -94,9 +94,18 @@ namespace Kyoo.Controllers
Images.Poster => "poster.jpg", Images.Poster => "poster.jpg",
Images.Logo => "logo.jpg", Images.Logo => "logo.jpg",
Images.Thumbnail => "thumbnail.jpg", Images.Thumbnail => "thumbnail.jpg",
Images.Trailer => "trailer.mp4",
_ => $"{imageID}.jpg" _ => $"{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); return _files.Combine(await _files.GetExtraDirectory(item), imageName);
} }
} }