mirror of
https://github.com/Readarr/Readarr
synced 2026-03-01 10:05:03 +01:00
Add, new setting "Set File Date to Airdate" on the Media Management tab of the Settings page to toggle this feature for new, imported and auto updating media files. Change, home page "Series Editor" - "Rename" button to "Update Files" and add "Set File Date To Air Date" action button to this modal to add capability of updating legacy media. Add, non UTC functions given that Windows undesirably adds time to file times set when using UTC. Fix, the Trakt API response show.air_time_utc contains erroneous data, this is replaced with show.air_time.
45 lines
No EOL
1.4 KiB
C#
45 lines
No EOL
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using NzbDrone.Common;
|
|
using NzbDrone.Common.Disk;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
namespace NzbDrone.Api.Logs
|
|
{
|
|
public class LogFileModule : NzbDroneRestModule<LogFileResource>
|
|
{
|
|
private readonly IAppFolderInfo _appFolderInfo;
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
public LogFileModule(IAppFolderInfo appFolderInfo,
|
|
IDiskProvider diskProvider)
|
|
: base("log/files")
|
|
{
|
|
_appFolderInfo = appFolderInfo;
|
|
_diskProvider = diskProvider;
|
|
GetResourceAll = GetLogFiles;
|
|
}
|
|
|
|
private List<LogFileResource> GetLogFiles()
|
|
{
|
|
var result = new List<LogFileResource>();
|
|
|
|
var files = _diskProvider.GetFiles(_appFolderInfo.GetLogFolder(), SearchOption.TopDirectoryOnly);
|
|
|
|
for (int i = 0; i < files.Length; i++)
|
|
{
|
|
var file = files[i];
|
|
|
|
result.Add(new LogFileResource
|
|
{
|
|
Id = i + 1,
|
|
Filename = Path.GetFileName(file),
|
|
LastWriteTime = _diskProvider.GetLastFileWriteUTC(file)
|
|
});
|
|
}
|
|
|
|
return result.OrderByDescending(l => l.LastWriteTime).ToList();
|
|
}
|
|
}
|
|
} |