This commit is contained in:
Hamid Reza Mohammadi 2023-09-13 14:56:10 +03:30
parent 7e81344e81
commit 0b15775ef6
3 changed files with 14 additions and 4 deletions

View File

@ -367,7 +367,15 @@ namespace RMuseum.Services.Implementation
List<PDFPage> pages = new List<PDFPage>();
string pdfFilePath = job.ResourceNumber;
string intermediateFolder = Path.Combine(Path.GetDirectoryName(pdfFilePath), Path.GetFileNameWithoutExtension(pdfFilePath));
Directory.CreateDirectory(intermediateFolder);
try
{
Directory.CreateDirectory(intermediateFolder);
}
catch
{
intermediateFolder = Path.Combine(Path.GetDirectoryName(pdfFilePath), $"{pdfBook.Id}-catch");
}
List<string> fileNames = new List<string>();
int imageOrder = 1;
using (FileStream fs = File.OpenRead(pdfFilePath))

View File

@ -367,7 +367,7 @@ namespace RMuseum.Services.Implementation
model.Language = tagValueCleaned;
tagName = "Language";
if (tagValueCleaned != "فارسی")
if (!tagValueCleaned.Contains("فارسی"))
{
job.EndTime = DateTime.Now;
job.Status = ImportJobStatus.Failed;
@ -525,6 +525,8 @@ namespace RMuseum.Services.Implementation
{
if (result.IsSuccessStatusCode)
{
string fileName = (1 + await context.PDFBooks.MaxAsync(p => p.Id)).ToString().PadLeft(8, '0') + "-soha.pdf";
/*
string fileName = string.Empty;
if (result.Content.Headers.ContentDisposition != null)
{
@ -540,7 +542,7 @@ namespace RMuseum.Services.Implementation
{
fileName = Path.GetFileNameWithoutExtension(fileName).Substring(0, 64) + ".pdf";
}
*/
model.LocalImportingPDFFilePath = Path.Combine(_imageFileService.ImageStoragePath, fileName);
if (File.Exists(model.LocalImportingPDFFilePath))
File.Delete(model.LocalImportingPDFFilePath);

View File

@ -390,7 +390,7 @@ namespace RMuseum.Services.Implementation
model.Language = tagValueCleaned;
tagName = "Language";
if (tagValueCleaned != "فارسی")
if (!tagValueCleaned.Contains("فارسی"))
{
job.EndTime = DateTime.Now;
job.Status = ImportJobStatus.Failed;