update db retrieval
This commit is contained in:
parent
6edd92d2a5
commit
455468ef94
|
@ -103,7 +103,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name
|
||||
[IgnoreDataMember]
|
||||
public virtual string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -122,12 +123,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
[IgnoreDataMember]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is hd.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
|
||||
[IgnoreDataMember]
|
||||
public bool? IsHD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -149,6 +152,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
/// <value>The path.</value>
|
||||
[IgnoreDataMember]
|
||||
public virtual string Path { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
@ -325,12 +329,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the date created.
|
||||
/// </summary>
|
||||
/// <value>The date created.</value>
|
||||
[IgnoreDataMember]
|
||||
public DateTime DateCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date modified.
|
||||
/// </summary>
|
||||
/// <value>The date modified.</value>
|
||||
[IgnoreDataMember]
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
public DateTime DateLastSaved { get; set; }
|
||||
|
@ -407,6 +413,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the name of the forced sort.
|
||||
/// </summary>
|
||||
/// <value>The name of the forced sort.</value>
|
||||
[IgnoreDataMember]
|
||||
public string ForcedSortName
|
||||
{
|
||||
get { return _forcedSortName; }
|
||||
|
@ -493,6 +500,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
return sortable;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -559,6 +567,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// When the item first debuted. For movies this could be premiere date, episodes would be first aired
|
||||
/// </summary>
|
||||
/// <value>The premiere date.</value>
|
||||
[IgnoreDataMember]
|
||||
public DateTime? PremiereDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -572,31 +581,35 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the display type of the media.
|
||||
/// </summary>
|
||||
/// <value>The display type of the media.</value>
|
||||
[IgnoreDataMember]
|
||||
public string DisplayMediaType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the official rating.
|
||||
/// </summary>
|
||||
/// <value>The official rating.</value>
|
||||
[IgnoreDataMember]
|
||||
public string OfficialRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the official rating description.
|
||||
/// </summary>
|
||||
/// <value>The official rating description.</value>
|
||||
[IgnoreDataMember]
|
||||
public string OfficialRatingDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the custom rating.
|
||||
/// </summary>
|
||||
/// <value>The custom rating.</value>
|
||||
//[IgnoreDataMember]
|
||||
[IgnoreDataMember]
|
||||
public string CustomRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the overview.
|
||||
/// </summary>
|
||||
/// <value>The overview.</value>
|
||||
[IgnoreDataMember]
|
||||
public string Overview { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -609,37 +622,42 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the genres.
|
||||
/// </summary>
|
||||
/// <value>The genres.</value>
|
||||
[IgnoreDataMember]
|
||||
public List<string> Genres { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the home page URL.
|
||||
/// </summary>
|
||||
/// <value>The home page URL.</value>
|
||||
[IgnoreDataMember]
|
||||
public string HomePageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the community rating.
|
||||
/// </summary>
|
||||
/// <value>The community rating.</value>
|
||||
//[IgnoreDataMember]
|
||||
[IgnoreDataMember]
|
||||
public float? CommunityRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the community rating vote count.
|
||||
/// </summary>
|
||||
/// <value>The community rating vote count.</value>
|
||||
[IgnoreDataMember]
|
||||
public int? VoteCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the run time ticks.
|
||||
/// </summary>
|
||||
/// <value>The run time ticks.</value>
|
||||
[IgnoreDataMember]
|
||||
public long? RunTimeTicks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the production year.
|
||||
/// </summary>
|
||||
/// <value>The production year.</value>
|
||||
[IgnoreDataMember]
|
||||
public int? ProductionYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -647,13 +665,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// This could be episode number, album track number, etc.
|
||||
/// </summary>
|
||||
/// <value>The index number.</value>
|
||||
//[IgnoreDataMember]
|
||||
[IgnoreDataMember]
|
||||
public int? IndexNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For an episode this could be the season number, or for a song this could be the disc number.
|
||||
/// </summary>
|
||||
/// <value>The parent index number.</value>
|
||||
[IgnoreDataMember]
|
||||
public int? ParentIndexNumber { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
@ -1307,15 +1326,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a person to the item
|
||||
/// </summary>
|
||||
/// <param name="person">The person.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void AddPerson(PersonInfo person)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a studio to the item
|
||||
/// </summary>
|
||||
|
|
|
@ -58,6 +58,26 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
private string _name;
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
set
|
||||
{
|
||||
_name = value;
|
||||
|
||||
// lazy load this again
|
||||
SortName = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
/// If the item is a folder, it returns the folder itself
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _deleteStreamsCommand;
|
||||
private IDbCommand _saveStreamCommand;
|
||||
|
||||
private const int LatestSchemaVersion = 13;
|
||||
private const int LatestSchemaVersion = 16;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -198,6 +198,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalEtag", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
|
||||
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastSaved", "DATETIME");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsInMixedFolder", "BIT");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "LockedFields", "Text");
|
||||
|
||||
PrepareStatements();
|
||||
|
||||
new MediaStreamColumns(_connection, _logger).AddColumns();
|
||||
|
@ -289,7 +293,24 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"DateLastRefreshed"
|
||||
"DateLastRefreshed",
|
||||
"Name",
|
||||
"Path",
|
||||
"PremiereDate",
|
||||
"Overview",
|
||||
"ParentIndexNumber",
|
||||
"ProductionYear",
|
||||
"OfficialRating",
|
||||
"OfficialRatingDescription",
|
||||
"HomePageUrl",
|
||||
"DisplayMediaType",
|
||||
"ForcedSortName",
|
||||
"RunTimeTicks",
|
||||
"VoteCount",
|
||||
"DateCreated",
|
||||
"DateModified",
|
||||
"guid",
|
||||
"Genres"
|
||||
};
|
||||
|
||||
private readonly string[] _mediaStreamSaveColumns =
|
||||
|
@ -377,7 +398,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"DateLastRefreshed"
|
||||
"DateLastRefreshed",
|
||||
"DateLastSaved",
|
||||
"IsInMixedFolder",
|
||||
"LockedFields"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
|
@ -606,6 +630,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_saveItemCommand.GetParameter(index++).Value = item.DateLastRefreshed;
|
||||
}
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.DateLastSaved;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.IsInMixedFolder;
|
||||
_saveItemCommand.GetParameter(index++).Value = string.Join("|", item.LockedFields.Select(i => i.ToString()).ToArray());
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
_saveItemCommand.ExecuteNonQuery();
|
||||
|
@ -827,6 +855,88 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
item.DateLastRefreshed = reader.GetDateTime(23).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(24))
|
||||
{
|
||||
item.Name = reader.GetString(24);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(25))
|
||||
{
|
||||
item.Path = reader.GetString(25);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(26))
|
||||
{
|
||||
item.PremiereDate = reader.GetDateTime(26).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(27))
|
||||
{
|
||||
item.Overview = reader.GetString(27);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(28))
|
||||
{
|
||||
item.ParentIndexNumber = reader.GetInt32(28);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(29))
|
||||
{
|
||||
item.ProductionYear = reader.GetInt32(29);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(30))
|
||||
{
|
||||
item.OfficialRating = reader.GetString(30);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(31))
|
||||
{
|
||||
item.OfficialRating = reader.GetString(31);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(32))
|
||||
{
|
||||
item.HomePageUrl = reader.GetString(32);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(33))
|
||||
{
|
||||
item.DisplayMediaType = reader.GetString(33);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(34))
|
||||
{
|
||||
item.ForcedSortName = reader.GetString(34);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(35))
|
||||
{
|
||||
item.RunTimeTicks = reader.GetInt64(35);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(36))
|
||||
{
|
||||
item.VoteCount = reader.GetInt32(36);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(37))
|
||||
{
|
||||
item.DateCreated = reader.GetDateTime(37).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(38))
|
||||
{
|
||||
item.DateModified = reader.GetDateTime(38).ToUniversalTime();
|
||||
}
|
||||
|
||||
item.Id = reader.GetGuid(39);
|
||||
|
||||
if (!reader.IsDBNull(40))
|
||||
{
|
||||
item.Genres = reader.GetString(40).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,15 +144,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
{
|
||||
using (var cmd = _connection.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select data from users";
|
||||
cmd.CommandText = "select guid,data from users";
|
||||
|
||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
using (var stream = reader.GetMemoryStream(0))
|
||||
var id = reader.GetGuid(0);
|
||||
|
||||
using (var stream = reader.GetMemoryStream(1))
|
||||
{
|
||||
var user = _jsonSerializer.DeserializeFromStream<User>(stream);
|
||||
user.Id = id;
|
||||
yield return user;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user