diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 10f9ec022..14bd6b61f 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -69,6 +69,7 @@ namespace MediaBrowser.Api _config.Configuration.EnableCustomPathSubFolders = true; _config.Configuration.EnableDateLastRefresh = true; _config.Configuration.EnableStandaloneMusicKeys = true; + _config.Configuration.EnableCaseSensitiveItemIds = true; _config.SaveConfiguration(); } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index bbc6195ff..041f51a89 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -62,6 +62,12 @@ namespace MediaBrowser.Model.Configuration /// true if this instance is port authorized; otherwise, false. public bool IsPortAuthorized { get; set; } + /// + /// Gets or sets a value indicating whether [enable case sensitive item ids]. + /// + /// true if [enable case sensitive item ids]; otherwise, false. + public bool EnableCaseSensitiveItemIds { get; set; } + /// /// Gets or sets the metadata path. /// diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index a024eeab4..f294d1dec 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -60,7 +60,8 @@ namespace MediaBrowser.Model.Configuration EnableNextEpisodeAutoPlay = true; RememberAudioSelections = true; RememberSubtitleSelections = true; - + DisplayChannelsInline = true; + HidePlayedInLatest = true; PlayDefaultAudioTrack = true; diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs index d4e4b4844..3a1e05704 100644 --- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs +++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs @@ -115,7 +115,7 @@ namespace MediaBrowser.Providers.TV { Name = seasonName, IndexNumber = seasonNumber, - Id = (series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName).GetMBId(typeof(Season)) + Id = _libraryManager.GetNewItemId((series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName), typeof(Season)) }; season.SetParent(series); diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index ff31dbc92..248be675d 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -422,7 +422,7 @@ namespace MediaBrowser.Providers.TV Name = name, IndexNumber = episodeNumber, ParentIndexNumber = seasonNumber, - Id = (series.Id + seasonNumber.ToString(_usCulture) + name).GetMBId(typeof(Episode)) + Id = _libraryManager.GetNewItemId((series.Id + seasonNumber.ToString(_usCulture) + name), typeof(Episode)) }; episode.SetParent(season); diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs index 6a98fcf61..42254f360 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs @@ -28,9 +28,36 @@ namespace MediaBrowser.Providers.TV : base(httpClient, configurationManager, jsonSerializer, fileSystem, localization, logManager) { } - public Task> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken) + public async Task> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken) { - return Task.FromResult>(new List()); + var list = new List(); + + // The search query must either provide an episode number or date + if (!searchInfo.IndexNumber.HasValue || !searchInfo.ParentIndexNumber.HasValue) + { + return list; + } + + var metadataResult = await GetMetadata(searchInfo, cancellationToken); + + if (metadataResult.HasMetadata) + { + var item = metadataResult.Item; + + list.Add(new RemoteSearchResult + { + IndexNumber = item.IndexNumber, + Name = item.Name, + ParentIndexNumber = item.ParentIndexNumber, + PremiereDate = item.PremiereDate, + ProductionYear = item.ProductionYear, + ProviderIds = item.ProviderIds, + SearchProviderName = Name, + IndexNumberEnd = item.IndexNumberEnd + }); + } + + return list; } public async Task> GetMetadata(EpisodeInfo info, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 240037597..d849ce7bd 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -561,8 +561,7 @@ namespace MediaBrowser.Server.Implementations.Channels { throw new ArgumentNullException("name"); } - - return ("Channel " + name).GetMBId(typeof(Channel)); + return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel)); } public async Task> GetLatestChannelItems(AllChannelMediaQuery query, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index ad3cd2576..0e61f2969 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -508,7 +508,12 @@ namespace MediaBrowser.Server.Implementations.Library .Replace("/", "\\"); } - key = type.FullName + key.ToLower(); + if (!ConfigurationManager.Configuration.EnableCaseSensitiveItemIds) + { + key = key.ToLower(); + } + + key = type.FullName + key; return key.GetMD5(); } diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs index 37046bfef..931f9b21e 100644 --- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs @@ -124,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Library var channels = channelResult.Items; - if (user.Configuration.DisplayChannelsInline && channels.Length > 0) + if (!user.Configuration.DisplayChannelsInline && channels.Length > 0) { list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false)); } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index 3da0d15d3..7fe486de7 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -25,14 +25,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv private readonly IUserDataManager _userDataManager; private readonly IDtoService _dtoService; private readonly IApplicationHost _appHost; + private readonly ILibraryManager _libraryManager; - public LiveTvDtoService(IDtoService dtoService, IUserDataManager userDataManager, IImageProcessor imageProcessor, ILogger logger, IApplicationHost appHost) + public LiveTvDtoService(IDtoService dtoService, IUserDataManager userDataManager, IImageProcessor imageProcessor, ILogger logger, IApplicationHost appHost, ILibraryManager libraryManager) { _dtoService = dtoService; _userDataManager = userDataManager; _imageProcessor = imageProcessor; _logger = logger; _appHost = appHost; + _libraryManager = libraryManager; } public TimerInfoDto GetTimerInfoDto(TimerInfo info, ILiveTvService service, LiveTvProgram program, LiveTvChannel channel) @@ -200,7 +202,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var name = serviceName + externalId + InternalVersionNumber; - return name.ToLower().GetMBId(typeof(LiveTvChannel)); + return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvChannel)); } public Guid GetInternalTimerId(string serviceName, string externalId) @@ -221,14 +223,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var name = serviceName + externalId + InternalVersionNumber; - return name.ToLower().GetMBId(typeof(LiveTvProgram)); + return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvProgram)); } public Guid GetInternalRecordingId(string serviceName, string externalId) { var name = serviceName + externalId + InternalVersionNumber + "0"; - return name.ToLower().GetMBId(typeof(ILiveTvRecording)); + return _libraryManager.GetNewItemId(name.ToLower(), typeof(ILiveTvRecording)); } public async Task GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 08b0256b2..526de62c8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -81,7 +81,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv _dtoService = dtoService; _userDataManager = userDataManager; - _tvDtoService = new LiveTvDtoService(dtoService, userDataManager, imageProcessor, logger, appHost); + _tvDtoService = new LiveTvDtoService(dtoService, userDataManager, imageProcessor, logger, appHost, _libraryManager); } /// diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs index 011cbce1c..4fb1e07dd 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs @@ -141,8 +141,8 @@ namespace MediaBrowser.Server.Implementations.Persistence var connectionstr = new SQLiteConnectionStringBuilder { PageSize = 4096, - CacheSize = 4096, - SyncMode = SynchronizationModes.Normal, + CacheSize = 2000, + SyncMode = SynchronizationModes.Full, DataSource = dbPath, JournalMode = SQLiteJournalModeEnum.Wal }; diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 0b337b2a1..19185e965 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -79,7 +79,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _updateInheritedRatingCommand; - private const int LatestSchemaVersion = 48; + private const int LatestSchemaVersion = 49; /// /// Initializes a new instance of the class.