fix tv recording retrieval
This commit is contained in:
parent
9728668751
commit
92ce7c0fa8
|
@ -43,16 +43,14 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
{
|
{
|
||||||
var name = GetClientTypeName();
|
var name = GetClientTypeName();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(RecordingInfo.ProgramId))
|
if (!string.IsNullOrEmpty(ProgramId))
|
||||||
{
|
{
|
||||||
return name + "-" + RecordingInfo.ProgramId;
|
return name + "-" + ProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return name + "-" + RecordingInfo.Name + (RecordingInfo.EpisodeTitle ?? string.Empty);
|
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordingInfo RecordingInfo { get; set; }
|
|
||||||
|
|
||||||
public string ServiceName { get; set; }
|
public string ServiceName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -42,16 +42,14 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
{
|
{
|
||||||
var name = GetClientTypeName();
|
var name = GetClientTypeName();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(RecordingInfo.ProgramId))
|
if (!string.IsNullOrEmpty(ProgramId))
|
||||||
{
|
{
|
||||||
return name + "-" + RecordingInfo.ProgramId;
|
return name + "-" + ProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return name + "-" + RecordingInfo.Name + (RecordingInfo.EpisodeTitle ?? string.Empty);
|
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordingInfo RecordingInfo { get; set; }
|
|
||||||
|
|
||||||
public string ServiceName { get; set; }
|
public string ServiceName { get; set; }
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
|
|
@ -135,6 +135,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
|
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
|
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
|
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
|
||||||
|
_connection.AddColumn(_logger, "TypedBaseItems", "CommunityRating", "Float");
|
||||||
|
_connection.AddColumn(_logger, "TypedBaseItems", "CustomRating", "Text");
|
||||||
|
|
||||||
PrepareStatements();
|
PrepareStatements();
|
||||||
|
|
||||||
|
@ -152,17 +154,26 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void PrepareStatements()
|
private void PrepareStatements()
|
||||||
{
|
{
|
||||||
|
var saveColumns = new List<string>
|
||||||
|
{
|
||||||
|
"guid",
|
||||||
|
"type",
|
||||||
|
"data",
|
||||||
|
"StartDate",
|
||||||
|
"EndDate",
|
||||||
|
"ChannelId",
|
||||||
|
"IsKids",
|
||||||
|
"IsMovie",
|
||||||
|
"IsSports",
|
||||||
|
"CommunityRating",
|
||||||
|
"CustomRating"
|
||||||
|
};
|
||||||
_saveItemCommand = _connection.CreateCommand();
|
_saveItemCommand = _connection.CreateCommand();
|
||||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (guid, type, data, StartDate, EndDate, ChannelId, IsKids, IsMovie, IsSports) values (@1, @2, @3, @4, @5, @6, @7, @8, @9)";
|
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11)";
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@1");
|
for (var i = 1; i <= saveColumns.Count; i++)
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@2");
|
{
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@3");
|
_saveItemCommand.Parameters.Add(_saveItemCommand, "@" + i.ToString(CultureInfo.InvariantCulture));
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@4");
|
}
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@5");
|
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@6");
|
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@7");
|
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@8");
|
|
||||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@9");
|
|
||||||
|
|
||||||
_deleteChildrenCommand = _connection.CreateCommand();
|
_deleteChildrenCommand = _connection.CreateCommand();
|
||||||
_deleteChildrenCommand.CommandText = "delete from ChildrenIds where ParentId=@ParentId";
|
_deleteChildrenCommand.CommandText = "delete from ChildrenIds where ParentId=@ParentId";
|
||||||
|
@ -229,37 +240,42 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
_saveItemCommand.GetParameter(0).Value = item.Id;
|
var index = 0;
|
||||||
_saveItemCommand.GetParameter(1).Value = item.GetType().FullName;
|
|
||||||
_saveItemCommand.GetParameter(2).Value = _jsonSerializer.SerializeToBytes(item);
|
_saveItemCommand.GetParameter(index++).Value = item.Id;
|
||||||
|
_saveItemCommand.GetParameter(index++).Value = item.GetType().FullName;
|
||||||
|
_saveItemCommand.GetParameter(index++).Value = _jsonSerializer.SerializeToBytes(item);
|
||||||
|
|
||||||
var hasStartDate = item as IHasStartDate;
|
var hasStartDate = item as IHasStartDate;
|
||||||
if (hasStartDate != null)
|
if (hasStartDate != null)
|
||||||
{
|
{
|
||||||
_saveItemCommand.GetParameter(3).Value = hasStartDate.StartDate;
|
_saveItemCommand.GetParameter(index++).Value = hasStartDate.StartDate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_saveItemCommand.GetParameter(3).Value = null;
|
_saveItemCommand.GetParameter(index++).Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveItemCommand.GetParameter(4).Value = item.EndDate;
|
_saveItemCommand.GetParameter(index++).Value = item.EndDate;
|
||||||
_saveItemCommand.GetParameter(5).Value = item.ChannelId;
|
_saveItemCommand.GetParameter(index++).Value = item.ChannelId;
|
||||||
|
|
||||||
var hasProgramAttributes = item as IHasProgramAttributes;
|
var hasProgramAttributes = item as IHasProgramAttributes;
|
||||||
if (hasProgramAttributes != null)
|
if (hasProgramAttributes != null)
|
||||||
{
|
{
|
||||||
_saveItemCommand.GetParameter(6).Value = hasProgramAttributes.IsKids;
|
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsKids;
|
||||||
_saveItemCommand.GetParameter(7).Value = hasProgramAttributes.IsMovie;
|
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsMovie;
|
||||||
_saveItemCommand.GetParameter(8).Value = hasProgramAttributes.IsSports;
|
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsSports;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_saveItemCommand.GetParameter(6).Value = null;
|
_saveItemCommand.GetParameter(index++).Value = null;
|
||||||
_saveItemCommand.GetParameter(7).Value = null;
|
_saveItemCommand.GetParameter(index++).Value = null;
|
||||||
_saveItemCommand.GetParameter(8).Value = null;
|
_saveItemCommand.GetParameter(index++).Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_saveItemCommand.GetParameter(index++).Value = item.CommunityRating;
|
||||||
|
_saveItemCommand.GetParameter(index++).Value = item.CustomRating;
|
||||||
|
|
||||||
_saveItemCommand.Transaction = transaction;
|
_saveItemCommand.Transaction = transaction;
|
||||||
|
|
||||||
_saveItemCommand.ExecuteNonQuery();
|
_saveItemCommand.ExecuteNonQuery();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user