mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-27 04:22:08 +00:00
fixed client type display for ios. also fixed display preferences saving.
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user