mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Add new feature, set file date to episode aired date. Fix, use alternative Trakt API field for episode air time. Improve the Preview Rename tip.
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.
This commit is contained in:
@@ -77,6 +77,20 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
|
||||
public DateTime GetLastFileWrite(string path)
|
||||
{
|
||||
PathEnsureFileExists(path);
|
||||
|
||||
return new FileInfo(path).LastWriteTime;
|
||||
}
|
||||
|
||||
public DateTime GetLastFileWriteUTC(string path)
|
||||
{
|
||||
PathEnsureFileExists(path);
|
||||
|
||||
return new FileInfo(path).LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
private void PathEnsureFileExists(string path)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
@@ -84,8 +98,6 @@ namespace NzbDrone.Common.Disk
|
||||
{
|
||||
throw new FileNotFoundException("File doesn't exist: " + path);
|
||||
}
|
||||
|
||||
return new FileInfo(path).LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
public void EnsureFolder(string path)
|
||||
@@ -305,6 +317,26 @@ namespace NzbDrone.Common.Disk
|
||||
Directory.SetLastWriteTimeUtc(path, dateTime);
|
||||
}
|
||||
|
||||
public void FileSetLastWriteTime(string path, DateTime dateTime)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
File.SetLastWriteTime(path, dateTime);
|
||||
}
|
||||
public void FileSetLastAccessTime(string path, DateTime dateTime)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
File.SetLastAccessTimeUtc(path, dateTime);
|
||||
}
|
||||
|
||||
public void FileSetLastAccessTimeUtc(string path, DateTime dateTime)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
File.SetLastAccessTimeUtc(path, dateTime);
|
||||
}
|
||||
|
||||
public bool IsFileLocked(string file)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user