Compare commits
No commits in common. "4772ae075647a11555b0a8e6ddd23f97351a8667" and "6aa0ea277b891c2d5fd321f4383d14b0754b8e81" have entirely different histories.
4772ae0756
...
6aa0ea277b
@ -100,8 +100,10 @@ public class MangaDex : Connector
|
|||||||
string? coverUrl = GetCoverUrl(publicationId, posterId);
|
string? coverUrl = GetCoverUrl(publicationId, posterId);
|
||||||
string? coverCacheName = null;
|
string? coverCacheName = null;
|
||||||
if (coverUrl is not null)
|
if (coverUrl is not null)
|
||||||
coverCacheName = SaveImage(coverUrl);
|
{
|
||||||
|
DownloadClient.RequestResult coverResult = downloadClient.MakeRequest(coverUrl, (byte)RequestType.AtHomeServer);
|
||||||
|
coverCacheName = SaveImage(coverUrl, coverResult.result);
|
||||||
|
}
|
||||||
string? author = GetAuthor(authorId);
|
string? author = GetAuthor(authorId);
|
||||||
|
|
||||||
Dictionary<string, string> linksDict = new();
|
Dictionary<string, string> linksDict = new();
|
||||||
@ -298,18 +300,13 @@ public class MangaDex : Connector
|
|||||||
DownloadImage(publication.posterUrl, Path.Join(downloadLocation, publication.folderName, $"cover.{extension}"), this.downloadClient, (byte)RequestType.AtHomeServer);
|
DownloadImage(publication.posterUrl, Path.Join(downloadLocation, publication.folderName, $"cover.{extension}"), this.downloadClient, (byte)RequestType.AtHomeServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string SaveImage(string url)
|
private string SaveImage(string url, Stream imageData)
|
||||||
{
|
{
|
||||||
string[] split = url.Split('/');
|
string[] split = url.Split('/');
|
||||||
string filename = split[^1];
|
string filename = split[^1];
|
||||||
string saveImagePath = Path.Join(imageCachePath, filename);
|
string saveImagePath = Path.Join(imageCachePath, filename);
|
||||||
|
|
||||||
if (File.Exists(saveImagePath))
|
|
||||||
return saveImagePath;
|
|
||||||
|
|
||||||
DownloadClient.RequestResult coverResult = downloadClient.MakeRequest(url, (byte)RequestType.AtHomeServer);
|
|
||||||
using MemoryStream ms = new();
|
using MemoryStream ms = new();
|
||||||
coverResult.result.CopyTo(ms);
|
imageData.CopyTo(ms);
|
||||||
File.WriteAllBytes(saveImagePath, ms.ToArray());
|
File.WriteAllBytes(saveImagePath, ms.ToArray());
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@
|
|||||||
ports:
|
ports:
|
||||||
- 9555:80
|
- 9555:80
|
||||||
volumes:
|
volumes:
|
||||||
- ./tranga/imageCache:/usr/share/nginx/html/imageCache:ro #2 when replacing Point to same value as #1/imageCache
|
- ./tranga/imageCache:/usr/share/nginx/html/imageCache #2 when replacing Point to same value as #1/imageCache
|
Loading…
Reference in New Issue
Block a user