2
0

resolves #17 no cover image

This commit is contained in:
glax 2023-06-11 19:05:08 +02:00
parent 76604d84d8
commit fcd81f03b3
2 changed files with 3 additions and 2 deletions

View File

@ -137,11 +137,11 @@ public abstract class Connector
/// <param name="settings">TrangaSettings</param> /// <param name="settings">TrangaSettings</param>
public void CopyCoverFromCacheToDownloadLocation(Publication publication, TrangaSettings settings) public void CopyCoverFromCacheToDownloadLocation(Publication publication, TrangaSettings settings)
{ {
logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {publication.sortName} {publication.internalId}"); logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {publication.sortName} -> {publication.internalId}");
//Check if Publication already has a Folder and cover //Check if Publication already has a Folder and cover
string publicationFolder = publication.CreatePublicationFolder(downloadLocation); string publicationFolder = publication.CreatePublicationFolder(downloadLocation);
DirectoryInfo dirInfo = new (publicationFolder); DirectoryInfo dirInfo = new (publicationFolder);
if (dirInfo.EnumerateFiles().Any(info => info.Name.Contains("cover."))) if (dirInfo.EnumerateFiles().Any(info => info.Name.Contains("cover", StringComparison.InvariantCultureIgnoreCase)))
{ {
logger?.WriteLine(this.GetType().ToString(), $"Cover exists {publication.sortName}"); logger?.WriteLine(this.GetType().ToString(), $"Cover exists {publication.sortName}");
return; return;

View File

@ -25,6 +25,7 @@ public class DownloadChapterTask : TrangaTask
if(this.parentTask is not null) if(this.parentTask is not null)
this.parentTask.state = ExecutionState.Running; this.parentTask.state = ExecutionState.Running;
Connector connector = taskManager.GetConnector(this.connectorName); Connector connector = taskManager.GetConnector(this.connectorName);
connector.CopyCoverFromCacheToDownloadLocation(this.publication, taskManager.settings);
connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken); connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
if(this.parentTask is not null) if(this.parentTask is not null)
this.parentTask.state = ExecutionState.Waiting; this.parentTask.state = ExecutionState.Waiting;