From be75d1f3e42124b907175d693eac82d26adfc138 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 30 Oct 2016 03:48:34 -0400 Subject: [PATCH 1/7] update BaseXmlSaver --- .../project.fragment.lock.json | 17 ++++------- Emby.Dlna/project.fragment.lock.json | 28 +++++-------------- .../Savers/BaseXmlSaver.cs | 28 +++++++++---------- Mono.Nat/project.fragment.lock.json | 17 ++++------- 4 files changed, 31 insertions(+), 59 deletions(-) diff --git a/Emby.Common.Implementations/project.fragment.lock.json b/Emby.Common.Implementations/project.fragment.lock.json index 6a89a6320..0d8df5a0e 100644 --- a/Emby.Common.Implementations/project.fragment.lock.json +++ b/Emby.Common.Implementations/project.fragment.lock.json @@ -5,30 +5,23 @@ "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Common.dll": {} + "bin/Release/MediaBrowser.Common.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Common.dll": {} - }, - "contentFiles": { - "bin/Debug/MediaBrowser.Common.pdb": { - "buildAction": "None", - "codeLanguage": "any", - "copyToOutput": true - } + "bin/Release/MediaBrowser.Common.dll": {} } }, "MediaBrowser.Model/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "contentFiles": { - "bin/Debug/MediaBrowser.Model.pdb": { + "bin/Release/MediaBrowser.Model.pdb": { "buildAction": "None", "codeLanguage": "any", "copyToOutput": true diff --git a/Emby.Dlna/project.fragment.lock.json b/Emby.Dlna/project.fragment.lock.json index 09e853c1c..df837d207 100644 --- a/Emby.Dlna/project.fragment.lock.json +++ b/Emby.Dlna/project.fragment.lock.json @@ -5,47 +5,33 @@ "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Common.dll": {} + "bin/Release/MediaBrowser.Common.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Common.dll": {} - }, - "contentFiles": { - "bin/Debug/MediaBrowser.Common.pdb": { - "buildAction": "None", - "codeLanguage": "any", - "copyToOutput": true - } + "bin/Release/MediaBrowser.Common.dll": {} } }, "MediaBrowser.Controller/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Controller.dll": {} + "bin/Release/MediaBrowser.Controller.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Controller.dll": {} - }, - "contentFiles": { - "bin/Debug/MediaBrowser.Controller.pdb": { - "buildAction": "None", - "codeLanguage": "any", - "copyToOutput": true - } + "bin/Release/MediaBrowser.Controller.dll": {} } }, "MediaBrowser.Model/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "contentFiles": { - "bin/Debug/MediaBrowser.Model.pdb": { + "bin/Release/MediaBrowser.Model.pdb": { "buildAction": "None", "codeLanguage": "any", "copyToOutput": true diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 85877cc5a..5ae7f11b5 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -310,24 +310,24 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("ContentRating", item.OfficialRating); } - //if (!string.IsNullOrEmpty(item.OfficialRatingDescription)) - //{ - // builder.Append("" + SecurityElement.Escape(item.OfficialRatingDescription) + ""); - //} + if (!string.IsNullOrEmpty(item.OfficialRatingDescription)) + { + writer.WriteElementString("MPAADescription", item.OfficialRatingDescription); + } - //builder.Append("" + SecurityElement.Escape(item.DateCreated.ToLocalTime().ToString("G")) + ""); + writer.WriteElementString("Added", item.DateCreated.ToLocalTime().ToString("G")); - //builder.Append("" + item.IsLocked.ToString().ToLower() + ""); + writer.WriteElementString("LockData", item.IsLocked.ToString().ToLower()); - //if (item.LockedFields.Count > 0) - //{ - // builder.Append("" + string.Join("|", item.LockedFields.Select(i => i.ToString()).ToArray()) + ""); - //} + if (item.LockedFields.Count > 0) + { + writer.WriteElementString("LockedFields", string.Join("|", item.LockedFields.Select(i => i.ToString()).ToArray())); + } - //if (!string.IsNullOrEmpty(item.DisplayMediaType)) - //{ - // builder.Append("" + SecurityElement.Escape(item.DisplayMediaType) + ""); - //} + if (!string.IsNullOrEmpty(item.DisplayMediaType)) + { + writer.WriteElementString("Type", item.DisplayMediaType); + } //if (item.CriticRating.HasValue) //{ diff --git a/Mono.Nat/project.fragment.lock.json b/Mono.Nat/project.fragment.lock.json index 6a89a6320..0d8df5a0e 100644 --- a/Mono.Nat/project.fragment.lock.json +++ b/Mono.Nat/project.fragment.lock.json @@ -5,30 +5,23 @@ "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Common.dll": {} + "bin/Release/MediaBrowser.Common.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Common.dll": {} - }, - "contentFiles": { - "bin/Debug/MediaBrowser.Common.pdb": { - "buildAction": "None", - "codeLanguage": "any", - "copyToOutput": true - } + "bin/Release/MediaBrowser.Common.dll": {} } }, "MediaBrowser.Model/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "runtime": { - "bin/Debug/MediaBrowser.Model.dll": {} + "bin/Release/MediaBrowser.Model.dll": {} }, "contentFiles": { - "bin/Debug/MediaBrowser.Model.pdb": { + "bin/Release/MediaBrowser.Model.pdb": { "buildAction": "None", "codeLanguage": "any", "copyToOutput": true From e32c9d54fd3f7190f117bd1ca563e744feb919bf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 30 Oct 2016 14:38:22 -0400 Subject: [PATCH 2/7] update mac project --- .../Emby.Server.Mac.csproj | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj index cb3551ca5..6995a5bec 100644 --- a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj @@ -690,9 +690,6 @@ Resources\dashboard-ui\wizardlivetvtuner.html - - Resources\dashboard-ui\wizardservice.html - Resources\dashboard-ui\wizardsettings.html @@ -1692,6 +1689,12 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\refreshdialog\refreshdialog.js + + Resources\dashboard-ui\bower_components\emby-webcomponents\registrationservices\registrationservices.js + + + Resources\dashboard-ui\bower_components\emby-webcomponents\registrationservices\style.css + Resources\dashboard-ui\bower_components\emby-webcomponents\require\requirecss.js @@ -2607,8 +2610,8 @@ Resources\dashboard-ui\bower_components\vibrant\website.coffee - - Resources\dashboard-ui\bower_components\vibrant\dist\Vibrant.js + + Resources\dashboard-ui\bower_components\vibrant\dist\vibrant.js Resources\dashboard-ui\bower_components\vibrant\dist\vibrant.min.js @@ -2673,6 +2676,9 @@ Resources\dashboard-ui\components\humanedate.js + + Resources\dashboard-ui\components\iap.js + Resources\dashboard-ui\components\remotecontrol.js @@ -3396,9 +3402,6 @@ Resources\dashboard-ui\scripts\pluginspage.js - - Resources\dashboard-ui\scripts\registrationservices.js - Resources\dashboard-ui\scripts\remotecontrol.js @@ -3504,9 +3507,6 @@ Resources\dashboard-ui\scripts\wizardlivetvtuner.js - - Resources\dashboard-ui\scripts\wizardservice.js - Resources\dashboard-ui\scripts\wizardsettings.js From 0579f245e47334094c03583defc1baf434de2b36 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 30 Oct 2016 14:42:45 -0400 Subject: [PATCH 3/7] update theme --- .../Savers/BaseXmlSaver.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 5ae7f11b5..9cfca3086 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -329,20 +329,20 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("Type", item.DisplayMediaType); } - //if (item.CriticRating.HasValue) - //{ - // builder.Append("" + SecurityElement.Escape(item.CriticRating.Value.ToString(UsCulture)) + ""); - //} + if (item.CriticRating.HasValue) + { + writer.WriteElementString("CriticRating", item.CriticRating.Value.ToString(UsCulture)); + } - //if (!string.IsNullOrEmpty(item.CriticRatingSummary)) - //{ - // builder.Append(""); - //} + if (!string.IsNullOrEmpty(item.CriticRatingSummary)) + { + writer.WriteElementString("CriticRatingSummary", item.CriticRatingSummary); + } - //if (!string.IsNullOrEmpty(item.Overview)) - //{ - // builder.Append(""); - //} + if (!string.IsNullOrEmpty(item.Overview)) + { + writer.WriteElementString("Overview", item.Overview); + } //var hasOriginalTitle = item as IHasOriginalTitle; //if (hasOriginalTitle != null) From 3bf72b71b35c031e89a1b45ddc717e3d5d45afb0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 31 Oct 2016 00:28:23 -0400 Subject: [PATCH 4/7] consolidate internal interfaces --- .../IO/ManagedFileSystem.cs | 8 +- Emby.Drawing/ImageProcessor.cs | 51 +++------ MediaBrowser.Common/MediaBrowser.Common.xproj | 19 ---- .../Entities/Audio/Audio.cs | 5 +- MediaBrowser.Controller/Entities/BaseItem.cs | 10 ++ .../Entities/IHasOriginalTitle.cs | 8 -- .../Entities/IThemeMedia.cs | 8 -- .../Entities/Movies/Movie.cs | 2 +- MediaBrowser.Controller/Entities/TV/Series.cs | 2 +- MediaBrowser.Controller/Entities/Trailer.cs | 2 +- MediaBrowser.Controller/Entities/Video.cs | 11 +- .../MediaBrowser.Controller.csproj | 2 - .../MediaBrowser.Controller.xproj | 19 ---- MediaBrowser.LocalMetadata/BaseXmlProvider.cs | 2 - .../Parsers/BaseItemXmlParser.cs | 8 +- .../Savers/BaseXmlSaver.cs | 106 +++++++++--------- MediaBrowser.Model/Entities/BaseItemInfo.cs | 2 + MediaBrowser.Model/MediaBrowser.Model.xproj | 19 ---- .../MediaInfo/AudioImageProvider.cs | 57 +++------- .../MediaInfo/FFProbeVideoInfo.cs | 1 - .../MediaInfo/VideoImageProvider.cs | 3 - .../EntryPoints/ActivityLogEntryPoint.cs | 6 +- .../Notifications/Notifications.cs | 3 +- ...MediaBrowser.Server.Implementations.csproj | 1 - .../Session/SessionManager.cs | 3 +- .../Sorting/VideoBitRateComparer.cs | 41 ------- .../Parsers/BaseNfoParser.cs | 8 +- .../Savers/BaseNfoSaver.cs | 8 +- 28 files changed, 114 insertions(+), 301 deletions(-) delete mode 100644 MediaBrowser.Common/MediaBrowser.Common.xproj delete mode 100644 MediaBrowser.Controller/Entities/IHasOriginalTitle.cs delete mode 100644 MediaBrowser.Controller/Entities/IThemeMedia.cs delete mode 100644 MediaBrowser.Controller/MediaBrowser.Controller.xproj delete mode 100644 MediaBrowser.Model/MediaBrowser.Model.xproj delete mode 100644 MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 6317fc08b..bfc316d3f 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -408,13 +408,13 @@ namespace Emby.Common.Implementations.IO { if (isHidden) { - FileAttributes attributes = File.GetAttributes(path); - attributes = RemoveAttribute(attributes, FileAttributes.Hidden); - File.SetAttributes(path, attributes); + File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); } else { - File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); + FileAttributes attributes = File.GetAttributes(path); + attributes = RemoveAttribute(attributes, FileAttributes.Hidden); + File.SetAttributes(path, attributes); } } } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 3235b7efa..47c9357fd 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -780,40 +780,38 @@ namespace Emby.Drawing // All enhanced images are saved as png to allow transparency var enhancedImagePath = GetCachePath(EnhancedImageCachePath, cacheGuid + ".png"); - var semaphore = GetLock(enhancedImagePath); - - await semaphore.WaitAsync().ConfigureAwait(false); - // Check again in case of contention if (_fileSystem.FileExists(enhancedImagePath)) { - semaphore.Release(); return enhancedImagePath; } - var imageProcessingLockTaken = false; + _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath)); + + var tmpPath = Path.Combine(_appPaths.TempDirectory, Path.ChangeExtension(Guid.NewGuid().ToString(), Path.GetExtension(enhancedImagePath))); + _fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath)); + + await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false); try { - _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath)); + await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, tmpPath, item, imageType, imageIndex).ConfigureAwait(false); - await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false); - - imageProcessingLockTaken = true; - - await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false); + try + { + File.Copy(tmpPath, enhancedImagePath, true); + } + catch + { + + } } finally { - if (imageProcessingLockTaken) - { - _imageProcessingSemaphore.Release(); - } - - semaphore.Release(); + _imageProcessingSemaphore.Release(); } - return enhancedImagePath; + return tmpPath; } /// @@ -838,21 +836,6 @@ namespace Emby.Drawing } } - /// - /// The _semaphoreLocks - /// - private readonly ConcurrentDictionary _semaphoreLocks = new ConcurrentDictionary(); - - /// - /// Gets the lock. - /// - /// The filename. - /// System.Object. - private SemaphoreSlim GetLock(string filename) - { - return _semaphoreLocks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1)); - } - /// /// Gets the cache path. /// diff --git a/MediaBrowser.Common/MediaBrowser.Common.xproj b/MediaBrowser.Common/MediaBrowser.Common.xproj deleted file mode 100644 index 797070193..000000000 --- a/MediaBrowser.Common/MediaBrowser.Common.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 7d5d3d18-3b43-43e6-a5a9-ac734430affd - MediaBrowser.Common - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e9a3eb512..cd4461608 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -22,8 +22,7 @@ namespace MediaBrowser.Controller.Entities.Audio IHasArtist, IHasMusicGenres, IHasLookupInfo, - IHasMediaSources, - IThemeMedia + IHasMediaSources { public List ChannelMediaSources { get; set; } @@ -39,7 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio public List AlbumArtists { get; set; } [IgnoreDataMember] - public bool IsThemeMedia + public override bool IsThemeMedia { get { diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ea3a7f79c..8211d89d2 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -203,6 +203,16 @@ namespace MediaBrowser.Controller.Entities get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } } + [IgnoreDataMember] + public virtual bool IsThemeMedia + { + get + { + return false; + } + } + + [IgnoreDataMember] public string OriginalTitle { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs b/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs deleted file mode 100644 index 6f5cb59bc..000000000 --- a/MediaBrowser.Controller/Entities/IHasOriginalTitle.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - public interface IHasOriginalTitle - { - string OriginalTitle { get; set; } - } -} diff --git a/MediaBrowser.Controller/Entities/IThemeMedia.cs b/MediaBrowser.Controller/Entities/IThemeMedia.cs deleted file mode 100644 index b2eff230f..000000000 --- a/MediaBrowser.Controller/Entities/IThemeMedia.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - public interface IThemeMedia - { - bool IsThemeMedia { get; } - } -} diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 5fee87b7a..6ae4cf9f1 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// /// Class Movie /// - public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping, IHasOriginalTitle + public class Movie : Video, IHasSpecialFeatures, IHasBudget, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping { public List SpecialFeatureIds { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 64520646b..cca8e3c19 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.TV /// /// Class Series /// - public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo, IMetadataContainer, IHasOriginalTitle + public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo, IMetadataContainer { public int? AnimeSeriesIndex { get; set; } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 08fd86743..b67e7ffe3 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class Trailer /// - public class Trailer : Video, IHasBudget, IHasMetascore, IHasOriginalTitle, IHasLookupInfo + public class Trailer : Video, IHasBudget, IHasMetascore, IHasLookupInfo { public Trailer() { diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index d86557840..6b8c894c8 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -25,8 +25,7 @@ namespace MediaBrowser.Controller.Entities public class Video : BaseItem, IHasAspectRatio, ISupportsPlaceHolders, - IHasMediaSources, - IThemeMedia + IHasMediaSources { [IgnoreDataMember] public string PrimaryVersionId { get; set; } @@ -37,7 +36,7 @@ namespace MediaBrowser.Controller.Entities public List ChannelMediaSources { get; set; } [IgnoreDataMember] - public bool IsThemeMedia + public override bool IsThemeMedia { get { @@ -113,12 +112,6 @@ namespace MediaBrowser.Controller.Entities public bool IsShortcut { get; set; } public string ShortcutPath { get; set; } - /// - /// Gets or sets the video bit rate. - /// - /// The video bit rate. - public int? VideoBitRate { get; set; } - /// /// Gets or sets the default index of the video stream. /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index d588f6127..0f26ad5ec 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -113,7 +113,6 @@ - @@ -129,7 +128,6 @@ - diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.xproj b/MediaBrowser.Controller/MediaBrowser.Controller.xproj deleted file mode 100644 index 34994695d..000000000 --- a/MediaBrowser.Controller/MediaBrowser.Controller.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - f9fe523c-6eb0-4e4d-ae26-de5c7982b063 - MediaBrowser.Controller - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs index 9f5a12104..50e9de727 100644 --- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs @@ -96,7 +96,5 @@ namespace MediaBrowser.LocalMetadata return "Emby Xml"; } } - - internal static readonly SemaphoreSlim XmlParsingResourcePool = new SemaphoreSlim(4, 4); } } diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index d54e41308..d78ddc8ea 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -163,13 +163,9 @@ namespace MediaBrowser.LocalMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrEmpty(val)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - hasOriginalTitle.OriginalTitle = val; - } + item.OriginalTitle = val; } break; } diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 9cfca3086..3a8a4c9f8 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -344,58 +344,52 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("Overview", item.Overview); } - //var hasOriginalTitle = item as IHasOriginalTitle; - //if (hasOriginalTitle != null) - //{ - // if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - // { - // builder.Append("" + SecurityElement.Escape(hasOriginalTitle.OriginalTitle) + ""); - // } - //} + if (!string.IsNullOrEmpty(item.OriginalTitle)) + { + writer.WriteElementString("OriginalTitle", item.OriginalTitle); + } + if (!string.IsNullOrEmpty(item.ShortOverview)) + { + writer.WriteElementString("ShortOverview", item.ShortOverview); + } + if (!string.IsNullOrEmpty(item.CustomRating)) + { + writer.WriteElementString("CustomRating", item.CustomRating); + } - //if (!string.IsNullOrEmpty(item.ShortOverview)) - //{ - // builder.Append(""); - //} + if (!string.IsNullOrEmpty(item.Name) && !(item is Episode)) + { + writer.WriteElementString("LocalTitle", item.Name); + } - //if (!string.IsNullOrEmpty(item.CustomRating)) - //{ - // builder.Append("" + SecurityElement.Escape(item.CustomRating) + ""); - //} + if (!string.IsNullOrEmpty(item.ForcedSortName)) + { + writer.WriteElementString("SortTitle", item.ForcedSortName); + } - //if (!string.IsNullOrEmpty(item.Name) && !(item is Episode)) - //{ - // builder.Append("" + SecurityElement.Escape(item.Name) + ""); - //} + if (item.PremiereDate.HasValue) + { + if (item is Person) + { + writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + else if (!(item is Episode)) + { + writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + } - //if (!string.IsNullOrEmpty(item.ForcedSortName)) - //{ - // builder.Append("" + SecurityElement.Escape(item.ForcedSortName) + ""); - //} - - //if (item.PremiereDate.HasValue) - //{ - // if (item is Person) - // { - // builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + ""); - // } - // else if (!(item is Episode)) - // { - // builder.Append("" + SecurityElement.Escape(item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + ""); - // } - //} - - //if (item.EndDate.HasValue) - //{ - // if (item is Person) - // { - // builder.Append("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); - // } - // else if (!(item is Episode)) - // { - // builder.Append("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); - // } - //} + if (item.EndDate.HasValue) + { + if (item is Person) + { + writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + else if (!(item is Episode)) + { + writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd")); + } + } //var hasTrailers = item as IHasTrailers; //if (hasTrailers != null) @@ -612,6 +606,8 @@ namespace MediaBrowser.LocalMetadata.Savers //{ // AddShares(hasShares, builder); //} + + AddMediaInfo(item, writer); } public static void AddShares(IHasShares item, StringBuilder builder) @@ -635,33 +631,31 @@ namespace MediaBrowser.LocalMetadata.Savers /// Appends the media info. /// /// - public static void AddMediaInfo(T item, StringBuilder builder, IItemRepository itemRepository) + public static void AddMediaInfo(T item, XmlWriter writer) where T : BaseItem { var video = item as Video; if (video != null) { - //AddChapters(video, builder, itemRepository); - if (video.Video3DFormat.HasValue) { switch (video.Video3DFormat.Value) { case Video3DFormat.FullSideBySide: - builder.Append("FSBS"); + writer.WriteElementString("Format3D", "FSBS"); break; case Video3DFormat.FullTopAndBottom: - builder.Append("FTAB"); + writer.WriteElementString("Format3D", "FTAB"); break; case Video3DFormat.HalfSideBySide: - builder.Append("HSBS"); + writer.WriteElementString("Format3D", "HSBS"); break; case Video3DFormat.HalfTopAndBottom: - builder.Append("HTAB"); + writer.WriteElementString("Format3D", "HTAB"); break; case Video3DFormat.MVC: - builder.Append("MVC"); + writer.WriteElementString("Format3D", "MVC"); break; } } diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs index af9091a78..db6c4b3fa 100644 --- a/MediaBrowser.Model/Entities/BaseItemInfo.cs +++ b/MediaBrowser.Model/Entities/BaseItemInfo.cs @@ -132,6 +132,8 @@ namespace MediaBrowser.Model.Entities /// The album. public string Album { get; set; } + public bool IsThemeMedia { get; set; } + /// /// Gets or sets the artists. /// diff --git a/MediaBrowser.Model/MediaBrowser.Model.xproj b/MediaBrowser.Model/MediaBrowser.Model.xproj deleted file mode 100644 index d4777935e..000000000 --- a/MediaBrowser.Model/MediaBrowser.Model.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25420 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - a02a9262-f007-4464-bb32-02f5f2593651 - MediaBrowser.Model - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index fee11d989..d65084287 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -6,14 +6,11 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.Providers.MediaInfo @@ -23,8 +20,6 @@ namespace MediaBrowser.Providers.MediaInfo /// public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor { - private readonly ConcurrentDictionary _locks = new ConcurrentDictionary(); - private readonly IMediaEncoder _mediaEncoder; private readonly IServerConfigurationManager _config; private readonly IFileSystem _fileSystem; @@ -67,41 +62,25 @@ namespace MediaBrowser.Providers.MediaInfo if (!_fileSystem.FileExists(path)) { - var semaphore = GetLock(path); + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); - // Acquire a lock - await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); + var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? + imageStreams.FirstOrDefault(); + + var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index; + + var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false); + + _fileSystem.CopyFile(tempFile, path, true); try { - // Check again in case it was saved while waiting for the lock - if (!_fileSystem.FileExists(path)) - { - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); - - var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? - imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? - imageStreams.FirstOrDefault(); - - var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index; - - var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false); - - _fileSystem.CopyFile(tempFile, path, true); - - try - { - _fileSystem.DeleteFile(tempFile); - } - catch - { - - } - } + _fileSystem.DeleteFile(tempFile); } - finally + catch { - semaphore.Release(); + } } @@ -145,16 +124,6 @@ namespace MediaBrowser.Providers.MediaInfo } } - /// - /// Gets the lock. - /// - /// The filename. - /// SemaphoreSlim. - private SemaphoreSlim GetLock(string filename) - { - return _locks.GetOrAdd(filename, key => new SemaphoreSlim(1, 1)); - } - public string Name { get { return "Image Extractor"; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 45fcbc251..0a070d348 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -203,7 +203,6 @@ namespace MediaBrowser.Providers.MediaInfo var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); - video.VideoBitRate = videoStream == null ? null : videoStream.BitRate; video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index; video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle); diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 5da18ac60..ca701b70f 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -13,9 +13,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.IO; namespace MediaBrowser.Providers.MediaInfo { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs index 96b8aad5d..51f5f57b3 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs @@ -123,8 +123,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return; } - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if (item.IsThemeMedia) { // Don't report theme song or local trailer playback return; @@ -156,8 +155,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return; } - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if (item.IsThemeMedia) { // Don't report theme song or local trailer playback return; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index 8f35f0e76..f3d1dc8f9 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -256,9 +256,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications } var item = e.MediaInfo; - var themeMedia = item as IThemeMedia; - if (themeMedia != null && themeMedia.IsThemeMedia) + if ( item.IsThemeMedia) { // Don't report theme song or local trailer playback return; diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 295d78a5f..f3224127a 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -367,7 +367,6 @@ - diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 9326c4f43..6d86ff091 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1611,7 +1611,8 @@ namespace MediaBrowser.Server.Implementations.Session IndexNumber = item.IndexNumber, ParentIndexNumber = item.ParentIndexNumber, PremiereDate = item.PremiereDate, - ProductionYear = item.ProductionYear + ProductionYear = item.ProductionYear, + IsThemeMedia = item.IsThemeMedia }; info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary); diff --git a/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs b/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs deleted file mode 100644 index cbf6ebac6..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/VideoBitRateComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Querying; - -namespace MediaBrowser.Server.Implementations.Sorting -{ - class VideoBitRateComparer : IBaseItemComparer - { - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - private int GetValue(BaseItem item) - { - var video = item as Video; - - if (video != null) - { - return video.VideoBitRate ?? 0; - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.VideoBitRate; } - } - } -} diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 3f10220f2..ba1e2641b 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -278,13 +278,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrEmpty(val)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - hasOriginalTitle.OriginalTitle = val; - } + item.OriginalTitle = val; } break; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index c342c209a..fc5987815 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -485,13 +485,9 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("title", item.Name ?? string.Empty); - var hasOriginalTitle = item as IHasOriginalTitle; - if (hasOriginalTitle != null) + if (!string.IsNullOrWhiteSpace(item.OriginalTitle)) { - if (!string.IsNullOrEmpty(hasOriginalTitle.OriginalTitle)) - { - writer.WriteElementString("originaltitle", hasOriginalTitle.OriginalTitle ?? string.Empty); - } + writer.WriteElementString("originaltitle", item.OriginalTitle); } var people = libraryManager.GetPeople(item); From b91dcdbff43559e4cbaa4148d56f6b7295256b7a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 31 Oct 2016 01:51:43 -0400 Subject: [PATCH 5/7] update audio queries --- .../Serialization/XmlSerializer.cs | 11 +- .../project.fragment.lock.json | 17 +- Emby.Dlna/project.fragment.lock.json | 28 ++- MediaBrowser.Api/StartupWizardService.cs | 1 + .../Entities/Audio/Audio.cs | 12 - MediaBrowser.Controller/Entities/BaseItem.cs | 15 +- MediaBrowser.Controller/Entities/Video.cs | 12 - .../Configuration/ServerConfiguration.cs | 1 + .../Channels/ChannelManager.cs | 41 +++- .../Persistence/SqliteItemRepository.cs | 90 +++++++- .../ApplicationHost.cs | 215 +++--------------- Mono.Nat/project.fragment.lock.json | 17 +- 12 files changed, 226 insertions(+), 234 deletions(-) diff --git a/Emby.Common.Implementations/Serialization/XmlSerializer.cs b/Emby.Common.Implementations/Serialization/XmlSerializer.cs index ca162e868..aea63a57e 100644 --- a/Emby.Common.Implementations/Serialization/XmlSerializer.cs +++ b/Emby.Common.Implementations/Serialization/XmlSerializer.cs @@ -51,7 +51,6 @@ namespace Emby.Common.Implementations.Serialization /// The writer. private void SerializeToWriter(object obj, XmlWriter writer) { - //writer.Formatting = Formatting.Indented; var netSerializer = GetSerializer(obj.GetType()); netSerializer.Serialize(writer, obj); } @@ -78,10 +77,18 @@ namespace Emby.Common.Implementations.Serialization /// The stream. public void SerializeToStream(object obj, Stream stream) { - using (var writer = XmlWriter.Create(stream)) +#if NET46 + using (var writer = new XmlTextWriter(stream, null)) + { + writer.Formatting = System.Xml.Formatting.Indented; + SerializeToWriter(obj, writer); + } +#else + using (var writer = XmlWriter.Create(stream)) { SerializeToWriter(obj, writer); } +#endif } /// diff --git a/Emby.Common.Implementations/project.fragment.lock.json b/Emby.Common.Implementations/project.fragment.lock.json index 0d8df5a0e..6a89a6320 100644 --- a/Emby.Common.Implementations/project.fragment.lock.json +++ b/Emby.Common.Implementations/project.fragment.lock.json @@ -5,23 +5,30 @@ "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Release/MediaBrowser.Common.dll": {} + "bin/Debug/MediaBrowser.Common.dll": {} }, "runtime": { - "bin/Release/MediaBrowser.Common.dll": {} + "bin/Debug/MediaBrowser.Common.dll": {} + }, + "contentFiles": { + "bin/Debug/MediaBrowser.Common.pdb": { + "buildAction": "None", + "codeLanguage": "any", + "copyToOutput": true + } } }, "MediaBrowser.Model/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Release/MediaBrowser.Model.dll": {} + "bin/Debug/MediaBrowser.Model.dll": {} }, "runtime": { - "bin/Release/MediaBrowser.Model.dll": {} + "bin/Debug/MediaBrowser.Model.dll": {} }, "contentFiles": { - "bin/Release/MediaBrowser.Model.pdb": { + "bin/Debug/MediaBrowser.Model.pdb": { "buildAction": "None", "codeLanguage": "any", "copyToOutput": true diff --git a/Emby.Dlna/project.fragment.lock.json b/Emby.Dlna/project.fragment.lock.json index df837d207..09e853c1c 100644 --- a/Emby.Dlna/project.fragment.lock.json +++ b/Emby.Dlna/project.fragment.lock.json @@ -5,33 +5,47 @@ "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Release/MediaBrowser.Common.dll": {} + "bin/Debug/MediaBrowser.Common.dll": {} }, "runtime": { - "bin/Release/MediaBrowser.Common.dll": {} + "bin/Debug/MediaBrowser.Common.dll": {} + }, + "contentFiles": { + "bin/Debug/MediaBrowser.Common.pdb": { + "buildAction": "None", + "codeLanguage": "any", + "copyToOutput": true + } } }, "MediaBrowser.Controller/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Release/MediaBrowser.Controller.dll": {} + "bin/Debug/MediaBrowser.Controller.dll": {} }, "runtime": { - "bin/Release/MediaBrowser.Controller.dll": {} + "bin/Debug/MediaBrowser.Controller.dll": {} + }, + "contentFiles": { + "bin/Debug/MediaBrowser.Controller.pdb": { + "buildAction": "None", + "codeLanguage": "any", + "copyToOutput": true + } } }, "MediaBrowser.Model/1.0.0": { "type": "project", "framework": ".NETPortable,Version=v4.5,Profile=Profile7", "compile": { - "bin/Release/MediaBrowser.Model.dll": {} + "bin/Debug/MediaBrowser.Model.dll": {} }, "runtime": { - "bin/Release/MediaBrowser.Model.dll": {} + "bin/Debug/MediaBrowser.Model.dll": {} }, "contentFiles": { - "bin/Release/MediaBrowser.Model.pdb": { + "bin/Debug/MediaBrowser.Model.pdb": { "buildAction": "None", "codeLanguage": "any", "copyToOutput": true diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index ddeac4d5d..49fdcece1 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -119,6 +119,7 @@ namespace MediaBrowser.Api config.EnableSimpleArtistDetection = true; config.SkipDeserializationForBasicTypes = true; config.SkipDeserializationForPrograms = true; + config.SkipDeserializationForAudio = true; } public void Post(UpdateStartupConfiguration request) diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index cd4461608..539cc5f22 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -26,9 +26,6 @@ namespace MediaBrowser.Controller.Entities.Audio { public List ChannelMediaSources { get; set; } - public int? TotalBitrate { get; set; } - public ExtraType? ExtraType { get; set; } - /// /// Gets or sets the artist. /// @@ -37,15 +34,6 @@ namespace MediaBrowser.Controller.Entities.Audio public List AlbumArtists { get; set; } - [IgnoreDataMember] - public override bool IsThemeMedia - { - get - { - return ExtraType.HasValue && ExtraType.Value == Model.Entities.ExtraType.ThemeSong; - } - } - [IgnoreDataMember] public override bool EnableRefreshOnDateModifiedChange { diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 8211d89d2..433fdbe16 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -203,12 +203,15 @@ namespace MediaBrowser.Controller.Entities get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } } + public int? TotalBitrate { get; set; } + public ExtraType? ExtraType { get; set; } + [IgnoreDataMember] - public virtual bool IsThemeMedia + public bool IsThemeMedia { get { - return false; + return ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); } } @@ -1045,7 +1048,7 @@ namespace MediaBrowser.Controller.Entities audio = dbItem; } - audio.ExtraType = ExtraType.ThemeSong; + audio.ExtraType = MediaBrowser.Model.Entities.ExtraType.ThemeSong; return audio; @@ -1075,7 +1078,7 @@ namespace MediaBrowser.Controller.Entities item = dbItem; } - item.ExtraType = ExtraType.ThemeVideo; + item.ExtraType = MediaBrowser.Model.Entities.ExtraType.ThemeVideo; return item; @@ -1225,7 +1228,7 @@ namespace MediaBrowser.Controller.Entities if (!i.IsThemeMedia) { - i.ExtraType = ExtraType.ThemeVideo; + i.ExtraType = MediaBrowser.Model.Entities.ExtraType.ThemeVideo; subOptions.ForceSave = true; } @@ -1255,7 +1258,7 @@ namespace MediaBrowser.Controller.Entities if (!i.IsThemeMedia) { - i.ExtraType = ExtraType.ThemeSong; + i.ExtraType = MediaBrowser.Model.Entities.ExtraType.ThemeSong; subOptions.ForceSave = true; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 6b8c894c8..2dd134334 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -35,15 +35,6 @@ namespace MediaBrowser.Controller.Entities public List LinkedAlternateVersions { get; set; } public List ChannelMediaSources { get; set; } - [IgnoreDataMember] - public override bool IsThemeMedia - { - get - { - return ExtraType.HasValue && ExtraType.Value == Model.Entities.ExtraType.ThemeVideo; - } - } - [IgnoreDataMember] public override bool SupportsPlayedStatus { @@ -87,9 +78,6 @@ namespace MediaBrowser.Controller.Entities get { return true; } } - public int? TotalBitrate { get; set; } - public ExtraType? ExtraType { get; set; } - /// /// Gets or sets the timestamp. /// diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index a1e5637a4..b1e52dc7b 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -170,6 +170,7 @@ namespace MediaBrowser.Model.Configuration public bool EnableAutomaticRestart { get; set; } public bool SkipDeserializationForBasicTypes { get; set; } public bool SkipDeserializationForPrograms { get; set; } + public bool SkipDeserializationForAudio { get; set; } public PathSubstitution[] PathSubstitutions { get; set; } diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index ffb9c96e7..300973ce1 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -252,6 +252,42 @@ namespace MediaBrowser.Server.Implementations.Channels return item; } + private List GetSavedMediaSources(BaseItem item) + { + var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasources.json"); + + try + { + return _jsonSerializer.DeserializeFromFile>(path) ?? new List(); + } + catch + { + return new List(); + } + } + + private void SaveMediaSources(BaseItem item, List mediaSources) + { + var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasources.json"); + + if (mediaSources == null || mediaSources.Count == 0) + { + try + { + _fileSystem.DeleteFile(path); + } + catch + { + + } + return; + } + + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + + _jsonSerializer.SerializeToFile(mediaSources, path); + } + public async Task> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken) { IEnumerable results = new List(); @@ -263,7 +299,7 @@ namespace MediaBrowser.Server.Implementations.Channels var audio = item as Audio; if (audio != null) { - results = audio.ChannelMediaSources ?? new List(); + results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio); } var sources = SortMediaInfoResults(results) @@ -1385,7 +1421,6 @@ namespace MediaBrowser.Server.Implementations.Channels if (channelAudioItem != null) { channelAudioItem.ExtraType = info.ExtraType; - channelAudioItem.ChannelMediaSources = info.MediaSources; var mediaSource = info.MediaSources.FirstOrDefault(); item.Path = mediaSource == null ? null : mediaSource.Path; @@ -1426,6 +1461,8 @@ namespace MediaBrowser.Server.Implementations.Channels await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false); } + SaveMediaSources(item, info.MediaSources); + return item; } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index ffae9a6f0..5fcd38f87 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -285,6 +285,10 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.AddColumn(Logger, "TypedBaseItems", "ProductionLocations", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "ThemeSongIds", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "ThemeVideoIds", "Text"); + _connection.AddColumn(Logger, "TypedBaseItems", "TotalBitrate", "INT"); + _connection.AddColumn(Logger, "TypedBaseItems", "ExtraType", "Text"); + _connection.AddColumn(Logger, "TypedBaseItems", "Artists", "Text"); + _connection.AddColumn(Logger, "TypedBaseItems", "AlbumArtists", "Text"); _connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text"); @@ -435,7 +439,11 @@ namespace MediaBrowser.Server.Implementations.Persistence "Images", "ProductionLocations", "ThemeSongIds", - "ThemeVideoIds" + "ThemeVideoIds", + "TotalBitrate", + "ExtraType", + "Artists", + "AlbumArtists" }; private readonly string[] _mediaStreamSaveColumns = @@ -566,7 +574,11 @@ namespace MediaBrowser.Server.Implementations.Persistence "Images", "ProductionLocations", "ThemeSongIds", - "ThemeVideoIds" + "ThemeVideoIds", + "TotalBitrate", + "ExtraType", + "Artists", + "AlbumArtists" }; _saveItemCommand = _connection.CreateCommand(); _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values ("; @@ -1046,6 +1058,35 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveItemCommand.GetParameter(index++).Value = null; } + _saveItemCommand.GetParameter(index++).Value = item.TotalBitrate; + _saveItemCommand.GetParameter(index++).Value = item.ExtraType; + + var hasArtists = item as IHasArtist; + if (hasArtists != null) + { + if (hasArtists.Artists.Count > 0) + { + _saveItemCommand.GetParameter(index++).Value = string.Join("|", hasArtists.Artists.ToArray()); + } + else + { + _saveItemCommand.GetParameter(index++).Value = null; + } + } + + var hasAlbumArtists = item as IHasAlbumArtist; + if (hasAlbumArtists != null) + { + if (hasAlbumArtists.AlbumArtists.Count > 0) + { + _saveItemCommand.GetParameter(index++).Value = string.Join("|", hasAlbumArtists.AlbumArtists.ToArray()); + } + else + { + _saveItemCommand.GetParameter(index++).Value = null; + } + } + _saveItemCommand.Transaction = transaction; _saveItemCommand.ExecuteNonQuery(); @@ -1305,6 +1346,25 @@ namespace MediaBrowser.Server.Implementations.Persistence return false; } } + if (_config.Configuration.SkipDeserializationForAudio) + { + if (type == typeof(Audio)) + { + return false; + } + if (type == typeof(LiveTvAudioRecording)) + { + return false; + } + if (type == typeof(AudioPodcast)) + { + return false; + } + if (type == typeof(MusicAlbum)) + { + return false; + } + } return true; } @@ -1884,6 +1944,32 @@ namespace MediaBrowser.Server.Implementations.Persistence index++; } + if (!reader.IsDBNull(index)) + { + item.TotalBitrate = reader.GetInt32(index); + } + index++; + + if (!reader.IsDBNull(index)) + { + item.ExtraType = (ExtraType)Enum.Parse(typeof(ExtraType), reader.GetString(index), true); + } + index++; + + var hasArtists = item as IHasArtist; + if (hasArtists != null && !reader.IsDBNull(index)) + { + hasArtists.Artists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + index++; + + var hasAlbumArtists = item as IHasAlbumArtist; + if (hasAlbumArtists != null && !reader.IsDBNull(index)) + { + hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + index++; + if (string.IsNullOrWhiteSpace(item.Tagline)) { var movie = item as Movie; diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index ad9b3960f..7ff50df63 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -434,187 +434,40 @@ namespace MediaBrowser.Server.Startup.Common var result = new JsonSerializer(FileSystemManager, LogManager.GetLogger("JsonSerializer")); - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ShortOverview" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "Taglines" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "Keywords" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ShortOverview" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ShortOverview" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "PlaceOfBirth" }; - - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds" }; - ServiceStack.Text.JsConfig