Initial Commit Rework

This commit is contained in:
Qstick 2017-09-03 22:20:56 -04:00
parent 74a4cc048c
commit 95051cbd63
2483 changed files with 101351 additions and 111396 deletions

View file

@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NzbDrone.Core.Backup;
using Lidarr.Http;
namespace Lidarr.Api.V3.System.Backup
{
public class BackupModule : LidarrRestModule<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.Name.GetHashCode(),
Name = b.Name,
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
Type = b.Type,
Time = b.Time
})
.OrderByDescending(b => b.Time)
.ToList();
}
}
}