store chapter image date modified

This commit is contained in:
Luke Pulverenti 2016-07-06 13:44:44 -04:00
parent 8629d509e4
commit 3c6797678b
6 changed files with 19 additions and 6 deletions

View File

@ -1878,7 +1878,7 @@ namespace MediaBrowser.Controller.Entities
return new ItemImageInfo return new ItemImageInfo
{ {
Path = path, Path = path,
DateModified = FileSystem.GetLastWriteTimeUtc(path), DateModified = chapter.ImageDateModified,
Type = imageType Type = imageType
}; };
} }

View File

@ -1,4 +1,5 @@
 using System;
namespace MediaBrowser.Model.Entities namespace MediaBrowser.Model.Entities
{ {
/// <summary> /// <summary>
@ -23,5 +24,6 @@ namespace MediaBrowser.Model.Entities
/// </summary> /// </summary>
/// <value>The image path.</value> /// <value>The image path.</value>
public string ImagePath { get; set; } public string ImagePath { get; set; }
public DateTime ImageDateModified { get; set; }
} }
} }

View File

@ -863,7 +863,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{ {
Path = chapterInfo.ImagePath, Path = chapterInfo.ImagePath,
Type = ImageType.Chapter, Type = ImageType.Chapter,
DateModified = _fileSystem.GetLastWriteTimeUtc(chapterInfo.ImagePath) DateModified = chapterInfo.ImageDateModified
}); });
} }

View File

@ -152,6 +152,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
} }
chapter.ImagePath = path; chapter.ImagePath = path;
chapter.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
changesMade = true; changesMade = true;
} }
catch (Exception ex) catch (Exception ex)
@ -170,6 +171,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
else if (!string.Equals(path, chapter.ImagePath, StringComparison.OrdinalIgnoreCase)) else if (!string.Equals(path, chapter.ImagePath, StringComparison.OrdinalIgnoreCase))
{ {
chapter.ImagePath = path; chapter.ImagePath = path;
chapter.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
changesMade = true; changesMade = true;
} }
} }

View File

@ -151,7 +151,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
IEnumerable<BaseItem> items; IEnumerable<BaseItem> items;
int numItemsToSave; int numItemsToSave;
var pageSize = 2000; var pageSize = 1000;
if (totalRecordCount.HasValue) if (totalRecordCount.HasValue)
{ {

View File

@ -278,6 +278,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT"); _connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text"); _connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
_connection.AddColumn(Logger, ChaptersTableName, "ImageDateModified", "DATETIME");
string[] postQueries = string[] postQueries =
{ {
@ -591,6 +593,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@StartPositionTicks"); _saveChapterCommand.Parameters.Add(_saveChapterCommand, "@StartPositionTicks");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@Name"); _saveChapterCommand.Parameters.Add(_saveChapterCommand, "@Name");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImagePath"); _saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImagePath");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImageDateModified");
// MediaStreams // MediaStreams
_deleteStreamsCommand = _connection.CreateCommand(); _deleteStreamsCommand = _connection.CreateCommand();
@ -1497,7 +1500,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var cmd = _connection.CreateCommand()) using (var cmd = _connection.CreateCommand())
{ {
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from " + ChaptersTableName + " where ItemId = @ItemId order by ChapterIndex asc"; cmd.CommandText = "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId order by ChapterIndex asc";
cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id; cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id;
@ -1530,7 +1533,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var cmd = _connection.CreateCommand()) using (var cmd = _connection.CreateCommand())
{ {
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from " + ChaptersTableName + " where ItemId = @ItemId and ChapterIndex=@ChapterIndex"; cmd.CommandText = "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId and ChapterIndex=@ChapterIndex";
cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id; cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id;
cmd.Parameters.Add(cmd, "@ChapterIndex", DbType.Int32).Value = index; cmd.Parameters.Add(cmd, "@ChapterIndex", DbType.Int32).Value = index;
@ -1568,6 +1571,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
chapter.ImagePath = reader.GetString(2); chapter.ImagePath = reader.GetString(2);
} }
if (!reader.IsDBNull(3))
{
chapter.ImageDateModified = reader.GetDateTime(3).ToUniversalTime();
}
return chapter; return chapter;
} }
@ -1627,6 +1635,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveChapterCommand.GetParameter(2).Value = chapter.StartPositionTicks; _saveChapterCommand.GetParameter(2).Value = chapter.StartPositionTicks;
_saveChapterCommand.GetParameter(3).Value = chapter.Name; _saveChapterCommand.GetParameter(3).Value = chapter.Name;
_saveChapterCommand.GetParameter(4).Value = chapter.ImagePath; _saveChapterCommand.GetParameter(4).Value = chapter.ImagePath;
_saveChapterCommand.GetParameter(5).Value = chapter.ImageDateModified;
_saveChapterCommand.Transaction = transaction; _saveChapterCommand.Transaction = transaction;