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:
JackDandy
2014-03-08 19:01:51 +00:00
parent 9d74693bb7
commit d9eab04029
24 changed files with 316 additions and 38 deletions
+34 -2
View File
@@ -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