The Free Software Media System - Server Backend & API
cache now playing item
Luke Pulverentibbaa0977fdea
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex 960fe07397..300b67ae2f 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -566,6 +566,23 @@ namespace Emby.Server.Implementations.Session}}+ private BaseItem GetNowPlayingItem(SessionInfo session, string itemId)+ {+ var idGuid = new Guid(itemId);++ var item = session.FullNowPlayingItem;+ if (item != null && item.Id == idGuid)+ {+ return item;+ }++ item = _libraryManager.GetItemById(itemId);++ session.FullNowPlayingItem = item;++ return item;+ }+/// <summary>/// Used to report that playback has started for an item/// </summary>@@ -583,7 +600,7 @@ namespace Emby.Server.Implementations.Sessionvar libraryItem = string.IsNullOrWhiteSpace(info.ItemId)? null- : _libraryManager.GetItemById(new Guid(info.ItemId));+ : GetNowPlayingItem(session, info.ItemId);await UpdateNowPlayingItem(session, info, libraryItem).ConfigureAwait(false);@@ -669,7 +686,7 @@ namespace Emby.Server.Implementations.Sessionvar libraryItem = string.IsNullOrWhiteSpace(info.ItemId)? null- : _libraryManager.GetItemById(new Guid(info.ItemId));+ : GetNowPlayingItem(session, info.ItemId);await UpdateNowPlayingItem(session, info, libraryItem).ConfigureAwait(false);@@ -773,7 +790,7 @@ namespace Emby.Server.Implementations.Sessionvar libraryItem = string.IsNullOrWhiteSpace(info.ItemId)? null- : _libraryManager.GetItemById(new Guid(info.ItemId));+ : GetNowPlayingItem(session, info.ItemId);// Normalizeif (string.IsNullOrWhiteSpace(info.MediaSourceId))@@ -1782,18 +1799,18 @@ namespace Emby.Server.Implementations.Sessionthrow new ArgumentNullException("itemId");}- var item = _libraryManager.GetItemById(new Guid(itemId));+ //var item = _libraryManager.GetItemById(new Guid(itemId));- var info = GetItemInfo(item, null, null);+ //var info = GetItemInfo(item, null, null);- ReportNowViewingItem(sessionId, info);+ //ReportNowViewingItem(sessionId, info);}public void ReportNowViewingItem(string sessionId, BaseItemInfo item){- var session = GetSession(sessionId);+ //var session = GetSession(sessionId);- session.NowViewingItem = item;+ //session.NowViewingItem = item;}public void ReportTranscodingInfo(string deviceId, TranscodingInfo info)diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.csindex b3e82f9258..343b15a04f 100644--- a/MediaBrowser.Controller/Session/SessionInfo.cs+++ b/MediaBrowser.Controller/Session/SessionInfo.cs@@ -3,6 +3,7 @@ using MediaBrowser.Model.Session;using System;using System.Collections.Generic;using System.Linq;+using MediaBrowser.Controller.Entities;namespace MediaBrowser.Controller.Session{@@ -106,7 +107,9 @@ namespace MediaBrowser.Controller.Session/// </summary>/// <value>The now playing item.</value>public BaseItemInfo NowPlayingItem { get; set; }-++ public BaseItem FullNowPlayingItem { get; set; }+/// <summary>/// Gets or sets the device id./// </summary>