You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using NzbDrone.Core.Backup;
|
|
|
|
namespace NzbDrone.Api.System.Backup
|
|
{
|
|
public class BackupModule : NzbDroneRestModule<BackupResource>
|
|
{
|
|
private readonly IBackupService _backupService;
|
|
|
|
public BackupModule(IBackupService backupService) : base("system/backup")
|
|
{
|
|
_backupService = backupService;
|
|
GetResourceAll = GetBackupFiles;
|
|
}
|
|
|
|
public List<BackupResource> GetBackupFiles()
|
|
{
|
|
var backups = _backupService.GetBackups();
|
|
|
|
return backups.Select(b => new BackupResource
|
|
{
|
|
Id = b.Path.GetHashCode(),
|
|
Name = Path.GetFileName(b.Path),
|
|
Path = b.Path,
|
|
Type = b.Type,
|
|
Time = b.Time
|
|
}).ToList();
|
|
}
|
|
}
|
|
}
|