mirror of https://github.com/Sonarr/Sonarr
Backup API improvements
This commit is contained in:
parent
fa34af8f15
commit
f3bf50e8d7
|
@ -21,9 +21,9 @@ namespace NzbDrone.Api.System.Backup
|
|||
|
||||
return backups.Select(b => new BackupResource
|
||||
{
|
||||
Id = b.Path.GetHashCode(),
|
||||
Name = Path.GetFileName(b.Path),
|
||||
Path = b.Path,
|
||||
Id = b.Name.GetHashCode(),
|
||||
Name = b.Name,
|
||||
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
|
||||
Type = b.Type,
|
||||
Time = b.Time
|
||||
}).ToList();
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace NzbDrone.Core.Backup
|
|||
{
|
||||
public class Backup
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string Name { get; set; }
|
||||
public BackupType Type { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,18 @@ namespace NzbDrone.Core.Backup
|
|||
{
|
||||
public class BackupCommand : Command
|
||||
{
|
||||
public BackupType Type { get; set; }
|
||||
public BackupType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Trigger == CommandTrigger.Scheduled)
|
||||
{
|
||||
return BackupType.Scheduled;
|
||||
}
|
||||
|
||||
return BackupType.Manual;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Backup
|
|||
{
|
||||
backups.AddRange(GetBackupFiles(folder).Select(b => new Backup
|
||||
{
|
||||
Path = Path.GetFileName(b),
|
||||
Name = Path.GetFileName(b),
|
||||
Type = backupType,
|
||||
Time = _diskProvider.FileGetLastWrite(b)
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue