From 56fb08eeed47102c0b0f8cf656036586e3e99bf2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 Dec 2016 10:40:20 -0500 Subject: [PATCH 1/3] added delete helper --- Emby.Dlna/Didl/DidlBuilder.cs | 19 ++++++++++--------- .../SqliteNotificationsRepository.cs | 14 +++++++------- .../TV/MissingEpisodeProvider.cs | 4 ++++ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 3ad33f0fec..3dcdaf2efc 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -214,16 +214,17 @@ namespace Emby.Dlna.Didl AddVideoResource(writer, video, deviceId, filter, contentFeature, streamInfo); } - foreach (var subtitle in streamInfo.GetSubtitleProfiles(false, _serverAddress, _accessToken)) - { - if (subtitle.DeliveryMethod == SubtitleDeliveryMethod.External) - { - var subtitleAdded = AddSubtitleElement(writer, subtitle); + var subtitleProfiles = streamInfo.GetSubtitleProfiles(false, _serverAddress, _accessToken) + .Where(subtitle => subtitle.DeliveryMethod == SubtitleDeliveryMethod.External) + .ToList(); - if (subtitleAdded && _profile.EnableSingleSubtitleLimit) - { - break; - } + foreach (var subtitle in subtitleProfiles) + { + var subtitleAdded = AddSubtitleElement(writer, subtitle); + + if (subtitleAdded && _profile.EnableSingleSubtitleLimit) + { + break; } } } diff --git a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs index 767ba55049..aae41da198 100644 --- a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs +++ b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs @@ -115,18 +115,18 @@ namespace Emby.Server.Implementations.Notifications statement.TryBind("@IsRead", false); statement.TryBind("@UserId", userId.ToGuidParamValue()); + var levels = new List(); + foreach (var row in statement.ExecuteQuery()) { - var levels = new List(); - levels.Add(GetLevel(row, 0)); + } - result.UnreadCount = levels.Count; + result.UnreadCount = levels.Count; - if (levels.Count > 0) - { - result.MaxUnreadNotificationLevel = levels.Max(); - } + if (levels.Count > 0) + { + result.MaxUnreadNotificationLevel = levels.Max(); } } diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 05ca7c7d9a..4992675da2 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -232,11 +232,15 @@ namespace MediaBrowser.Providers.TV { continue; } + var now = DateTime.UtcNow; var targetSeries = DetermineAppropriateSeries(series, tuple.Item1); var seasonOffset = TvdbSeriesProvider.GetSeriesOffset(targetSeries.ProviderIds) ?? ((targetSeries.AnimeSeriesIndex ?? 1) - 1); + var unairedThresholdDays = 1; + now = now.AddDays(0 - unairedThresholdDays); + if (airDate.Value < now) { if (addMissingEpisodes) From c7d520555b8fe6eacc0ed7ac384b6f16358a38ae Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 9 Dec 2016 02:23:09 -0500 Subject: [PATCH 2/3] update dlna profiles --- Emby.Dlna/DlnaManager.cs | 50 +-- Emby.Dlna/Emby.Dlna.csproj | 74 ++-- .../ProfileSerialization/CodecProfile.cs | 68 ---- .../ProfileSerialization/ContainerProfile.cs | 31 -- .../ProfileSerialization/DeviceProfile.cs | 351 ------------------ .../ProfileSerialization/DirectPlayProfile.cs | 51 --- .../ProfileSerialization/HttpHeaderInfo.cs | 17 - .../ProfileSerialization/ProfileCondition.cs | 39 -- .../ProfileSerialization/ResponseProfile.cs | 64 ---- .../ProfileSerialization/SubtitleProfile.cs | 48 --- .../TranscodingProfile.cs | 58 --- .../ProfileSerialization/XmlAttribute.cs | 13 - Emby.Dlna/Profiles/Json/BubbleUPnp.json | 1 - Emby.Dlna/Profiles/Json/Default.json | 1 - Emby.Dlna/Profiles/Json/Denon AVR.json | 1 - Emby.Dlna/Profiles/Json/DirecTV HD-DVR.json | 1 - Emby.Dlna/Profiles/Json/Dish Hopper-Joey.json | 1 - Emby.Dlna/Profiles/Json/Kodi.json | 1 - Emby.Dlna/Profiles/Json/LG Smart TV.json | 1 - Emby.Dlna/Profiles/Json/Linksys DMA2100.json | 1 - Emby.Dlna/Profiles/Json/MediaMonkey.json | 1 - Emby.Dlna/Profiles/Json/Panasonic Viera.json | 1 - Emby.Dlna/Profiles/Json/Popcorn Hour.json | 1 - Emby.Dlna/Profiles/Json/Samsung Smart TV.json | 1 - .../Json/Sony Blu-ray Player 2013.json | 1 - .../Json/Sony Blu-ray Player 2014.json | 1 - .../Json/Sony Blu-ray Player 2015.json | 1 - .../Json/Sony Blu-ray Player 2016.json | 1 - .../Profiles/Json/Sony Blu-ray Player.json | 1 - .../Profiles/Json/Sony Bravia (2010).json | 1 - .../Profiles/Json/Sony Bravia (2011).json | 1 - .../Profiles/Json/Sony Bravia (2012).json | 1 - .../Profiles/Json/Sony Bravia (2013).json | 1 - .../Profiles/Json/Sony Bravia (2014).json | 1 - .../Profiles/Json/Sony PlayStation 3.json | 1 - .../Profiles/Json/Sony PlayStation 4.json | 1 - Emby.Dlna/Profiles/Json/Vlc.json | 1 - Emby.Dlna/Profiles/Json/WDTV Live.json | 1 - Emby.Dlna/Profiles/Json/Xbox 360.json | 1 - Emby.Dlna/Profiles/Json/Xbox One.json | 1 - Emby.Dlna/Profiles/Json/foobar2000.json | 1 - Emby.Dlna/Profiles/Xml/BubbleUPnp.xml | 62 ++++ Emby.Dlna/Profiles/Xml/Default.xml | 50 +++ Emby.Dlna/Profiles/Xml/Denon AVR.xml | 50 +++ Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml | 67 ++++ Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml | 92 +++++ Emby.Dlna/Profiles/Xml/Kodi.xml | 62 ++++ Emby.Dlna/Profiles/Xml/LG Smart TV.xml | 87 +++++ Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml | 50 +++ Emby.Dlna/Profiles/Xml/MediaMonkey.xml | 56 +++ Emby.Dlna/Profiles/Xml/Panasonic Viera.xml | 84 +++++ Emby.Dlna/Profiles/Xml/Popcorn Hour.xml | 88 +++++ Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml | 125 +++++++ .../Profiles/Xml/Sony Blu-ray Player 2013.xml | 87 +++++ .../Profiles/Xml/Sony Blu-ray Player 2014.xml | 87 +++++ .../Profiles/Xml/Sony Blu-ray Player 2015.xml | 85 +++++ .../Profiles/Xml/Sony Blu-ray Player 2016.xml | 85 +++++ .../Profiles/Xml/Sony Blu-ray Player.xml | 112 ++++++ Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml | 133 +++++++ Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml | 136 +++++++ Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml | 112 ++++++ Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml | 111 ++++++ Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml | 111 ++++++ Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml | 105 ++++++ Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml | 105 ++++++ Emby.Dlna/Profiles/Xml/Vlc.xml | 62 ++++ Emby.Dlna/Profiles/Xml/WDTV Live.xml | 94 +++++ Emby.Dlna/Profiles/Xml/Xbox 360.xml | 116 ++++++ Emby.Dlna/Profiles/Xml/Xbox One.xml | 123 ++++++ Emby.Dlna/Profiles/Xml/foobar2000.xml | 56 +++ Emby.Server.Core/ApplicationHost.cs | 1 - .../Entities/Movies/Movie.cs | 13 +- MediaBrowser.Model/Dlna/CodecProfile.cs | 4 + MediaBrowser.Model/Dlna/ContainerProfile.cs | 3 + MediaBrowser.Model/Dlna/DeviceProfile.cs | 57 +-- MediaBrowser.Model/Dlna/DirectPlayProfile.cs | 6 + MediaBrowser.Model/Dlna/HttpHeaderInfo.cs | 4 + MediaBrowser.Model/Dlna/ProfileCondition.cs | 5 + MediaBrowser.Model/Dlna/ResponseProfile.cs | 7 + MediaBrowser.Model/Dlna/SubtitleProfile.cs | 5 + MediaBrowser.Model/Dlna/TranscodingProfile.cs | 14 + MediaBrowser.Model/Dlna/XmlAttribute.cs | 2 + MediaBrowser.Model/System/SystemInfo.cs | 6 - 83 files changed, 2738 insertions(+), 875 deletions(-) delete mode 100644 Emby.Dlna/ProfileSerialization/CodecProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/ContainerProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/DeviceProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/DirectPlayProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/HttpHeaderInfo.cs delete mode 100644 Emby.Dlna/ProfileSerialization/ProfileCondition.cs delete mode 100644 Emby.Dlna/ProfileSerialization/ResponseProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/SubtitleProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/TranscodingProfile.cs delete mode 100644 Emby.Dlna/ProfileSerialization/XmlAttribute.cs delete mode 100644 Emby.Dlna/Profiles/Json/BubbleUPnp.json delete mode 100644 Emby.Dlna/Profiles/Json/Default.json delete mode 100644 Emby.Dlna/Profiles/Json/Denon AVR.json delete mode 100644 Emby.Dlna/Profiles/Json/DirecTV HD-DVR.json delete mode 100644 Emby.Dlna/Profiles/Json/Dish Hopper-Joey.json delete mode 100644 Emby.Dlna/Profiles/Json/Kodi.json delete mode 100644 Emby.Dlna/Profiles/Json/LG Smart TV.json delete mode 100644 Emby.Dlna/Profiles/Json/Linksys DMA2100.json delete mode 100644 Emby.Dlna/Profiles/Json/MediaMonkey.json delete mode 100644 Emby.Dlna/Profiles/Json/Panasonic Viera.json delete mode 100644 Emby.Dlna/Profiles/Json/Popcorn Hour.json delete mode 100644 Emby.Dlna/Profiles/Json/Samsung Smart TV.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2013.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2014.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2015.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Blu-ray Player 2016.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Blu-ray Player.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Bravia (2010).json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Bravia (2011).json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Bravia (2012).json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Bravia (2013).json delete mode 100644 Emby.Dlna/Profiles/Json/Sony Bravia (2014).json delete mode 100644 Emby.Dlna/Profiles/Json/Sony PlayStation 3.json delete mode 100644 Emby.Dlna/Profiles/Json/Sony PlayStation 4.json delete mode 100644 Emby.Dlna/Profiles/Json/Vlc.json delete mode 100644 Emby.Dlna/Profiles/Json/WDTV Live.json delete mode 100644 Emby.Dlna/Profiles/Json/Xbox 360.json delete mode 100644 Emby.Dlna/Profiles/Json/Xbox One.json delete mode 100644 Emby.Dlna/Profiles/Json/foobar2000.json create mode 100644 Emby.Dlna/Profiles/Xml/BubbleUPnp.xml create mode 100644 Emby.Dlna/Profiles/Xml/Default.xml create mode 100644 Emby.Dlna/Profiles/Xml/Denon AVR.xml create mode 100644 Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml create mode 100644 Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml create mode 100644 Emby.Dlna/Profiles/Xml/Kodi.xml create mode 100644 Emby.Dlna/Profiles/Xml/LG Smart TV.xml create mode 100644 Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml create mode 100644 Emby.Dlna/Profiles/Xml/MediaMonkey.xml create mode 100644 Emby.Dlna/Profiles/Xml/Panasonic Viera.xml create mode 100644 Emby.Dlna/Profiles/Xml/Popcorn Hour.xml create mode 100644 Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml create mode 100644 Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml create mode 100644 Emby.Dlna/Profiles/Xml/Vlc.xml create mode 100644 Emby.Dlna/Profiles/Xml/WDTV Live.xml create mode 100644 Emby.Dlna/Profiles/Xml/Xbox 360.xml create mode 100644 Emby.Dlna/Profiles/Xml/Xbox One.xml create mode 100644 Emby.Dlna/Profiles/Xml/foobar2000.xml diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index 6ca5a393e7..4daaa50464 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -289,23 +289,13 @@ namespace Emby.Dlna var allFiles = _fileSystem.GetFiles(path) .ToList(); - var xmlFies = type == DeviceProfileType.System ? - new List() : - allFiles + var xmlFies = allFiles .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase)) .ToList(); - var jsonFiles = allFiles - .Where(i => string.Equals(i.Extension, ".json", StringComparison.OrdinalIgnoreCase)) - .ToList(); + var parseFiles = new List(); - var jsonFileNames = jsonFiles - .Select(i => Path.GetFileNameWithoutExtension(i.Name)) - .ToList(); - - var parseFiles = jsonFiles.ToList(); - - parseFiles.AddRange(xmlFies.Where(i => !jsonFileNames.Contains(Path.GetFileNameWithoutExtension(i.Name), StringComparer.Ordinal))); + parseFiles.AddRange(xmlFies); return parseFiles .Select(i => ParseProfileFile(i.FullName, type)) @@ -334,10 +324,9 @@ namespace Emby.Dlna if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase)) { - var tempProfile = (ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path); + var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path); - var json = _jsonSerializer.SerializeToString(tempProfile); - profile = (DeviceProfile)_jsonSerializer.DeserializeFromString(json); + profile = ReserializeProfile(tempProfile); } else { @@ -406,7 +395,7 @@ namespace Emby.Dlna private void ExtractSystemProfiles() { - var namespaceName = GetType().Namespace + ".Profiles.Json."; + var namespaceName = GetType().Namespace + ".Profiles.Xml."; var systemProfilesPath = SystemProfilesPath; @@ -464,7 +453,7 @@ namespace Emby.Dlna throw new ArgumentException("Profile is missing Name"); } - var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".json"; + var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".xml"; var path = Path.Combine(UserProfilesPath, newFilename); SaveProfile(profile, path, DeviceProfileType.User); @@ -485,7 +474,7 @@ namespace Emby.Dlna var current = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, profile.Id, StringComparison.OrdinalIgnoreCase)); - var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".json"; + var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".xml"; var path = Path.Combine(UserProfilesPath, newFilename); if (!string.Equals(path, current.Path, StringComparison.Ordinal) && @@ -503,21 +492,12 @@ namespace Emby.Dlna { _profiles[path] = new Tuple(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile); } - SerializeToJson(profile, path); + SerializeToXml(profile, path); } - internal void SerializeToJson(DeviceProfile profile, string path) + internal void SerializeToXml(DeviceProfile profile, string path) { - _jsonSerializer.SerializeToFile(profile, path); - - try - { - _fileSystem.DeleteFile(Path.ChangeExtension(path, ".xml")); - } - catch - { - - } + _xmlSerializer.SerializeToFile(profile, path); } /// @@ -575,12 +555,14 @@ namespace Emby.Dlna private readonly IApplicationPaths _appPaths; private readonly IJsonSerializer _jsonSerializer; private readonly IFileSystem _fileSystem; + private readonly IXmlSerializer _xmlSerializer; - public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer) + public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer) { _appPaths = appPaths; _fileSystem = fileSystem; _jsonSerializer = jsonSerializer; + _xmlSerializer = xmlSerializer; } public void Run() @@ -628,9 +610,9 @@ namespace Emby.Dlna foreach (var item in list) { - var path = Path.Combine(_appPaths.ProgramDataPath, _fileSystem.GetValidFilename(item.Name) + ".json"); + var path = Path.Combine(_appPaths.ProgramDataPath, _fileSystem.GetValidFilename(item.Name) + ".xml"); - _jsonSerializer.SerializeToFile(item, path); + _xmlSerializer.SerializeToFile(item, path); } } diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index 4d1aacfec5..c83aaecab2 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -33,38 +33,6 @@ prompt 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -111,16 +79,6 @@ - - - - - - - - - - @@ -190,6 +148,38 @@ RSSDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +