Small changes

This commit is contained in:
tidusjar 2016-05-31 16:49:12 +01:00
commit 6067a4743e
5 changed files with 427 additions and 12 deletions

View file

@ -26,6 +26,7 @@
#endregion
using System;
using System.IO;
using System.Linq;
using NLog;
@ -130,7 +131,18 @@ namespace PlexRequests.Services.Jobs
private bool DoWeNeedToBackup(string backupPath)
{
var files = Directory.GetFiles(backupPath);
//TODO Get the latest file and if it's within an hour of DateTime.Now then don't bother backing up.
var last = files.LastOrDefault();
if (!string.IsNullOrEmpty(last))
{
var dt = ParseName(Path.GetFileName(last));
if (dt < DateTime.Now.AddHours(-1))
{
return true;
}
return false;
}
// We don't have a backup
return true;
}