From e0636b4925d7a15740201f96855d05dfca97d9ad Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 10 Mar 2016 23:25:56 -0500 Subject: update packaging --- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index c3db09457..9c698440e 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -436,14 +436,7 @@ namespace MediaBrowser.WebDashboard.Api var files = new List(); - if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) - { - files.Add("bower_components/requirejs/require.js"); - } - else - { - files.Add("bower_components" + version + "/requirejs/require.js"); - } + files.Add("bower_components/requirejs/require.js"); files.Add("scripts/site.js" + versionString); -- cgit v1.2.3 From 3af38050e37ac8b09a9d667f4bc5633d6af95e62 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 12 Mar 2016 02:28:13 -0500 Subject: unify backdrops --- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 2 +- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 9c698440e..982edb5f7 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -295,7 +295,7 @@ namespace MediaBrowser.WebDashboard.Api } } - html = html.Replace("", "
"); } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 77365315c..be8dbaeae 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -284,6 +284,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -859,9 +862,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest -- cgit v1.2.3 From dafbd48f46f7ef96a6ba06563da391e0a7e6b5ff Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Mar 2016 01:33:31 -0400 Subject: enable unified routing --- MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs | 2 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs b/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs index a4504f25a..3915e9153 100644 --- a/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs +++ b/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs @@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Startup.Common.Browser /// The logger. public static void OpenDashboard(IServerApplicationHost appHost, ILogger logger) { - OpenDashboardPage("dashboard.html", appHost, logger); + OpenDashboardPage("index.html#!/dashboard.html", appHost, logger); } /// diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 982edb5f7..319254511 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -294,9 +294,6 @@ namespace MediaBrowser.WebDashboard.Api _logger.ErrorException("Error minifying html", ex); } } - - html = html.Replace("", "
"); } html = html.Replace("", "" + GetMetaTags(mode) + GetCommonCss(mode, appVersion)); -- cgit v1.2.3 From fee7cbdc4adc99dc256e2c46a89931c14cdf0f43 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Mar 2016 14:09:58 -0400 Subject: update components --- .../Browser/BrowserLauncher.cs | 2 +- MediaBrowser.WebDashboard/Api/DashboardService.cs | 2 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 21 +++++++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs b/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs index 3915e9153..a4504f25a 100644 --- a/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs +++ b/MediaBrowser.Server.Startup.Common/Browser/BrowserLauncher.cs @@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Startup.Common.Browser /// The logger. public static void OpenDashboard(IServerApplicationHost appHost, ILogger logger) { - OpenDashboardPage("index.html#!/dashboard.html", appHost, logger); + OpenDashboardPage("dashboard.html", appHost, logger); } /// diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 128060bb8..a5bfebea9 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -142,7 +142,7 @@ namespace MediaBrowser.WebDashboard.Api { var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); - return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false)); + return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(null, page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false)); } /// diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 319254511..55f6ca7a4 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -60,7 +60,7 @@ namespace MediaBrowser.WebDashboard.Api { if (IsCoreHtml(path)) { - resourceStream = await ModifyHtml(resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false); + resourceStream = await ModifyHtml(path, resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false); } } else if (IsFormat(path, "js")) @@ -238,13 +238,14 @@ namespace MediaBrowser.WebDashboard.Api /// /// Modifies the HTML by adding common meta tags, css and js. /// + /// The path. /// The source stream. /// The mode. /// The application version. /// The localization culture. /// if set to true [enable minification]. /// Task{Stream}. - public async Task ModifyHtml(Stream sourceStream, string mode, string appVersion, string localizationCulture, bool enableMinification) + public async Task ModifyHtml(string path, Stream sourceStream, string mode, string appVersion, string localizationCulture, bool enableMinification) { using (sourceStream) { @@ -260,6 +261,12 @@ namespace MediaBrowser.WebDashboard.Api { html = ModifyForCordova(html); } + else if (!string.IsNullOrWhiteSpace(path) && !string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase) && html.IndexOf("", "
" + html + "
"); + } if (!string.IsNullOrWhiteSpace(localizationCulture)) { @@ -306,6 +313,16 @@ namespace MediaBrowser.WebDashboard.Api } } + public string ReplaceFirst(string text, string search, string replace) + { + int pos = text.IndexOf(search, StringComparison.OrdinalIgnoreCase); + if (pos < 0) + { + return text; + } + return text.Substring(0, pos) + replace + text.Substring(pos + search.Length); + } + private string ModifyForCordova(string html) { // Replace CORDOVA_REPLACE_SUPPORTER_SUBMIT_START -- cgit v1.2.3 From b84f178467e347e1d6d977e84259c713c06001f5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 18 Mar 2016 02:36:58 -0400 Subject: update plugin pages --- .../Library/LibraryStructureService.cs | 8 ++--- MediaBrowser.Controller/Entities/BaseItem.cs | 7 +++++ MediaBrowser.Controller/Entities/Book.cs | 2 ++ MediaBrowser.Controller/Entities/Trailer.cs | 1 - .../ContentDirectory/ControlHandler.cs | 2 +- .../HttpServer/HttpListenerHost.cs | 8 ++--- .../Persistence/SqliteItemRepository.cs | 33 +++++++++++++++++++- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 35 ++++++++++++++++++---- 8 files changed, 79 insertions(+), 17 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index decd19602..82931e11e 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -201,10 +201,10 @@ namespace MediaBrowser.Api.Library var rootFolderPath = _appPaths.DefaultUserViewsPath; var virtualFolderPath = Path.Combine(rootFolderPath, name); - - if (_fileSystem.DirectoryExists(virtualFolderPath)) + while (_fileSystem.DirectoryExists(virtualFolderPath)) { - throw new ArgumentException("There is already a media library with the name " + name + "."); + name += "1"; + virtualFolderPath = Path.Combine(rootFolderPath, name); } if (request.Paths != null) @@ -236,7 +236,7 @@ namespace MediaBrowser.Api.Library { foreach (var path in request.Paths) { - LibraryHelpers.AddMediaPath(_fileSystem, request.Name, path, _appPaths); + LibraryHelpers.AddMediaPath(_fileSystem, name, path, _appPaths); } } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index bd4ede466..4106c7197 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -57,7 +57,9 @@ namespace MediaBrowser.Controller.Entities public static string ThemeSongFilename = "theme"; public static string ThemeVideosFolderName = "backdrops"; + [IgnoreDataMember] public string PreferredMetadataCountryCode { get; set; } + [IgnoreDataMember] public string PreferredMetadataLanguage { get; set; } public List ImageInfos { get; set; } @@ -88,6 +90,7 @@ namespace MediaBrowser.Controller.Entities /// Gets a value indicating whether this instance is in mixed folder. ///
/// true if this instance is in mixed folder; otherwise, false. + [IgnoreDataMember] public bool IsInMixedFolder { get; set; } [IgnoreDataMember] @@ -342,6 +345,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public DateTime DateModified { get; set; } + [IgnoreDataMember] public DateTime DateLastSaved { get; set; } [IgnoreDataMember] @@ -380,6 +384,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the locked fields. ///
/// The locked fields. + [IgnoreDataMember] public List LockedFields { get; set; } /// @@ -620,6 +625,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the studios. /// /// The studios. + [IgnoreDataMember] public List Studios { get; set; } /// @@ -633,6 +639,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the tags. /// /// The tags. + [IgnoreDataMember] public List Tags { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index f006fedd2..5ef098ff8 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -2,6 +2,7 @@ using MediaBrowser.Model.Configuration; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Users; @@ -9,6 +10,7 @@ namespace MediaBrowser.Controller.Entities { public class Book : BaseItem, IHasTags, IHasLookupInfo, IHasSeries { + [IgnoreDataMember] public override string MediaType { get diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 3c7d39e0d..3bff5bc64 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -14,7 +14,6 @@ namespace MediaBrowser.Controller.Entities /// /// Class Trailer /// - [Obsolete] public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo { public List ProductionLocations { get; set; } diff --git a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs index d1a415f73..937a3f8fd 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs @@ -488,7 +488,7 @@ namespace MediaBrowser.Dlna.ContentDirectory var itemsResult = _libraryManager.GetItemsResult(new InternalItemsQuery(user) { Person = person.Name, - IncludeItemTypes = new[] { typeof(Movie).Name, typeof(Series).Name, typeof(ChannelVideoItem).Name }, + IncludeItemTypes = new[] { typeof(Movie).Name, typeof(Series).Name, typeof(Trailer).Name, typeof(ChannelVideoItem).Name }, SortBy = new[] { ItemSortBy.SortName }, Limit = limit, StartIndex = startIndex diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 160397e7c..c6452d8f5 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -350,16 +350,16 @@ namespace MediaBrowser.Server.Implementations.HttpServer localPath.IndexOf("dashboard/", StringComparison.OrdinalIgnoreCase) != -1) { httpRes.StatusCode = 200; - httpRes.ContentType = "text/plain"; + httpRes.ContentType = "text/html"; var newUrl = urlString.Replace("mediabrowser", "emby", StringComparison.OrdinalIgnoreCase) .Replace("/dashboard/", "/web/", StringComparison.OrdinalIgnoreCase); - httpRes.Write("Please update your Emby bookmark to " + newUrl); + httpRes.Write("EmbyPlease update your Emby bookmark to " + newUrl + ""); httpRes.Close(); return Task.FromResult(true); } - + if (string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase)) { httpRes.RedirectToUrl(DefaultRedirectPath); @@ -396,7 +396,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer httpRes.RedirectToUrl("web/pin.html"); return Task.FromResult(true); } - + if (!string.IsNullOrWhiteSpace(GlobalResponse)) { httpRes.StatusCode = 503; diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 18a41d82a..56daff78a 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -348,7 +348,12 @@ namespace MediaBrowser.Server.Implementations.Persistence "Genres", "ParentId", "Audio", - "ExternalServiceId" + "ExternalServiceId", + "IsInMixedFolder", + "DateLastSaved", + "LockedFields", + "Studios", + "Tags" }; private readonly string[] _mediaStreamSaveColumns = @@ -1079,6 +1084,31 @@ namespace MediaBrowser.Server.Implementations.Persistence } } + if (!reader.IsDBNull(44)) + { + item.IsInMixedFolder = reader.GetBoolean(44); + } + + if (!reader.IsDBNull(45)) + { + item.DateLastSaved = reader.GetDateTime(45).ToUniversalTime(); + } + + if (!reader.IsDBNull(46)) + { + item.LockedFields = reader.GetString(46).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => (MetadataFields)Enum.Parse(typeof(MetadataFields), i, true)).ToList(); + } + + if (!reader.IsDBNull(47)) + { + item.Studios = reader.GetString(47).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + + if (!reader.IsDBNull(48)) + { + item.Tags = reader.GetString(48).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + return item; } @@ -2013,6 +2043,7 @@ namespace MediaBrowser.Server.Implementations.Persistence typeof(MusicGenre), typeof(MusicVideo), typeof(Movie), + typeof(Trailer), typeof(BoxSet), typeof(Episode), typeof(ChannelVideoItem), diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 55f6ca7a4..753946ac4 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -261,11 +261,21 @@ namespace MediaBrowser.WebDashboard.Api { html = ModifyForCordova(html); } - else if (!string.IsNullOrWhiteSpace(path) && !string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase) && html.IndexOf("", StringComparison.OrdinalIgnoreCase); + if (index != -1) + { + html = html.Substring(0, index+7); + } + } + var mainFile = File.ReadAllText(GetDashboardResourcePath("index.html")); - html = ReplaceFirst(indexFile, "
", "
" + html + "
"); + html = ReplaceFirst(mainFile, "
", "
" + html + "
"); } if (!string.IsNullOrWhiteSpace(localizationCulture)) @@ -305,7 +315,15 @@ namespace MediaBrowser.WebDashboard.Api html = html.Replace("", "" + GetMetaTags(mode) + GetCommonCss(mode, appVersion)); - html = html.Replace("", GetCommonJavascript(mode, appVersion) + ""); + // Inject sripts before any embedded scripts + if (html.IndexOf("", GetCommonJavascript(mode, appVersion, true) + ""); + } var bytes = Encoding.UTF8.GetBytes(html); @@ -428,8 +446,9 @@ namespace MediaBrowser.WebDashboard.Api ///
/// The mode. /// The version. + /// if set to true [asynchronous]. /// System.String. - private string GetCommonJavascript(string mode, string version) + private string GetCommonJavascript(string mode, string version, bool async) { var builder = new StringBuilder(); @@ -463,7 +482,11 @@ namespace MediaBrowser.WebDashboard.Api { if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1) { - return string.Format("", s); + if (async) + { + return string.Format("", s); + } + return string.Format("", s); } return string.Format("", s); -- cgit v1.2.3 From 641b85ad7b69d9dc5e853b99da51d1a10aefc095 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 18 Mar 2016 02:52:47 -0400 Subject: fix reloading plugin pages --- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 753946ac4..726205671 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -315,16 +315,15 @@ namespace MediaBrowser.WebDashboard.Api html = html.Replace("", "" + GetMetaTags(mode) + GetCommonCss(mode, appVersion)); - // Inject sripts before any embedded scripts + // Disable embedded scripts from plugins. We'll run them later once resources have loaded if (html.IndexOf("", GetCommonJavascript(mode, appVersion, true) + ""); + html = html.Replace("", "-->"); } + html = html.Replace("", GetCommonJavascript(mode, appVersion) + ""); + var bytes = Encoding.UTF8.GetBytes(html); return new MemoryStream(bytes); @@ -446,9 +445,8 @@ namespace MediaBrowser.WebDashboard.Api ///
/// The mode. /// The version. - /// if set to true [asynchronous]. /// System.String. - private string GetCommonJavascript(string mode, string version, bool async) + private string GetCommonJavascript(string mode, string version) { var builder = new StringBuilder(); @@ -482,11 +480,7 @@ namespace MediaBrowser.WebDashboard.Api { if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1) { - if (async) - { - return string.Format("", s); - } - return string.Format("", s); + return string.Format("", s); } return string.Format("", s); -- cgit v1.2.3 From e95bea8954a4a96f9274b5b8f0f5b6f6de02a366 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 20 Mar 2016 13:56:03 -0400 Subject: fix language --- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs') diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 726205671..55c3afd9d 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -282,7 +282,7 @@ namespace MediaBrowser.WebDashboard.Api { var lang = localizationCulture.Split('-').FirstOrDefault(); - html = html.Replace("", ""); + html = html.Replace("