fixed chapter retrieval
This commit is contained in:
parent
71735b8161
commit
c137525e17
|
@ -99,22 +99,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
var chapter = new ChapterInfo
|
||||
{
|
||||
StartPositionTicks = reader.GetInt64(0)
|
||||
};
|
||||
|
||||
if (!reader.IsDBNull(1))
|
||||
{
|
||||
chapter.Name = reader.GetString(1);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(2))
|
||||
{
|
||||
chapter.ImagePath = reader.GetString(2);
|
||||
}
|
||||
|
||||
yield return chapter;
|
||||
yield return GetChapter(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,13 +129,31 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow))
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return GetChapter(reader);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chapter.
|
||||
/// </summary>
|
||||
/// <param name="reader">The reader.</param>
|
||||
/// <returns>ChapterInfo.</returns>
|
||||
private ChapterInfo GetChapter(IDataReader reader)
|
||||
{
|
||||
var chapter = new ChapterInfo
|
||||
{
|
||||
StartPositionTicks = reader.GetInt64(0),
|
||||
Name = reader.GetString(1)
|
||||
StartPositionTicks = reader.GetInt64(0)
|
||||
};
|
||||
|
||||
if (!reader.IsDBNull(1))
|
||||
{
|
||||
chapter.Name = reader.GetString(1);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(2))
|
||||
{
|
||||
chapter.ImagePath = reader.GetString(2);
|
||||
|
@ -158,10 +161,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
return chapter;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the chapters.
|
||||
|
|
Loading…
Reference in New Issue
Block a user