mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
dlna fixes
This commit is contained in:
parent
3ccecd3ca3
commit
cf4adb8438
@ -1535,16 +1535,6 @@ namespace MediaBrowser.Api.Playback
|
||||
}
|
||||
}
|
||||
|
||||
var headers = new Dictionary<string, string>();
|
||||
foreach (var key in Request.Headers.AllKeys)
|
||||
{
|
||||
headers[key] = Request.Headers[key];
|
||||
}
|
||||
|
||||
state.DeviceProfile = string.IsNullOrWhiteSpace(state.Request.DeviceProfileId) ?
|
||||
DlnaManager.GetProfile(headers) :
|
||||
DlnaManager.GetProfile(state.Request.DeviceProfileId);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -1669,6 +1659,16 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
private void ApplyDeviceProfileSettings(StreamState state)
|
||||
{
|
||||
var headers = new Dictionary<string, string>();
|
||||
foreach (var key in Request.Headers.AllKeys)
|
||||
{
|
||||
headers[key] = Request.Headers[key];
|
||||
}
|
||||
|
||||
state.DeviceProfile = string.IsNullOrWhiteSpace(state.Request.DeviceProfileId) ?
|
||||
DlnaManager.GetProfile(headers) :
|
||||
DlnaManager.GetProfile(state.Request.DeviceProfileId);
|
||||
|
||||
var profile = state.DeviceProfile;
|
||||
|
||||
if (profile == null)
|
||||
|
@ -1501,6 +1501,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
return userdata != null && userdata.Played;
|
||||
}
|
||||
|
||||
public bool IsFavoriteOrLiked(User user)
|
||||
{
|
||||
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
|
||||
|
||||
return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
|
||||
}
|
||||
|
||||
public virtual bool IsUnplayed(User user)
|
||||
{
|
||||
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
|
||||
|
@ -318,44 +318,5 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResponseProfile GetPhotoMediaProfile(string container, int? width, int? height)
|
||||
{
|
||||
container = (container ?? string.Empty).TrimStart('.');
|
||||
|
||||
foreach (var i in ResponseProfiles)
|
||||
{
|
||||
if (i.Type != DlnaProfileType.Photo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
List<string> containers = i.GetContainers().ToList();
|
||||
if (containers.Count > 0 && !containers.Contains(container, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
|
||||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsImageConditionSatisfied(c, width, height))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (anyOff)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,5 +82,6 @@ namespace MediaBrowser.Model.Querying
|
||||
public const string Studio = "Studio";
|
||||
public const string Players = "Players";
|
||||
public const string GameSystem = "GameSystem";
|
||||
public const string IsFavoriteOrLiked = "IsFavoriteOrLiked";
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,9 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
|
||||
var channelGuid = new Guid(item.ChannelId);
|
||||
var channel = _channelEntities.First(i => i.Id == channelGuid);
|
||||
var internalChannel = _channels.First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var requiresCallback = channel as IRequiresMediaInfoCallback;
|
||||
var requiresCallback = internalChannel as IRequiresMediaInfoCallback;
|
||||
|
||||
if (requiresCallback != null)
|
||||
{
|
||||
@ -403,7 +404,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
private string GetIdToHash(string externalId)
|
||||
{
|
||||
// Increment this as needed to force new downloads
|
||||
return externalId + "7";
|
||||
return externalId + "8";
|
||||
}
|
||||
|
||||
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, string internalChannnelId, CancellationToken cancellationToken)
|
||||
|
@ -227,6 +227,7 @@
|
||||
<Compile Include="Sorting\DateCreatedComparer.cs" />
|
||||
<Compile Include="Sorting\DatePlayedComparer.cs" />
|
||||
<Compile Include="Sorting\GameSystemComparer.cs" />
|
||||
<Compile Include="Sorting\IsFavoriteOrLikeComparer.cs" />
|
||||
<Compile Include="Sorting\IsFolderComparer.cs" />
|
||||
<Compile Include="Sorting\IsPlayedComparer.cs" />
|
||||
<Compile Include="Sorting\IsUnplayedComparer.cs" />
|
||||
|
@ -0,0 +1,58 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Sorting
|
||||
{
|
||||
public class IsFavoriteOrLikeComparer : IUserBaseItemComparer
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user.
|
||||
/// </summary>
|
||||
/// <value>The user.</value>
|
||||
public User User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Compares the specified x.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
return GetValue(x).CompareTo(GetValue(y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
private int GetValue(BaseItem x)
|
||||
{
|
||||
return x.IsFavoriteOrLiked(User) ? 0 : 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name
|
||||
{
|
||||
get { return ItemSortBy.IsFavoriteOrLiked; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user data repository.
|
||||
/// </summary>
|
||||
/// <value>The user data repository.</value>
|
||||
public IUserDataManager UserDataRepository { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user manager.
|
||||
/// </summary>
|
||||
/// <value>The user manager.</value>
|
||||
public IUserManager UserManager { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user