Removing the suffix -thumb to the episode thumbnail file name

This commit is contained in:
Zoe Roux 2020-01-02 03:35:19 +01:00
parent 7e13e2c5c5
commit 57a34d73ac
3 changed files with 14 additions and 27 deletions

View File

@ -79,13 +79,11 @@ namespace Kyoo.Controllers
if (path == null) if (path == null)
return NotFound(); return NotFound();
//string thumb = Path.ChangeExtension(path, "jpg"); string thumb = Path.ChangeExtension(path, "jpg");
string thumb = path.Replace(Path.GetExtension(path), "-thumb.jpg");
if (System.IO.File.Exists(thumb)) if (System.IO.File.Exists(thumb))
return new PhysicalFileResult(thumb, "image/jpg"); return new PhysicalFileResult(thumb, "image/jpg");
else return NotFound();
return NotFound();
} }
} }
} }

View File

@ -29,10 +29,8 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
{ {
try try
{ {
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ await client.DownloadFileTaskAsync(new Uri(show.ImgPrimary), localThumb);
await client.DownloadFileTaskAsync(new Uri(show.ImgPrimary), localThumb);
}
} }
catch (WebException) catch (WebException)
{ {
@ -44,10 +42,8 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
{ {
try try
{ {
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ await client.DownloadFileTaskAsync(new Uri(show.ImgLogo), localLogo);
await client.DownloadFileTaskAsync(new Uri(show.ImgLogo), localLogo);
}
} }
catch (WebException) catch (WebException)
{ {
@ -59,10 +55,8 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
{ {
try try
{ {
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ await client.DownloadFileTaskAsync(new Uri(show.ImgBackdrop), localBackdrop);
await client.DownloadFileTaskAsync(new Uri(show.ImgBackdrop), localBackdrop);
}
} }
catch (WebException) catch (WebException)
{ {
@ -85,10 +79,8 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
{ {
try try
{ {
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ await client.DownloadFileTaskAsync(new Uri(people[i].imgPrimary), localThumb);
await client.DownloadFileTaskAsync(new Uri(people[i].imgPrimary), localThumb);
}
} }
catch (WebException) catch (WebException)
{ {
@ -102,16 +94,13 @@ namespace Kyoo.InternalAPI.ThumbnailsManager
public async Task<Episode> Validate(Episode episode) public async Task<Episode> Validate(Episode episode)
{ {
//string localThumb = Path.ChangeExtension(episode.Path, "jpg"); string localThumb = Path.ChangeExtension(episode.Path, "jpg");
string localThumb = episode.Path.Replace(Path.GetExtension(episode.Path), "-thumb.jpg");
if (episode.ImgPrimary != null && !File.Exists(localThumb)) if (episode.ImgPrimary != null && !File.Exists(localThumb))
{ {
try try
{ {
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ await client.DownloadFileTaskAsync(new Uri(episode.ImgPrimary), localThumb);
await client.DownloadFileTaskAsync(new Uri(episode.ImgPrimary), localThumb);
}
} }
catch (WebException) catch (WebException)
{ {

@ -1 +1 @@
Subproject commit 3f3ce1d88e1a146bc304892a7621cf7eb30df29b Subproject commit c0d0a8c2246d8040274d745cbcfa22d366bcef93