aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-26 11:17:36 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-26 11:17:36 -0400
commitde19966074eb17b025d4e21415cca8aaea4cdc56 (patch)
treee4784f7c7ff4454615f4661bf02e387d4a7d5ae2
parent4e2764e516ba62506aa85765401769d0bc7192aa (diff)
use profile id in streaming service
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs11
-rw-r--r--MediaBrowser.Controller/Dlna/IDlnaManager.cs6
-rw-r--r--MediaBrowser.Dlna/DlnaManager.cs15
-rw-r--r--MediaBrowser.Dlna/PlayTo/DlnaController.cs3
4 files changed, 28 insertions, 7 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index c365fcd82..2002e594c 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1492,7 +1492,16 @@ namespace MediaBrowser.Api.Playback
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);
diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs
index dd9b0e8a8..dfed5e310 100644
--- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs
+++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs
@@ -19,6 +19,12 @@ namespace MediaBrowser.Controller.Dlna
DeviceProfile GetProfile(IDictionary<string,string> headers);
/// <summary>
+ /// Gets the default profile.
+ /// </summary>
+ /// <returns>DeviceProfile.</returns>
+ DeviceProfile GetDefaultProfile();
+
+ /// <summary>
/// Gets the profile.
/// </summary>
/// <param name="id">The identifier.</param>
diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs
index 9d9df01e6..a879b5cc5 100644
--- a/MediaBrowser.Dlna/DlnaManager.cs
+++ b/MediaBrowser.Dlna/DlnaManager.cs
@@ -107,10 +107,16 @@ namespace MediaBrowser.Dlna
public DeviceProfile GetProfile(DeviceIdentification deviceInfo)
{
- var profile = GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification)) ??
- GetDefaultProfile();
+ var profile = GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification));
- _logger.Debug("Found matching device profile: {0}", profile.Name);
+ if (profile != null)
+ {
+ _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;
}
@@ -176,8 +182,7 @@ namespace MediaBrowser.Dlna
public DeviceProfile GetProfile(IDictionary<string, string> headers)
{
- return GetProfiles().FirstOrDefault(i => IsMatch(headers, i.Identification)) ??
- GetDefaultProfile();
+ return GetProfiles().FirstOrDefault(i => IsMatch(headers, i.Identification));
}
private bool IsMatch(IDictionary<string, string> headers, DeviceIdentification profileInfo)
diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs
index f0303bd49..4bd7c717c 100644
--- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs
+++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs
@@ -419,7 +419,8 @@ namespace MediaBrowser.Dlna.PlayTo
var deviceInfo = _device.Properties;
- var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification());
+ var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
+ _dlnaManager.GetDefaultProfile();
var playlistItem = GetPlaylistItem(item, streams, profile);
playlistItem.StartPositionTicks = startPostionTicks;