From 4e816552395c1b57868ccd29f6f2e9b70d7272a5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 10 May 2014 13:28:03 -0400 Subject: updated mono build --- .../Session/SessionManager.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index ea709cd249..d2a047b42f 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -282,7 +282,18 @@ namespace MediaBrowser.Server.Implementations.Session if (!string.IsNullOrWhiteSpace(info.ItemId) && libraryItem != null) { - info.Item = GetItemInfo(libraryItem, runtimeTicks, libraryItem, info.MediaSourceId); + var current = session.NowPlayingItem; + + if (current == null || !string.Equals(current.Id, info.ItemId, StringComparison.OrdinalIgnoreCase)) + { + info.Item = GetItemInfo(libraryItem, libraryItem, info.MediaSourceId); + } + else + { + info.Item = current; + } + + info.Item.RunTimeTicks = runtimeTicks; } session.NowPlayingItem = info.Item; @@ -1182,12 +1193,11 @@ namespace MediaBrowser.Server.Implementations.Session /// Converts a BaseItem to a BaseItemInfo /// /// The item. - /// The now playing runtime ticks. /// The chapter owner. /// The media source identifier. /// BaseItemInfo. /// item - private BaseItemInfo GetItemInfo(BaseItem item, long? runtimeTicks, BaseItem chapterOwner, string mediaSourceId) + private BaseItemInfo GetItemInfo(BaseItem item, BaseItem chapterOwner, string mediaSourceId) { if (item == null) { @@ -1200,7 +1210,7 @@ namespace MediaBrowser.Server.Implementations.Session Name = item.Name, MediaType = item.MediaType, Type = item.GetClientTypeName(), - RunTimeTicks = runtimeTicks, + RunTimeTicks = item.RunTimeTicks, IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, PremiereDate = item.PremiereDate, @@ -1376,7 +1386,7 @@ namespace MediaBrowser.Server.Implementations.Session { var item = _libraryManager.GetItemById(new Guid(itemId)); - var info = GetItemInfo(item, item.RunTimeTicks, null, null); + var info = GetItemInfo(item, null, null); ReportNowViewingItem(sessionId, info); } -- cgit v1.2.3