From 12adc7ae4cd823bac46e0d7b76ddc06d9b60bc14 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 18 Oct 2017 21:19:48 -0400 Subject: [PATCH] add additional info to timer infos --- .../LiveTv/LiveTvDtoService.cs | 5 ++ .../Localization/Core/kk.json | 2 +- .../Localization/Core/ru.json | 12 ++--- .../LiveTv/LiveTvProgram.cs | 37 +++++++++++---- MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs | 2 + .../Manager/MetadataService.cs | 46 ++++++++----------- .../Api/PackageCreator.cs | 22 +-------- 7 files changed, 61 insertions(+), 65 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index e6479feaa8..15bbca136a 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -89,6 +89,11 @@ namespace Emby.Server.Implementations.LiveTv if (channel != null) { dto.ChannelName = channel.Name; + + if (channel.HasImage(ImageType.Primary)) + { + dto.ChannelPrimaryImageTag = GetImageTag(channel); + } } return dto; diff --git a/Emby.Server.Implementations/Localization/Core/kk.json b/Emby.Server.Implementations/Localization/Core/kk.json index e996235575..c24ee3d13b 100644 --- a/Emby.Server.Implementations/Localization/Core/kk.json +++ b/Emby.Server.Implementations/Localization/Core/kk.json @@ -27,7 +27,7 @@ "Artists": "\u041e\u0440\u044b\u043d\u0434\u0430\u0443\u0448\u044b\u043b\u0430\u0440", "Folders": "\u049a\u0430\u043b\u0442\u0430\u043b\u0430\u0440", "Songs": "\u04d8\u0443\u0435\u043d\u0434\u0435\u0440", - "TvShows": "TV Shows", + "TvShows": "\u0422\u0414-\u043a\u04e9\u0440\u0441\u0435\u0442\u0456\u043c\u0434\u0435\u0440", "Shows": "\u041a\u04e9\u0440\u0441\u0435\u0442\u0456\u043c\u0434\u0435\u0440", "Genres": "\u0416\u0430\u043d\u0440\u043b\u0430\u0440", "NameSeasonNumber": "{0}-\u043c\u0430\u0443\u0441\u044b\u043c", diff --git a/Emby.Server.Implementations/Localization/Core/ru.json b/Emby.Server.Implementations/Localization/Core/ru.json index f3a1cfb7b8..aa624f0e72 100644 --- a/Emby.Server.Implementations/Localization/Core/ru.json +++ b/Emby.Server.Implementations/Localization/Core/ru.json @@ -2,13 +2,13 @@ "Latest": "\u041d\u043e\u0432\u0435\u0439\u0448\u0435\u0435", "ValueSpecialEpisodeName": "\u0421\u043f\u0435\u0446\u044d\u043f\u0438\u0437\u043e\u0434 - {0}", "Inherit": "\u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u0435", - "Books": "\u041a\u043d\u0438\u0433\u0438", + "Books": "\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430", "Music": "\u041c\u0443\u0437\u044b\u043a\u0430", "Games": "\u0418\u0433\u0440\u044b", "Photos": "\u0424\u043e\u0442\u043e", "MixedContent": "\u0421\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435", - "MusicVideos": "\u041c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0435\u043e", - "HomeVideos": "\u0414\u043e\u043c\u0430\u0448\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e", + "MusicVideos": "\u041c\u0443\u0437. \u0432\u0438\u0434\u0435\u043e", + "HomeVideos": "\u0414\u043e\u043c. \u0432\u0438\u0434\u0435\u043e", "Playlists": "\u041f\u043b\u0435\u0439-\u043b\u0438\u0441\u0442\u044b", "HeaderRecordingGroups": "\u0413\u0440\u0443\u043f\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439", "HeaderContinueWatching": "\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430", @@ -22,12 +22,12 @@ "Favorites": "\u0418\u0437\u0431\u0440\u0430\u043d\u043d\u043e\u0435", "Collections": "\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438", "Channels": "\u041a\u0430\u043d\u0430\u043b\u044b", - "Movies": "\u0424\u0438\u043b\u044c\u043c\u044b", + "Movies": "\u041a\u0438\u043d\u043e", "Albums": "\u0410\u043b\u044c\u0431\u043e\u043c\u044b", "Artists": "\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438", "Folders": "\u041f\u0430\u043f\u043a\u0438", "Songs": "\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438", - "TvShows": "TV Shows", + "TvShows": "\u0422\u0412", "Shows": "\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438", "Genres": "\u0416\u0430\u043d\u0440\u044b", "NameSeasonNumber": "\u0421\u0435\u0437\u043e\u043d {0}", @@ -49,7 +49,7 @@ "DeviceOnlineWithName": "{0} - \u043f\u043e\u0434\u043a\u043b. \u0443\u0441\u0442-\u043d\u043e", "UserOnlineFromDevice": "{0} - \u043f\u043e\u0434\u043a\u043b. \u0441 {1} \u0443\u0441\u0442-\u043d\u043e", "ProviderValue": "\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a: {0}", - "SubtitlesDownloadedForItem": "\u0421\u0443\u0431\u0442\u0438\u0442\u0440\u044b \u0434\u043b\u044f {0} \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b", + "SubtitlesDownloadedForItem": "\u0421\u0443\u0431\u0442\u0438\u0442\u0440\u044b \u043a {0} \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b", "UserCreatedWithName": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c {0} \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d", "UserPasswordChangedWithName": "\u041f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437-\u043b\u044f {0} \u0431\u044b\u043b \u0438\u0437\u043c\u0435\u043d\u0451\u043d", "UserDeletedWithName": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c {0} \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0451\u043d", diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 1c16373306..9dff18690e 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -50,21 +50,40 @@ namespace MediaBrowser.Controller.LiveTv public static double? GetDefaultPrimaryImageAspectRatio(IHasProgramAttributes item) { var serviceName = item.ServiceName; - if (!item.IsMovie - && !string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) - && !string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase)) + + if (item.IsMovie) { - double value = 16; - value /= 9; + if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase)) + { + double value = 2; + value /= 3; + + return value; + } + else + { + double value = 16; + value /= 9; - return value; + return value; + } } else { - double value = 2; - value /= 3; + if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase)) + { + double value = 2; + value /= 3; - return value; + return value; + } + else + { + double value = 16; + value /= 9; + + return value; + } } } diff --git a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs index 7c9fe07909..e4d32ca4a5 100644 --- a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs @@ -41,6 +41,8 @@ namespace MediaBrowser.Model.LiveTv /// public string ChannelName { get; set; } + public string ChannelPrimaryImageTag { get; set; } + /// /// Gets or sets the program identifier. /// diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 3759670d4f..af03e21b2d 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -38,28 +38,6 @@ namespace MediaBrowser.Providers.Manager LibraryManager = libraryManager; } - private bool RequiresRefresh(IHasMetadata item, IDirectoryService directoryService) - { - if (item.RequiresRefresh()) - { - return true; - } - - if (item.SupportsLocalMetadata) - { - var video = item as Video; - - if (video != null && !video.IsPlaceHolder) - { - return !video.SubtitleFiles - .SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, FileSystem, false) - .OrderBy(i => i), StringComparer.OrdinalIgnoreCase); - } - } - - return false; - } - public async Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) { var itemOfType = (TItemType)item; @@ -70,6 +48,11 @@ namespace MediaBrowser.Providers.Manager var libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item); + if (!requiresRefresh && libraryOptions.AutomaticRefreshIntervalDays > 0 && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= libraryOptions.AutomaticRefreshIntervalDays) + { + requiresRefresh = true; + } + DateTime? newDateModified = null; if (item.LocationType == LocationType.FileSystem) { @@ -85,18 +68,25 @@ namespace MediaBrowser.Providers.Manager requiresRefresh = true; } } - } - } - if (!requiresRefresh && libraryOptions.AutomaticRefreshIntervalDays > 0 && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= libraryOptions.AutomaticRefreshIntervalDays) - { - requiresRefresh = true; + if (!requiresRefresh && item.SupportsLocalMetadata) + { + var video = item as Video; + + if (video != null && !video.IsPlaceHolder) + { + requiresRefresh = !video.SubtitleFiles + .SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, refreshOptions.DirectoryService, FileSystem, false) + .OrderBy(i => i), StringComparer.OrdinalIgnoreCase); + } + } + } } if (!requiresRefresh && refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) { // TODO: If this returns true, should we instead just change metadata refresh mode to Full? - requiresRefresh = RequiresRefresh(item, refreshOptions.DirectoryService); + requiresRefresh = item.RequiresRefresh(); } var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem); diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index bb4a98fa86..f55d95a2e7 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -152,7 +152,7 @@ namespace MediaBrowser.WebDashboard.Api } } - html = html.Replace("", "" + GetMetaTags(mode) + GetCommonCss(mode, appVersion)); + html = html.Replace("", "" + GetMetaTags(mode)); // Disable embedded scripts from plugins. We'll run them later once resources have loaded if (html.IndexOf(" - /// Gets the common CSS. - /// - /// The mode. - /// The version. - /// System.String. - private string GetCommonCss(string mode, string version) - { - var versionString = string.IsNullOrWhiteSpace(mode) ? "?v=" + version : string.Empty; - - var files = new[] - { - "css/site.css" + versionString - }; - - var tags = files.Select(s => string.Format("", s)).ToArray(); - - return string.Join(string.Empty, tags); - } - /// /// Gets the common javascript. ///