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
{
Path = path,
DateModified = FileSystem.GetLastWriteTimeUtc(path),
DateModified = chapter.ImageDateModified,
Type = imageType
};
}

View File

@ -1,4 +1,5 @@

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

View File

@ -863,7 +863,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{
Path = chapterInfo.ImagePath,
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.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
changesMade = true;
}
catch (Exception ex)
@ -170,6 +171,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
else if (!string.Equals(path, chapter.ImagePath, StringComparison.OrdinalIgnoreCase))
{
chapter.ImagePath = path;
chapter.ImageDateModified = _fileSystem.GetLastWriteTimeUtc(path);
changesMade = true;
}
}

View File

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

View File

@ -278,6 +278,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
_connection.AddColumn(Logger, ChaptersTableName, "ImageDateModified", "DATETIME");
string[] postQueries =
{
@ -591,6 +593,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@StartPositionTicks");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@Name");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImagePath");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImageDateModified");
// MediaStreams
_deleteStreamsCommand = _connection.CreateCommand();
@ -1497,7 +1500,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
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;
@ -1530,7 +1533,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
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, "@ChapterIndex", DbType.Int32).Value = index;
@ -1568,6 +1571,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
chapter.ImagePath = reader.GetString(2);
}
if (!reader.IsDBNull(3))
{
chapter.ImageDateModified = reader.GetDateTime(3).ToUniversalTime();
}
return chapter;
}
@ -1627,6 +1635,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveChapterCommand.GetParameter(2).Value = chapter.StartPositionTicks;
_saveChapterCommand.GetParameter(3).Value = chapter.Name;
_saveChapterCommand.GetParameter(4).Value = chapter.ImagePath;
_saveChapterCommand.GetParameter(5).Value = chapter.ImageDateModified;
_saveChapterCommand.Transaction = transaction;