mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-30 01:09:09 +02:00
use profile id in streaming service
This commit is contained in:
parent
4e2764e516
commit
de19966074
|
@ -1492,7 +1492,16 @@ namespace MediaBrowser.Api.Playback
|
||||||
headers[key] = Request.Headers[key];
|
headers[key] = Request.Headers[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = DlnaManager.GetProfile(headers);
|
var profile = string.IsNullOrWhiteSpace(state.Request.DeviceProfileId) ?
|
||||||
|
DlnaManager.GetProfile(headers) :
|
||||||
|
DlnaManager.GetProfile(state.Request.DeviceProfileId);
|
||||||
|
|
||||||
|
if (profile == null)
|
||||||
|
{
|
||||||
|
// Don't use settings from the default profile.
|
||||||
|
// Only use a specific profile if it was requested.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var container = Path.GetExtension(state.RequestedUrl);
|
var container = Path.GetExtension(state.RequestedUrl);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,12 @@ namespace MediaBrowser.Controller.Dlna
|
||||||
/// <returns>DeviceProfile.</returns>
|
/// <returns>DeviceProfile.</returns>
|
||||||
DeviceProfile GetProfile(IDictionary<string,string> headers);
|
DeviceProfile GetProfile(IDictionary<string,string> headers);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>DeviceProfile.</returns>
|
||||||
|
DeviceProfile GetDefaultProfile();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the profile.
|
/// Gets the profile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -107,10 +107,16 @@ namespace MediaBrowser.Dlna
|
||||||
|
|
||||||
public DeviceProfile GetProfile(DeviceIdentification deviceInfo)
|
public DeviceProfile GetProfile(DeviceIdentification deviceInfo)
|
||||||
{
|
{
|
||||||
var profile = GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification)) ??
|
var profile = GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification));
|
||||||
GetDefaultProfile();
|
|
||||||
|
|
||||||
|
if (profile != null)
|
||||||
|
{
|
||||||
_logger.Debug("Found matching device profile: {0}", profile.Name);
|
_logger.Debug("Found matching device profile: {0}", profile.Name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("No matching device profile found. The default will need to be used.");
|
||||||
|
}
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -176,8 +182,7 @@ namespace MediaBrowser.Dlna
|
||||||
|
|
||||||
public DeviceProfile GetProfile(IDictionary<string, string> headers)
|
public DeviceProfile GetProfile(IDictionary<string, string> headers)
|
||||||
{
|
{
|
||||||
return GetProfiles().FirstOrDefault(i => IsMatch(headers, i.Identification)) ??
|
return GetProfiles().FirstOrDefault(i => IsMatch(headers, i.Identification));
|
||||||
GetDefaultProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsMatch(IDictionary<string, string> headers, DeviceIdentification profileInfo)
|
private bool IsMatch(IDictionary<string, string> headers, DeviceIdentification profileInfo)
|
||||||
|
|
|
@ -419,7 +419,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
var deviceInfo = _device.Properties;
|
var deviceInfo = _device.Properties;
|
||||||
|
|
||||||
var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification());
|
var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
|
||||||
|
_dlnaManager.GetDefaultProfile();
|
||||||
|
|
||||||
var playlistItem = GetPlaylistItem(item, streams, profile);
|
var playlistItem = GetPlaylistItem(item, streams, profile);
|
||||||
playlistItem.StartPositionTicks = startPostionTicks;
|
playlistItem.StartPositionTicks = startPostionTicks;
|
||||||
|
|
Loading…
Reference in a new issue