fixed client type display for ios. also fixed display preferences saving.
This commit is contained in:
parent
c1d38106c7
commit
cf61ac0264
|
@ -51,11 +51,7 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
var user = UserManager.GetUserById(new Guid(auth["UserId"]));
|
||||
|
||||
ClientType clientType;
|
||||
|
||||
Enum.TryParse(auth["Client"] ?? string.Empty, out clientType);
|
||||
|
||||
UserManager.LogUserActivity(user, clientType, auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ using MediaBrowser.Model.Connectivity;
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Server.Implementations.HttpServer;
|
||||
using MediaBrowser.Server.Implementations.Library;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using ServiceStack.ServiceHost;
|
||||
using ServiceStack.Text.Controller;
|
||||
using System;
|
||||
|
@ -356,16 +355,18 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserLibraryService" /> class.
|
||||
/// </summary>
|
||||
/// <exception cref="System.ArgumentNullException">jsonSerializer</exception>
|
||||
public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager)
|
||||
public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager, IJsonSerializer jsonSerializer)
|
||||
: base()
|
||||
{
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -481,7 +482,8 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
var item = (Folder)DtoBuilder.GetItemByClientId(itemId, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var displayPreferences = request;
|
||||
// Serialize to json and then back so that the core doesn't see the request dto type
|
||||
var displayPreferences = _jsonSerializer.DeserializeFromString<DisplayPreferences>(_jsonSerializer.SerializeToString(request));
|
||||
|
||||
var task = _libraryManager.SaveDisplayPreferencesForFolder(user, item, displayPreferences);
|
||||
|
||||
|
@ -597,11 +599,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
if (auth != null)
|
||||
{
|
||||
ClientType clientType;
|
||||
|
||||
Enum.TryParse(auth["Client"] ?? string.Empty, out clientType);
|
||||
|
||||
_userManager.OnPlaybackStart(user, item, clientType, auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
_userManager.OnPlaybackStart(user, item, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,11 +617,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
if (auth != null)
|
||||
{
|
||||
ClientType clientType;
|
||||
|
||||
Enum.TryParse(auth["Client"] ?? string.Empty, out clientType);
|
||||
|
||||
var task = _userManager.OnPlaybackProgress(user, item, request.PositionTicks, clientType, auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
var task = _userManager.OnPlaybackProgress(user, item, request.PositionTicks, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
@ -633,7 +627,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public void Post(OnPlaybackStopped request)
|
||||
public void Delete(OnPlaybackStopped request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
|
@ -643,11 +637,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
if (auth != null)
|
||||
{
|
||||
ClientType clientType;
|
||||
|
||||
Enum.TryParse(auth["Client"] ?? string.Empty, out clientType);
|
||||
|
||||
var task = _userManager.OnPlaybackStopped(user, item, request.PositionTicks, clientType, auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
var task = _userManager.OnPlaybackStopped(user, item, request.PositionTicks, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Allow different display preferences for each collection folder
|
||||
/// </summary>
|
||||
/// <value>The display prefs id.</value>
|
||||
public override Guid DisplayPrefsId
|
||||
public override Guid DisplayPreferencesId
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <value>The display prefs id.</value>
|
||||
[IgnoreDataMember]
|
||||
public virtual Guid DisplayPrefsId
|
||||
public virtual Guid DisplayPreferencesId
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -76,35 +76,35 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <summary>
|
||||
/// The _display prefs
|
||||
/// </summary>
|
||||
private IEnumerable<DisplayPreferences> _displayPrefs;
|
||||
private IEnumerable<DisplayPreferences> _displayPreferences;
|
||||
/// <summary>
|
||||
/// The _display prefs initialized
|
||||
/// </summary>
|
||||
private bool _displayPrefsInitialized;
|
||||
private bool _displayPreferencesInitialized;
|
||||
/// <summary>
|
||||
/// The _display prefs sync lock
|
||||
/// </summary>
|
||||
private object _displayPrefsSyncLock = new object();
|
||||
private object _displayPreferencesSyncLock = new object();
|
||||
/// <summary>
|
||||
/// Gets the display prefs.
|
||||
/// </summary>
|
||||
/// <value>The display prefs.</value>
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<DisplayPreferences> DisplayPrefs
|
||||
public IEnumerable<DisplayPreferences> DisplayPreferences
|
||||
{
|
||||
get
|
||||
{
|
||||
// Call ToList to exhaust the stream because we'll be iterating over this multiple times
|
||||
LazyInitializer.EnsureInitialized(ref _displayPrefs, ref _displayPrefsInitialized, ref _displayPrefsSyncLock, () => Kernel.Instance.DisplayPreferencesRepository.RetrieveDisplayPrefs(this).ToList());
|
||||
return _displayPrefs;
|
||||
LazyInitializer.EnsureInitialized(ref _displayPreferences, ref _displayPreferencesInitialized, ref _displayPreferencesSyncLock, () => Kernel.Instance.DisplayPreferencesRepository.RetrieveDisplayPreferences(this).ToList());
|
||||
return _displayPreferences;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_displayPrefs = value;
|
||||
_displayPreferences = value;
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
_displayPrefsInitialized = false;
|
||||
_displayPreferencesInitialized = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,29 +116,29 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="createIfNull">if set to <c>true</c> [create if null].</param>
|
||||
/// <returns>DisplayPreferences.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public DisplayPreferences GetDisplayPrefs(User user, bool createIfNull)
|
||||
public DisplayPreferences GetDisplayPreferences(User user, bool createIfNull)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
if (DisplayPrefs == null)
|
||||
if (DisplayPreferences == null)
|
||||
{
|
||||
if (!createIfNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AddOrUpdateDisplayPrefs(user, new DisplayPreferences { UserId = user.Id });
|
||||
AddOrUpdateDisplayPreferences(user, new DisplayPreferences { UserId = user.Id });
|
||||
}
|
||||
|
||||
var data = DisplayPrefs.FirstOrDefault(u => u.UserId == user.Id);
|
||||
var data = DisplayPreferences.FirstOrDefault(u => u.UserId == user.Id);
|
||||
|
||||
if (data == null && createIfNull)
|
||||
{
|
||||
data = new DisplayPreferences { UserId = user.Id };
|
||||
AddOrUpdateDisplayPrefs(user, data);
|
||||
AddOrUpdateDisplayPreferences(user, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -150,7 +150,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="user">The user.</param>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void AddOrUpdateDisplayPrefs(User user, DisplayPreferences data)
|
||||
public void AddOrUpdateDisplayPreferences(User user, DisplayPreferences data)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
@ -164,15 +164,15 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
data.UserId = user.Id;
|
||||
|
||||
if (DisplayPrefs == null)
|
||||
if (DisplayPreferences == null)
|
||||
{
|
||||
DisplayPrefs = new[] { data };
|
||||
DisplayPreferences = new[] { data };
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = DisplayPrefs.Where(u => u.UserId != user.Id).ToList();
|
||||
var list = DisplayPreferences.Where(u => u.UserId != user.Id).ToList();
|
||||
list.Add(data);
|
||||
DisplayPrefs = list;
|
||||
DisplayPreferences = list;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
if (item.IsFolder && fields.Contains(ItemFields.DisplayPreferences))
|
||||
{
|
||||
dto.DisplayPreferences = ((Folder)item).GetDisplayPrefs(user, false) ?? new DisplayPreferences { UserId = user.Id };
|
||||
dto.DisplayPreferences = ((Folder)item).GetDisplayPreferences(user, false) ?? new DisplayPreferences { UserId = user.Id };
|
||||
}
|
||||
|
||||
if (item.IsFolder)
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
Task LogUserActivity(User user, ClientType clientType, string deviceId, string deviceName);
|
||||
Task LogUserActivity(User user, string clientType, string deviceId, string deviceName);
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes metadata for each user
|
||||
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="deviceId">The device id.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
void OnPlaybackStart(User user, BaseItem item, ClientType clientType, string deviceId, string deviceName);
|
||||
void OnPlaybackStart(User user, BaseItem item, string clientType, string deviceId, string deviceName);
|
||||
|
||||
/// <summary>
|
||||
/// Used to report playback progress for an item
|
||||
|
@ -141,7 +141,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, ClientType clientType, string deviceId, string deviceName);
|
||||
Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
|
||||
|
||||
/// <summary>
|
||||
/// Used to report that playback has ended for an item
|
||||
|
@ -154,7 +154,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, ClientType clientType, string deviceId, string deviceName);
|
||||
Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
|
||||
|
||||
/// <summary>
|
||||
/// Saves user data for an item
|
||||
|
|
|
@ -17,13 +17,13 @@ namespace MediaBrowser.Controller.Persistence
|
|||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SaveDisplayPrefs(Folder item, CancellationToken cancellationToken);
|
||||
Task SaveDisplayPreferences(Folder item, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets display preferences for an item
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{DisplayPreferences}.</returns>
|
||||
IEnumerable<DisplayPreferences> RetrieveDisplayPrefs(Folder item);
|
||||
IEnumerable<DisplayPreferences> RetrieveDisplayPreferences(Folder item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Model.Connectivity
|
|||
/// </summary>
|
||||
/// <value>The type of the client.</value>
|
||||
[ProtoMember(2)]
|
||||
public ClientType ClientType { get; set; }
|
||||
public string Client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last activity date.
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
namespace MediaBrowser.Model.Connectivity
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum ClientType
|
||||
/// </summary>
|
||||
public enum ClientType
|
||||
{
|
||||
/// <summary>
|
||||
/// The other
|
||||
/// </summary>
|
||||
Other,
|
||||
/// <summary>
|
||||
/// The android
|
||||
/// </summary>
|
||||
Android,
|
||||
/// <summary>
|
||||
/// The dashboard
|
||||
/// </summary>
|
||||
Dashboard,
|
||||
/// <summary>
|
||||
/// The dlna
|
||||
/// </summary>
|
||||
Dlna,
|
||||
/// <summary>
|
||||
/// The ios
|
||||
/// </summary>
|
||||
Ios,
|
||||
/// <summary>
|
||||
/// The pc
|
||||
/// </summary>
|
||||
Pc,
|
||||
/// <summary>
|
||||
/// The windows phone
|
||||
/// </summary>
|
||||
WindowsPhone,
|
||||
/// <summary>
|
||||
/// The windows RT
|
||||
/// </summary>
|
||||
WindowsRT
|
||||
}
|
||||
}
|
|
@ -21,8 +21,6 @@ namespace MediaBrowser.Model.Entities
|
|||
/// </summary>
|
||||
public DisplayPreferences()
|
||||
{
|
||||
ViewType = ViewTypes.Poster;
|
||||
PrimaryImageType = ImageType.Primary;
|
||||
RememberIndexing = false;
|
||||
PrimaryImageHeight = 250;
|
||||
PrimaryImageWidth = 250;
|
||||
|
@ -40,13 +38,7 @@ namespace MediaBrowser.Model.Entities
|
|||
/// </summary>
|
||||
/// <value>The type of the view.</value>
|
||||
[ProtoMember(2)]
|
||||
public ViewTypes ViewType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the primary image.
|
||||
/// </summary>
|
||||
/// <value>The type of the primary image.</value>
|
||||
[ProtoMember(3)]
|
||||
public ImageType PrimaryImageType { get; set; }
|
||||
public string ViewType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the sort by.
|
||||
/// </summary>
|
||||
|
@ -127,29 +119,6 @@ namespace MediaBrowser.Model.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum ViewTypes
|
||||
/// </summary>
|
||||
public enum ViewTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The poster
|
||||
/// </summary>
|
||||
Poster,
|
||||
/// <summary>
|
||||
/// The cover flow
|
||||
/// </summary>
|
||||
CoverFlow,
|
||||
/// <summary>
|
||||
/// The thumb strip
|
||||
/// </summary>
|
||||
ThumbStrip,
|
||||
/// <summary>
|
||||
/// The list
|
||||
/// </summary>
|
||||
List
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum ScrollDirection
|
||||
/// </summary>
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
<Compile Include="Querying\ItemsByNameQuery.cs" />
|
||||
<Compile Include="Entities\BaseItemInfo.cs" />
|
||||
<Compile Include="Connectivity\ClientConnectionInfo.cs" />
|
||||
<Compile Include="Connectivity\ClientType.cs" />
|
||||
<Compile Include="Entities\ImageDownloadOptions.cs" />
|
||||
<Compile Include="Logging\ILogManager.cs" />
|
||||
<Compile Include="MediaInfo\BlurayDiscInfo.cs" />
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
/// Gets the routes.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{RouteInfo}.</returns>
|
||||
public IEnumerable<RouteInfo> GetRoutes()
|
||||
public virtual IEnumerable<RouteInfo> GetRoutes()
|
||||
{
|
||||
return new RouteInfo[] {};
|
||||
}
|
||||
|
|
|
@ -664,15 +664,15 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <returns>Task.</returns>
|
||||
public Task SaveDisplayPreferencesForFolder(User user, Folder folder, DisplayPreferences data)
|
||||
{
|
||||
// Need to update all items with the same DisplayPrefsId
|
||||
// Need to update all items with the same DisplayPreferencesId
|
||||
foreach (var child in RootFolder.GetRecursiveChildren(user)
|
||||
.OfType<Folder>()
|
||||
.Where(i => i.DisplayPrefsId == folder.DisplayPrefsId))
|
||||
.Where(i => i.DisplayPreferencesId == folder.DisplayPreferencesId))
|
||||
{
|
||||
child.AddOrUpdateDisplayPrefs(user, data);
|
||||
child.AddOrUpdateDisplayPreferences(user, data);
|
||||
}
|
||||
|
||||
return Kernel.DisplayPreferencesRepository.SaveDisplayPrefs(folder, CancellationToken.None);
|
||||
return Kernel.DisplayPreferencesRepository.SaveDisplayPreferences(folder, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
public Task LogUserActivity(User user, ClientType clientType, string deviceId, string deviceName)
|
||||
public Task LogUserActivity(User user, string clientType, string deviceId, string deviceName)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="currentPositionTicks">The current position ticks.</param>
|
||||
private void UpdateNowPlayingItemId(User user, ClientType clientType, string deviceId, string deviceName, BaseItem item, long? currentPositionTicks = null)
|
||||
private void UpdateNowPlayingItemId(User user, string clientType, string deviceId, string deviceName, BaseItem item, long? currentPositionTicks = null)
|
||||
{
|
||||
var conn = GetConnection(user.Id, clientType, deviceId, deviceName);
|
||||
|
||||
|
@ -269,7 +269,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceId">The device id.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
private void RemoveNowPlayingItemId(User user, ClientType clientType, string deviceId, string deviceName, BaseItem item)
|
||||
private void RemoveNowPlayingItemId(User user, string clientType, string deviceId, string deviceName, BaseItem item)
|
||||
{
|
||||
var conn = GetConnection(user.Id, clientType, deviceId, deviceName);
|
||||
|
||||
|
@ -288,7 +288,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceId">The device id.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <param name="lastActivityDate">The last activity date.</param>
|
||||
private void LogConnection(Guid userId, ClientType clientType, string deviceId, string deviceName, DateTime lastActivityDate)
|
||||
private void LogConnection(Guid userId, string clientType, string deviceId, string deviceName, DateTime lastActivityDate)
|
||||
{
|
||||
GetConnection(userId, clientType, deviceId, deviceName).LastActivityDate = lastActivityDate;
|
||||
}
|
||||
|
@ -301,18 +301,18 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceId">The device id.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>ClientConnectionInfo.</returns>
|
||||
private ClientConnectionInfo GetConnection(Guid userId, ClientType clientType, string deviceId, string deviceName)
|
||||
private ClientConnectionInfo GetConnection(Guid userId, string clientType, string deviceId, string deviceName)
|
||||
{
|
||||
lock (_activeConnections)
|
||||
{
|
||||
var conn = _activeConnections.FirstOrDefault(c => c.ClientType == clientType && string.Equals(deviceId, c.DeviceId));
|
||||
var conn = _activeConnections.FirstOrDefault(c => string.Equals(c.Client, clientType, StringComparison.OrdinalIgnoreCase) && string.Equals(deviceId, c.DeviceId));
|
||||
|
||||
if (conn == null)
|
||||
{
|
||||
conn = new ClientConnectionInfo
|
||||
{
|
||||
UserId = userId,
|
||||
ClientType = clientType,
|
||||
Client = clientType,
|
||||
DeviceName = deviceName,
|
||||
DeviceId = deviceId
|
||||
};
|
||||
|
@ -541,7 +541,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceId">The device id.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void OnPlaybackStart(User user, BaseItem item, ClientType clientType, string deviceId, string deviceName)
|
||||
public void OnPlaybackStart(User user, BaseItem item, string clientType, string deviceId, string deviceName)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public async Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, ClientType clientType, string deviceId, string deviceName)
|
||||
public async Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public async Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, ClientType clientType, string deviceId, string deviceName)
|
||||
public async Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace MediaBrowser.Server.Implementations.Sqlite
|
|||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public Task SaveDisplayPrefs(Folder item, CancellationToken cancellationToken)
|
||||
public Task SaveDisplayPreferences(Folder item, CancellationToken cancellationToken)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
|
@ -116,17 +116,17 @@ namespace MediaBrowser.Server.Implementations.Sqlite
|
|||
var cmd = connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from display_prefs where item_id = @guid";
|
||||
cmd.AddParam("@guid", item.DisplayPrefsId);
|
||||
cmd.AddParam("@guid", item.DisplayPreferencesId);
|
||||
|
||||
QueueCommand(cmd);
|
||||
|
||||
if (item.DisplayPrefs != null)
|
||||
if (item.DisplayPreferences != null)
|
||||
{
|
||||
foreach (var data in item.DisplayPrefs)
|
||||
foreach (var data in item.DisplayPreferences)
|
||||
{
|
||||
cmd = connection.CreateCommand();
|
||||
cmd.CommandText = "insert into display_prefs (item_id, user_id, data) values (@1, @2, @3)";
|
||||
cmd.AddParam("@1", item.DisplayPrefsId);
|
||||
cmd.AddParam("@1", item.DisplayPreferencesId);
|
||||
cmd.AddParam("@2", data.UserId);
|
||||
|
||||
cmd.AddParam("@3", _protobufSerializer.SerializeToBytes(data));
|
||||
|
@ -143,7 +143,7 @@ namespace MediaBrowser.Server.Implementations.Sqlite
|
|||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{DisplayPreferences}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public IEnumerable<DisplayPreferences> RetrieveDisplayPrefs(Folder item)
|
||||
public IEnumerable<DisplayPreferences> RetrieveDisplayPreferences(Folder item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ namespace MediaBrowser.Server.Implementations.Sqlite
|
|||
var cmd = connection.CreateCommand();
|
||||
cmd.CommandText = "select data from display_prefs where item_id = @guid";
|
||||
var guidParam = cmd.Parameters.Add("@guid", DbType.Guid);
|
||||
guidParam.Value = item.DisplayPrefsId;
|
||||
guidParam.Value = item.DisplayPreferencesId;
|
||||
|
||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace MediaBrowser.ServerApplication
|
|||
var currentFolder = folder;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
var prefs = ddlProfile.SelectedItem != null ? currentFolder.GetDisplayPrefs(ddlProfile.SelectedItem as User, false) ?? new DisplayPreferences {SortBy = ItemSortBy.SortName} : new DisplayPreferences {SortBy = ItemSortBy.SortName};
|
||||
var prefs = ddlProfile.SelectedItem != null ? currentFolder.GetDisplayPreferences(ddlProfile.SelectedItem as User, false) ?? new DisplayPreferences {SortBy = ItemSortBy.SortName} : new DisplayPreferences {SortBy = ItemSortBy.SortName};
|
||||
var node = new TreeViewItem { Tag = currentFolder };
|
||||
|
||||
var subChildren = currentFolder.GetChildren(CurrentUser, prefs.IndexBy);
|
||||
|
@ -142,7 +142,7 @@ namespace MediaBrowser.ServerApplication
|
|||
var subFolder = item as Folder;
|
||||
if (subFolder != null)
|
||||
{
|
||||
var prefs = subFolder.GetDisplayPrefs(user, false) ?? new DisplayPreferences {SortBy = LocalizedStrings.Instance.GetString("NameDispPref")};
|
||||
var prefs = subFolder.GetDisplayPreferences(user, false) ?? new DisplayPreferences {SortBy = LocalizedStrings.Instance.GetString("NameDispPref")};
|
||||
AddChildren(node, OrderBy(subFolder.GetChildren(user), user, prefs.SortBy), user);
|
||||
node.Header = item.Name + " (" + node.Items.Count + ")";
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ namespace MediaBrowser.ServerApplication
|
|||
ItemSortBy.Runtime
|
||||
};
|
||||
|
||||
var prefs = folder.GetDisplayPrefs(ddlProfile.SelectedItem as User, false);
|
||||
var prefs = folder.GetDisplayPreferences(ddlProfile.SelectedItem as User, false);
|
||||
ddlIndexBy.SelectedItem = prefs != null
|
||||
? prefs.IndexBy ?? LocalizedStrings.Instance.GetString("NoneDispPref")
|
||||
: LocalizedStrings.Instance.GetString("NoneDispPref");
|
||||
|
@ -354,7 +354,7 @@ namespace MediaBrowser.ServerApplication
|
|||
var folder = treeItem != null
|
||||
? treeItem.Tag as Folder
|
||||
: null;
|
||||
var prefs = folder != null ? folder.GetDisplayPrefs(CurrentUser, true) : new DisplayPreferences {SortBy = ItemSortBy.SortName};
|
||||
var prefs = folder != null ? folder.GetDisplayPreferences(CurrentUser, true) : new DisplayPreferences {SortBy = ItemSortBy.SortName};
|
||||
if (folder != null && prefs.IndexBy != ddlIndexBy.SelectedItem as string)
|
||||
{
|
||||
//grab UI context so we can update within the below task
|
||||
|
@ -395,7 +395,7 @@ namespace MediaBrowser.ServerApplication
|
|||
var folder = treeItem != null
|
||||
? treeItem.Tag as Folder
|
||||
: null;
|
||||
var prefs = folder != null ? folder.GetDisplayPrefs(CurrentUser, true) : new DisplayPreferences();
|
||||
var prefs = folder != null ? folder.GetDisplayPreferences(CurrentUser, true) : new DisplayPreferences();
|
||||
if (folder != null && prefs.SortBy != ddlSortBy.SelectedItem as string)
|
||||
{
|
||||
//grab UI context so we can update within the below task
|
||||
|
|
|
@ -114,36 +114,36 @@
|
|||
|
||||
getClientType: function (connection) {
|
||||
|
||||
if (connection.ClientType == "Dashboard") {
|
||||
if (connection.Client.toLowerCase() == "dashboard") {
|
||||
|
||||
return "<img src='css/images/clients/html5.png' alt='Dashboard' title='Dashboard' />";
|
||||
}
|
||||
if (connection.ClientType == "Pc") {
|
||||
if (connection.Client.toLowerCase() == "mediabrowsertheater") {
|
||||
|
||||
return "<img src='css/images/clients/mb.png' alt='Media Browser' title='Media Browser' />";
|
||||
return "<img src='css/images/clients/mb.png' alt='Media Browser Theater' title='Media Browser Theater' />";
|
||||
}
|
||||
if (connection.ClientType == "Android") {
|
||||
if (connection.Client.toLowerCase() == "android") {
|
||||
|
||||
return "<img src='css/images/clients/android.png' alt='Android' title='Android' />";
|
||||
}
|
||||
if (connection.ClientType == "Ios") {
|
||||
if (connection.Client.toLowerCase() == "ios") {
|
||||
|
||||
return "<img src='css/images/clients/ios.png' alt='iOS' title='iOS' />";
|
||||
}
|
||||
if (connection.ClientType == "WindowsRT") {
|
||||
if (connection.Client.toLowerCase() == "windowsrt") {
|
||||
|
||||
return "<img src='css/images/clients/windowsrt.png' alt='Windows RT' title='Windows RT' />";
|
||||
}
|
||||
if (connection.ClientType == "WindowsPhone") {
|
||||
if (connection.Client.toLowerCase() == "windowsphone") {
|
||||
|
||||
return "<img src='css/images/clients/windowsphone.png' alt='Windows Phone' title='Windows Phone' />";
|
||||
}
|
||||
if (connection.ClientType == "Dlna") {
|
||||
if (connection.Client.toLowerCase() == "dlna") {
|
||||
|
||||
return "<img src='css/images/clients/dlna.png' alt='Dlna' title='Dlna' />";
|
||||
}
|
||||
|
||||
return connection.ClientType;
|
||||
return connection.Client;
|
||||
},
|
||||
|
||||
getNowPlayingImage: function (item) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.49</version>
|
||||
<version>3.0.51</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.49" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.51" />
|
||||
<dependency id="NLog" version="2.0.0.2000" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.38" />
|
||||
<dependency id="protobuf-net" version="2.0.0.621" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.49</version>
|
||||
<version>3.0.51</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.49</version>
|
||||
<version>3.0.51</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.49" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.51" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user