From b98ef8fac06c7388c5f4ccecec76bb6892222d5e Mon Sep 17 00:00:00 2001 From: Ivan-L Date: Mon, 9 Jan 2017 00:02:12 +0200 Subject: [PATCH 1/4] Do not update wan.dat if WAN IP has not changed --- Emby.Server.Implementations/Connect/ConnectEntryPoint.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs b/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs index 7f15f20cb8..b5639773b4 100644 --- a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -18,6 +18,7 @@ namespace Emby.Server.Implementations.Connect public class ConnectEntryPoint : IServerEntryPoint { private ITimer _timer; + private IpAddressInfo _cachedIpAddress; private readonly IHttpClient _httpClient; private readonly IApplicationPaths _appPaths; private readonly ILogger _logger; @@ -151,6 +152,12 @@ namespace Emby.Server.Implementations.Connect private void CacheAddress(IpAddressInfo address) { + if (_cachedIpAddress != null && _cachedIpAddress.Equals(address)) + { + // no need to update the file if the address has not changed + return; + } + var path = CacheFilePath; try @@ -164,6 +171,7 @@ namespace Emby.Server.Implementations.Connect try { _fileSystem.WriteAllText(path, _encryption.EncryptString(address.ToString()), Encoding.UTF8); + _cachedIpAddress = address; } catch (Exception ex) { @@ -184,6 +192,7 @@ namespace Emby.Server.Implementations.Connect if (_networkManager.TryParseIpAddress(endpoint, out ipAddress)) { + _cachedIpAddress = ipAddress; ((ConnectManager)_connectManager).OnWanAddressResolved(ipAddress); } } From fe25f3cbacca11ef609332e87f70eed54f179e86 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 9 Jan 2017 01:24:40 -0500 Subject: [PATCH 2/4] update components --- MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj | 4 ---- MediaBrowser.Server.Mono/System.Data.SQLite.dll.config | 3 --- 2 files changed, 7 deletions(-) delete mode 100644 MediaBrowser.Server.Mono/System.Data.SQLite.dll.config diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 24da2fd595..325011adff 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -227,10 +227,6 @@ Designer PreserveNewest - - PreserveNewest - Designer - \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/System.Data.SQLite.dll.config b/MediaBrowser.Server.Mono/System.Data.SQLite.dll.config deleted file mode 100644 index 83a6cd9f38..0000000000 --- a/MediaBrowser.Server.Mono/System.Data.SQLite.dll.config +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file From 3b7b06f70b181b2d6c4ea951725050c5edb5cf86 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 9 Jan 2017 01:25:09 -0500 Subject: [PATCH 3/4] support .tp video container --- Emby.Server.Implementations/Library/LibraryManager.cs | 2 ++ MediaBrowser.ServerApplication/MainStartup.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 4dd6cd3032..db514af76f 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -2481,6 +2481,8 @@ namespace Emby.Server.Implementations.Library options.VideoFileExtensions.Remove(".zip"); } + options.VideoFileExtensions.Add(".tp"); + return options; } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index c349401415..8dcabb9500 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -601,6 +601,12 @@ namespace MediaBrowser.ServerApplication /// true if XXXX, false otherwise private static bool PerformUpdateIfNeeded(ServerApplicationPaths appPaths, ILogger logger) { + // Not supported + if (IsRunningAsService) + { + return false; + } + // Look for the existence of an update archive var updateArchive = Path.Combine(appPaths.TempUpdatePath, "MBServer" + ".zip"); if (File.Exists(updateArchive)) From 85cd90d6e6bb022469cbb34248300f3164cf1775 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 9 Jan 2017 12:05:34 -0500 Subject: [PATCH 4/4] update video osd --- .../Data/SqliteItemRepository.cs | 26 ++++--------------- .../Library/SearchEngine.cs | 4 +-- .../Library/UserViewManager.cs | 2 +- .../LiveTv/LiveTvManager.cs | 2 +- MediaBrowser.Api/Library/LibraryService.cs | 2 +- MediaBrowser.Api/Reports/ReportsService.cs | 6 ++++- MediaBrowser.Api/UserLibrary/ItemsService.cs | 6 ++++- MediaBrowser.Controller/Entities/AudioBook.cs | 9 +++++++ MediaBrowser.Controller/Entities/Folder.cs | 4 +-- .../Entities/InternalItemsQuery.cs | 2 -- .../Entities/UserViewBuilder.cs | 4 +-- .../LiveTv/LiveTvProgram.cs | 5 ++++ .../MediaInfo/SubtitleScheduledTask.cs | 2 +- 13 files changed, 39 insertions(+), 35 deletions(-) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 06704bafad..79bc55d5db 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -3208,6 +3208,11 @@ namespace Emby.Server.Implementations.Data private List GetWhereClauses(InternalItemsQuery query, IStatement statement, string paramSuffix = "") { + if (query.IsResumable ?? false) + { + query.IsVirtualItem = false; + } + var whereClauses = new List(); if (EnableJoinUserData(query)) @@ -4081,27 +4086,6 @@ namespace Emby.Server.Implementations.Data whereClauses.Add("LocationType in (" + val + ")"); } - if (query.ExcludeLocationTypes.Length == 1) - { - if (query.ExcludeLocationTypes[0] == LocationType.Virtual && _config.Configuration.SchemaVersion >= 90) - { - query.IsVirtualItem = false; - } - else - { - whereClauses.Add("LocationType<>@ExcludeLocationTypes"); - if (statement != null) - { - statement.TryBind("@ExcludeLocationTypes", query.ExcludeLocationTypes[0].ToString()); - } - } - } - else if (query.ExcludeLocationTypes.Length > 1) - { - var val = string.Join(",", query.ExcludeLocationTypes.Select(i => "'" + i + "'").ToArray()); - - whereClauses.Add("LocationType not in (" + val + ")"); - } if (query.IsVirtualItem.HasValue) { whereClauses.Add("IsVirtualItem=@IsVirtualItem"); diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index afdf65c063..e6c88aa1a9 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -157,6 +157,7 @@ namespace Emby.Server.Implementations.Library } AddIfMissing(excludeItemTypes, typeof(CollectionFolder).Name); + AddIfMissing(excludeItemTypes, typeof(Folder).Name); var mediaItems = _libraryManager.GetItemList(new InternalItemsQuery(user) { @@ -164,8 +165,7 @@ namespace Emby.Server.Implementations.Library ExcludeItemTypes = excludeItemTypes.ToArray(), IncludeItemTypes = includeItemTypes.ToArray(), Limit = query.Limit, - IncludeItemsByName = true, - IsVirtualItem = false + IncludeItemsByName = true }); // Add search hints based on item name diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index f7cc8bb73f..0a8b1c681c 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -287,7 +287,7 @@ namespace Emby.Server.Implementations.Library SortBy = new[] { ItemSortBy.DateCreated }, IsFolder = includeItemTypes.Length == 0 ? false : (bool?)null, ExcludeItemTypes = excludeItemTypes, - ExcludeLocationTypes = new[] { LocationType.Virtual }, + IsVirtualItem = false, Limit = limit * 5, SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { }, IsPlayed = request.IsPlayed diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 62a0738c72..b77ca3f413 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1602,7 +1602,7 @@ namespace Emby.Server.Implementations.LiveTv Recursive = true, AncestorIds = folders.Select(i => i.Id.ToString("N")).ToArray(), IsFolder = false, - ExcludeLocationTypes = new[] { LocationType.Virtual }, + IsVirtualItem = false, Limit = query.Limit, SortBy = new[] { ItemSortBy.DateCreated }, SortOrder = SortOrder.Descending, diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 15c1cbe827..e654cc8f6a 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -666,7 +666,7 @@ namespace MediaBrowser.Api.Library IncludeItemTypes = new[] { type.Name }, Limit = 0, Recursive = true, - ExcludeLocationTypes = new[] { LocationType.Virtual }, + IsVirtualItem = false, SourceTypes = new[] { SourceType.Library }, IsFavorite = request.IsFavorite }; diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index efbfa1bdfb..cb275fa294 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -293,7 +293,11 @@ namespace MediaBrowser.Api.Reports // ExcludeLocationTypes if (!string.IsNullOrEmpty(request.ExcludeLocationTypes)) { - query.ExcludeLocationTypes = request.ExcludeLocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); + var excludeLocationTypes = request.ExcludeLocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); + if (excludeLocationTypes.Contains(LocationType.Virtual)) + { + query.IsVirtualItem = false; + } } if (!string.IsNullOrEmpty(request.LocationTypes)) diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 049a7b1c69..8300beac3b 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -318,7 +318,11 @@ namespace MediaBrowser.Api.UserLibrary // ExcludeLocationTypes if (!string.IsNullOrEmpty(request.ExcludeLocationTypes)) { - query.ExcludeLocationTypes = request.ExcludeLocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); + var excludeLocationTypes = request.ExcludeLocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); + if (excludeLocationTypes.Contains(LocationType.Virtual)) + { + query.IsVirtualItem = false; + } } if (!string.IsNullOrEmpty(request.LocationTypes)) diff --git a/MediaBrowser.Controller/Entities/AudioBook.cs b/MediaBrowser.Controller/Entities/AudioBook.cs index efeb9b497d..c15cae8b13 100644 --- a/MediaBrowser.Controller/Entities/AudioBook.cs +++ b/MediaBrowser.Controller/Entities/AudioBook.cs @@ -16,6 +16,15 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] + public override bool SupportsPlayedStatus + { + get + { + return true; + } + } + [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index b5d07b933a..61747bd140 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1336,7 +1336,7 @@ namespace MediaBrowser.Controller.Entities if (!user.Configuration.DisplayMissingEpisodes || !user.Configuration.DisplayUnairedEpisodes) { - query.ExcludeLocationTypes = new[] { LocationType.Virtual }; + query.IsVirtualItem = false; } var itemsResult = await GetItems(query).ConfigureAwait(false); @@ -1375,7 +1375,7 @@ namespace MediaBrowser.Controller.Entities { Recursive = true, IsFolder = false, - ExcludeLocationTypes = new[] { LocationType.Virtual }, + IsVirtualItem = false, EnableTotalRecordCount = false }).Result; diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index f5af7d5c64..5cb9b9cee6 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -130,7 +130,6 @@ namespace MediaBrowser.Controller.Entities public string[] TopParentIds { get; set; } public LocationType[] LocationTypes { get; set; } - public LocationType[] ExcludeLocationTypes { get; set; } public string[] PresetViews { get; set; } public SourceType[] SourceTypes { get; set; } public SourceType[] ExcludeSourceTypes { get; set; } @@ -233,7 +232,6 @@ namespace MediaBrowser.Controller.Entities ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; LocationTypes = new LocationType[] { }; - ExcludeLocationTypes = new LocationType[] { }; PresetViews = new string[] { }; SourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { }; diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 58d2cdc6c4..a880b6d778 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -647,7 +647,7 @@ namespace MediaBrowser.Controller.Entities query.SetUser(user); query.Limit = GetSpecialItemsLimit(); query.IncludeItemTypes = new[] { typeof(Episode).Name }; - query.ExcludeLocationTypes = new[] { LocationType.Virtual }; + query.IsVirtualItem = false; return ConvertToResult(_libraryManager.GetItemList(query)); } @@ -1199,7 +1199,7 @@ namespace MediaBrowser.Controller.Entities return false; } - if (query.ExcludeLocationTypes.Length > 0 && query.ExcludeLocationTypes.Contains(item.LocationType)) + if (query.IsVirtualItem.HasValue && item.IsVirtualItem != query.IsVirtualItem.Value) { return false; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index ffb6a75556..5a139e09d5 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -15,6 +15,11 @@ namespace MediaBrowser.Controller.LiveTv { public class LiveTvProgram : BaseItem, IHasLookupInfo, IHasStartDate, IHasProgramAttributes { + public LiveTvProgram() + { + IsVirtualItem = true; + } + public override List GetUserDataKeys() { var list = base.GetUserDataKeys(); diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs index c47b6ab93f..0e842cdb4f 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs @@ -82,10 +82,10 @@ namespace MediaBrowser.Providers.MediaInfo { MediaTypes = new string[] { MediaType.Video }, IsVirtualItem = false, - ExcludeLocationTypes = new LocationType[] { LocationType.Remote, LocationType.Virtual }, IncludeItemTypes = types.ToArray() }).OfType