Cleanup old temporary Folders and files
This commit is contained in:
parent
6a8697fc3a
commit
537ad3a5f8
@ -164,7 +164,7 @@ public class JobBoss : GlobalBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
HashSet<string> coverFileNames = cachedPublications.Select(manga => manga.coverFileNameInCache!).ToHashSet();
|
HashSet<string> coverFileNames = cachedPublications.Select(manga => manga.coverFileNameInCache!).ToHashSet();
|
||||||
foreach (string fileName in Directory.GetFiles(settings.coverImageCache))
|
foreach (string fileName in Directory.GetFiles(settings.coverImageCache)) //Cleanup Unused Covers
|
||||||
{
|
{
|
||||||
if(!coverFileNames.Any(existingManga => fileName.Contains(existingManga)))
|
if(!coverFileNames.Any(existingManga => fileName.Contains(existingManga)))
|
||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
|
@ -237,7 +237,7 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
return HttpStatusCode.Created;
|
return HttpStatusCode.Created;
|
||||||
|
|
||||||
//Create a temporary folder to store images
|
//Create a temporary folder to store images
|
||||||
string tempFolder = Directory.CreateTempSubdirectory().FullName;
|
string tempFolder = Directory.CreateTempSubdirectory("trangatemp").FullName;
|
||||||
|
|
||||||
int chapter = 0;
|
int chapter = 0;
|
||||||
//Download all Images to temporary Folder
|
//Download all Images to temporary Folder
|
||||||
@ -260,8 +260,10 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
progressToken?.Increment();
|
progressToken?.Increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(comicInfoPath is not null)
|
if(comicInfoPath is not null){
|
||||||
File.Copy(comicInfoPath, Path.Join(tempFolder, "ComicInfo.xml"));
|
File.Copy(comicInfoPath, Path.Join(tempFolder, "ComicInfo.xml"));
|
||||||
|
File.Delete(comicInfoPath); //Delete tmp-file
|
||||||
|
}
|
||||||
|
|
||||||
Log($"Creating archive {saveArchiveFilePath}");
|
Log($"Creating archive {saveArchiveFilePath}");
|
||||||
//ZIP-it and ship-it
|
//ZIP-it and ship-it
|
||||||
|
@ -26,6 +26,8 @@ public partial class Tranga : GlobalBase
|
|||||||
new Bato(this),
|
new Bato(this),
|
||||||
new MangaLife(this)
|
new MangaLife(this)
|
||||||
};
|
};
|
||||||
|
foreach(DirectoryInfo dir in new DirectoryInfo(Path.GetTempPath()).GetDirectories("trangatemp"))//Cleanup old temp folders
|
||||||
|
dir.Delete();
|
||||||
jobBoss = new(this, this._connectors);
|
jobBoss = new(this, this._connectors);
|
||||||
StartJobBoss();
|
StartJobBoss();
|
||||||
this._server = new Server(this);
|
this._server = new Server(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user