Skip to content

Commit

Permalink
Mer temppath.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmtm committed Aug 15, 2024
1 parent e84c64e commit 0ac2b2c
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion func-nyforvarvslistan/NyforvarvslistanFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static async Task SetBackMinervaLastRun(ILogger log)
throw; // Rethrow the exception to be caught by the outer catch block if needed
}
}
public static void CreateLists(ILogger log)
public static void CreateLists(ILogger log)
{
log.LogInformation($"Function triggered at: {DateTime.Now}");
// var startDate = Dates.StartOfPreviousMonth.ToElasticsearchFormat();
Expand Down Expand Up @@ -181,6 +181,30 @@ public static void CreateLists(ILogger log)
//var pdfGenerator = new PdfGenerator();
//var docxGenerator = new DocxGenerator();
var xmlGenerator = new XmlGenerator();
if (Environment.GetEnvironmentVariable("WEBSITE_CONTENTSHARE") != null)
{
if (talkingBooks.Any())
{
string tempPath = Path.GetTempPath();

xmlGenerator.SaveToFile(talkingBooks, Path.Combine(tempPath, "nyf-tb-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));
xmlGenerator.SaveToFile(talkingBooks, Path.Combine(tempPath, "nyf-tb-no-links-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));
xmlGenerator.SaveToFile(talkingBooks, Path.Combine(tempPath, "nyf-tb-no-links-swedishonly-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));

// Additional processing, such as uploading to Blob Storage, goes here
}

if (brailleBooks.Any())
{
string tempPath = Path.GetTempPath();

xmlGenerator.SaveToFile(brailleBooks, Path.Combine(tempPath, "nyf-punkt-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));
xmlGenerator.SaveToFile(brailleBooks, Path.Combine(tempPath, "nyf-punkt-no-links-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));
xmlGenerator.SaveToFile(brailleBooks, Path.Combine(tempPath, "nyf-punkt-no-links-swedishonly-" + DateTime.Now.Year + "-" + DateTime.Now.Month.ToString("00") + ".xml"));

// Additional processing, such as uploading to Blob Storage, goes here
}
} else {

if (talkingBooks.Any())
{
Expand All @@ -205,6 +229,7 @@ public static void CreateLists(ILogger log)
// pdfGenerator.GeneratePdf(brailleBookHtml, "brailleBook-" + Dates.GetCurrentYear(Dates.StartOfPreviousMonth) + "-" + Dates.GetMonthNameInSwedish(Dates.StartOfPreviousMonth) + ".pdf");
// docxGenerator.GenerateDocx("brailleBook-" + Dates.GetCurrentYear(Dates.StartOfPreviousMonth) + "-" + Dates.GetMonthNameInSwedish(Dates.StartOfPreviousMonth) + ".docx", books);
}
}
List<string> generatedFiles = new List<string>();
if (Environment.GetEnvironmentVariable("WEBSITE_CONTENTSHARE") != null)
{
Expand Down

0 comments on commit 0ac2b2c

Please sign in to comment.