From db3b106fe09e8e28a99fc817937113896d5f5169 Mon Sep 17 00:00:00 2001 From: 7illusions Date: Sat, 15 Mar 2014 17:11:10 +0100 Subject: [PATCH 1/2] Updated PlayTo profiles and recognition --- MediaBrowser.Controller/Dlna/DeviceProfile.cs | 8 + MediaBrowser.Controller/Dlna/IDlnaManager.cs | 5 +- MediaBrowser.Dlna/DlnaManager.cs | 204 +++++++++++++++++- MediaBrowser.Dlna/PlayTo/DlnaController.cs | 4 +- MediaBrowser.Dlna/PlayTo/PlayToManager.cs | 3 +- 5 files changed, 216 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Controller/Dlna/DeviceProfile.cs b/MediaBrowser.Controller/Dlna/DeviceProfile.cs index 3fecf957b..f3a3bc171 100644 --- a/MediaBrowser.Controller/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Controller/Dlna/DeviceProfile.cs @@ -33,6 +33,14 @@ namespace MediaBrowser.Controller.Dlna /// The name of the model. public string ModelName { get; set; } + /// + /// Gets or sets the manufacturer. + /// + /// + /// The manufacturer. + /// + public string Manufacturer { get; set; } + /// /// Gets or sets the transcoding profiles. /// diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs index 04f658805..599b42dd5 100644 --- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs +++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs @@ -22,7 +22,8 @@ namespace MediaBrowser.Controller.Dlna /// Name of the friendly. /// Name of the model. /// The model number. - /// DlnaProfile. - DeviceProfile GetProfile(string friendlyName, string modelName, string modelNumber); + /// The manufacturer. + /// DlnaProfile. + DeviceProfile GetProfile(string friendlyName, string modelName, string modelNumber, string manufacturer); } } diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 91d205b47..b1e6dc5e5 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -25,6 +25,8 @@ namespace MediaBrowser.Dlna { var list = new List(); + #region Samsung + list.Add(new DeviceProfile { Name = "Samsung TV (B Series)", @@ -169,6 +171,10 @@ namespace MediaBrowser.Dlna } }); + #endregion + + #region Xbox + list.Add(new DeviceProfile { Name = "Xbox 360", @@ -198,7 +204,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { Containers = new[]{"avi"}, - MimeType = "x-msvideo", + MimeType = "avi", Type = DlnaProfileType.Video } } @@ -240,6 +246,10 @@ namespace MediaBrowser.Dlna } }); + #endregion + + #region Sony + list.Add(new DeviceProfile { Name = "Sony Bravia (2012)", @@ -276,6 +286,173 @@ namespace MediaBrowser.Dlna } }); + list.Add(new DeviceProfile + { + Name = "Sony Bravia (2013)", + ClientType = "DLNA", + FriendlyName = @"BRAVIA (KDL-\d{2}W[689]\d{2}A.*)|(KD-\d{2}X9\d{3}A.*)", + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + Type = DlnaProfileType.Video, + MimeType = "mpeg" + } + }, + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Containers = new[]{"mp3"}, + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Containers = new[]{"wma"}, + Type = DlnaProfileType.Audio, + MimeType = "x-ms-wma" + }, + new DirectPlayProfile + { + Containers = new[]{"avi"}, + Type = DlnaProfileType.Video, + MimeType = "avi" + }, + new DirectPlayProfile + { + Containers = new[]{"mp4"}, + Type = DlnaProfileType.Video, + MimeType = "mp4" + } + } + }); + + #endregion + + #region Panasonic + + list.Add(new DeviceProfile + { + //Panasonic Viera (2011|2012) Without AVI Support + Name = "Panasonic Viera E/S/ST/VT (2011)", + ClientType = "DLNA", + FriendlyName = @"(VIERA (E|S)T?(3|5)0?.*)|(VIERA VT30.*)", + Manufacturer = "Panasonic", + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + Type = DlnaProfileType.Video + } + }, + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Containers = new[]{"mp3"}, + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Containers = new[]{"mkv"}, + Type = DlnaProfileType.Video + } + } + }); + + list.Add(new DeviceProfile + { + //Panasonic Viera (2011|2012) With AVI Support + Name = "Panasonic Viera G/GT/DT/UT/VT (2011/2012)", + ClientType = "DLNA", + FriendlyName = @"(VIERA (G|D|U)T?(3|5)0?.*)|(VIERA VT50.*)", + Manufacturer = "Panasonic", + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + Type = DlnaProfileType.Video + } + }, + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Containers = new[]{"mp3"}, + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Containers = new[]{"mkv"}, + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Containers = new[]{"avi"}, + Type = DlnaProfileType.Video , + MimeType="divx" + } + } + }); + + #endregion + + //WDTV does not need any transcoding of the formats we support statically + list.Add(new DeviceProfile + { + Name = "Philips (2010-)", + FriendlyName = ".*PHILIPS.*", + ClientType = "DLNA", + ModelName = "WD TV HD Live", + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Containers = new[]{"mp3", "wma"}, + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Containers = new[]{"avi"}, + Type = DlnaProfileType.Video, + MimeType = "avi" + }, + + new DirectPlayProfile + { + Containers = new[]{"mkv"}, + Type = DlnaProfileType.Video, + MimeType = "x-matroska" + } + } + }); + //WDTV does not need any transcoding of the formats we support statically list.Add(new DeviceProfile { @@ -322,6 +499,23 @@ namespace MediaBrowser.Dlna } }); + list.Add(new DeviceProfile + { + Name = "Denon AVR", + FriendlyName = @"Denon:\[AVR:.*", + Manufacturer = "Denon", + ClientType = "DLNA", + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Containers = new[]{"mp3", "flac", "m4a", "wma"}, + Type = DlnaProfileType.Audio + }, + } + }); + foreach (var item in list) { //_xmlSerializer.SerializeToFile(item, "d:\\" + _fileSystem.GetValidFilename(item.Name)); @@ -365,7 +559,7 @@ namespace MediaBrowser.Dlna }; } - public DeviceProfile GetProfile(string friendlyName, string modelName, string modelNumber) + public DeviceProfile GetProfile(string friendlyName, string modelName, string modelNumber, string manufacturer) { foreach (var profile in GetProfiles()) { @@ -387,6 +581,12 @@ namespace MediaBrowser.Dlna continue; } + if (!string.IsNullOrEmpty(profile.Manufacturer)) + { + if (!Regex.IsMatch(manufacturer, profile.Manufacturer)) + continue; + } + return profile; } diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index 5836a1639..7885ee481 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -386,7 +386,7 @@ namespace MediaBrowser.Dlna.PlayTo var deviceInfo = _device.Properties; - var playlistItem = PlaylistItem.Create(item, _dlnaManager.GetProfile(deviceInfo.Name, deviceInfo.ModelName, deviceInfo.ModelNumber)); + var playlistItem = PlaylistItem.Create(item, _dlnaManager.GetProfile(deviceInfo.Name, deviceInfo.ModelName, deviceInfo.ModelNumber, deviceInfo.Manufacturer)); playlistItem.StartPositionTicks = startPostionTicks; if (playlistItem.IsAudio) @@ -485,7 +485,7 @@ namespace MediaBrowser.Dlna.PlayTo _updateTimer.Stop(); _disposed = true; _device.Dispose(); - _logger.Log(LogSeverity.Debug, "PlayTo - Controller disposed"); + _logger.Log(LogSeverity.Debug, "Controller disposed"); } } } diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs index d1fdc9626..cb30498e6 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs @@ -243,8 +243,7 @@ namespace MediaBrowser.Dlna.PlayTo /// The TranscodeSettings for the device private void GetProfileSettings(DeviceInfo deviceProperties) { - var profile = _dlnaManager.GetProfile(deviceProperties.DisplayName, deviceProperties.ModelName, - deviceProperties.ModelNumber); + var profile = _dlnaManager.GetProfile(deviceProperties.Name, deviceProperties.ModelName, deviceProperties.ModelNumber, deviceProperties.Manufacturer); if (!string.IsNullOrWhiteSpace(profile.Name)) { From e4a84aac974414eb517e17782caf709b369588d2 Mon Sep 17 00:00:00 2001 From: 7illusions Date: Sat, 15 Mar 2014 19:47:50 +0100 Subject: [PATCH 2/2] Improved PlayTo profile Samsung F series --- MediaBrowser.Dlna/DlnaManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index b1e6dc5e5..6766400d9 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -40,7 +40,7 @@ namespace MediaBrowser.Dlna new TranscodingProfile { Container = "mp3", - Type = DlnaProfileType.Audio + Type = DlnaProfileType.Audio, }, new TranscodingProfile { @@ -54,7 +54,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { Containers = new[]{"mp3"}, - Type = DlnaProfileType.Audio + Type = DlnaProfileType.Audio, }, new DirectPlayProfile { @@ -74,13 +74,15 @@ namespace MediaBrowser.Dlna Type = DlnaProfileType.Video } } + + }); list.Add(new DeviceProfile { Name = "Samsung TV (E/F-series)", ClientType = "DLNA", - FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung", + FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung|(^\[TV\]Samsung [A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)", ModelNumber = @"(1\.0)|(AllShare1\.0)", TranscodingProfiles = new[]