From ee00f8bf726ae5498d64cff0086b9b7e638936ea Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 24 Jan 2015 14:03:55 -0500 Subject: added HasSyncJob --- MediaBrowser.Api/UserLibrary/ArtistsService.cs | 2 +- MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs | 2 +- MediaBrowser.Api/UserLibrary/GameGenresService.cs | 2 +- MediaBrowser.Api/UserLibrary/GenresService.cs | 2 +- MediaBrowser.Api/UserLibrary/ItemsService.cs | 6 +++--- MediaBrowser.Api/UserLibrary/MusicGenresService.cs | 2 +- MediaBrowser.Api/UserLibrary/PersonsService.cs | 2 +- MediaBrowser.Api/UserLibrary/StudiosService.cs | 2 +- MediaBrowser.Api/UserLibrary/UserLibraryService.cs | 16 ++++++++-------- MediaBrowser.Api/UserLibrary/YearsService.cs | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary') diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 1284232388..2ab08fd8d3 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -83,7 +83,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetArtist(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index 9d211a4199..e0747b5478 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -129,7 +129,7 @@ namespace MediaBrowser.Api.UserLibrary var tuples = ibnItems.Select(i => new Tuple>(i, i.GetTaggedItems(libraryItems).ToList())); - var dtoOptions = request.GetDtoOptions(); + var dtoOptions = GetDtoOptions(request); var dtos = tuples.Select(i => GetDto(i.Item1, user, dtoOptions, i.Item2)); diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs index 2f1c73acef..3063e19c72 100644 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GameGenresService.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetGameGenre(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index db0b0fe612..c659852de8 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetGenre(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index cf9b0b4387..6f6bd2dff6 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -321,14 +321,14 @@ namespace MediaBrowser.Api.UserLibrary var result = await GetItemsToSerialize(request, user, parentItem).ConfigureAwait(false); var isFiltered = result.Item2; - var dtoOptions = request.GetDtoOptions(); + var dtoOptions = GetDtoOptions(request); if (isFiltered) { return new ItemsResult { TotalRecordCount = result.Item1.TotalRecordCount, - Items = result.Item1.Items.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user)).ToArray() + Items = _dtoService.GetBaseItemDtos(result.Item1.Items, dtoOptions, user).ToArray() }; } @@ -362,7 +362,7 @@ namespace MediaBrowser.Api.UserLibrary var pagedItems = ApplyPaging(request, itemsArray); - var returnItems = pagedItems.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user)).ToArray(); + var returnItems = _dtoService.GetBaseItemDtos(pagedItems, dtoOptions, user).ToArray(); return new ItemsResult { diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs index f8575aa7c7..3733128f04 100644 --- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetMusicGenre(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs index 33ce6cd803..b424c93138 100644 --- a/MediaBrowser.Api/UserLibrary/PersonsService.cs +++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs @@ -86,7 +86,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetPerson(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index 272134b70f..a4ebef6846 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -73,7 +73,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = GetStudio(request.Name, LibraryManager); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index 45a330a501..3fc42c6b1a 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -371,7 +371,7 @@ namespace MediaBrowser.Api.UserLibrary } } - var options = request.GetDtoOptions(); + var options = GetDtoOptions(request); var dtos = list.Select(i => { @@ -420,7 +420,7 @@ namespace MediaBrowser.Api.UserLibrary var folders = await _userViewManager.GetUserViews(query, CancellationToken.None).ConfigureAwait(false); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var dtos = folders.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user)) .ToArray(); @@ -447,7 +447,7 @@ namespace MediaBrowser.Api.UserLibrary // Get them from the child tree if (series != null) { - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); // Avoid implicitly captured closure var currentUser = user; @@ -479,7 +479,7 @@ namespace MediaBrowser.Api.UserLibrary // Get them from the db if (movie != null) { - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var dtos = movie.SpecialFeatureIds .Select(_libraryManager.GetItemById) @@ -518,7 +518,7 @@ namespace MediaBrowser.Api.UserLibrary trailerIds = hasTrailers.GetTrailerIds(); } - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var dtos = trailerIds .Select(_libraryManager.GetItemById) @@ -539,7 +539,7 @@ namespace MediaBrowser.Api.UserLibrary var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : _libraryManager.GetItemById(request.Id); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var result = _dtoService.GetBaseItemDto(item, dtoOptions, user); @@ -557,7 +557,7 @@ namespace MediaBrowser.Api.UserLibrary var item = user.RootFolder; - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var result = _dtoService.GetBaseItemDto(item, dtoOptions, user); @@ -577,7 +577,7 @@ namespace MediaBrowser.Api.UserLibrary var items = await _libraryManager.GetIntros(item, user).ConfigureAwait(false); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); var dtos = items.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user)) .ToArray(); diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index b1b0aeb636..d95496333a 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -73,7 +73,7 @@ namespace MediaBrowser.Api.UserLibrary { var item = LibraryManager.GetYear(request.Year); - var dtoOptions = new DtoOptions(); + var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { -- cgit v1.2.3 From a1a56557ece84d8b726a6c06b2620fa43ff22461 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 25 Jan 2015 01:34:50 -0500 Subject: sync updates --- MediaBrowser.Api/BaseApiService.cs | 34 +++++--- MediaBrowser.Api/GamesService.cs | 15 ++-- MediaBrowser.Api/ItemRefreshService.cs | 2 +- MediaBrowser.Api/ItemUpdateService.cs | 2 +- MediaBrowser.Api/Library/LibraryService.cs | 81 +++++++++---------- MediaBrowser.Api/Movies/MoviesService.cs | 11 ++- MediaBrowser.Api/Music/AlbumsService.cs | 8 +- MediaBrowser.Api/SearchService.cs | 8 +- MediaBrowser.Api/SimilarItemsHelper.cs | 10 +-- MediaBrowser.Api/TvShowsService.cs | 19 ++--- .../UserLibrary/BaseItemsByNameService.cs | 66 +++++++++------- MediaBrowser.Api/UserLibrary/ItemsService.cs | 4 +- MediaBrowser.Api/UserLibrary/UserLibraryService.cs | 63 ++++++++------- .../Entities/Audio/MusicAlbum.cs | 5 +- .../Entities/Audio/MusicArtist.cs | 25 ++++-- .../Entities/Audio/MusicGenre.cs | 8 +- MediaBrowser.Controller/Entities/BaseItem.cs | 5 +- MediaBrowser.Controller/Entities/Folder.cs | 91 +++++++++++++--------- MediaBrowser.Controller/Entities/GameGenre.cs | 8 +- MediaBrowser.Controller/Entities/Genre.cs | 7 +- MediaBrowser.Controller/Entities/IItemByName.cs | 5 +- .../Entities/InternalItemsQuery.cs | 2 +- MediaBrowser.Controller/Entities/Movies/BoxSet.cs | 14 +--- MediaBrowser.Controller/Entities/Person.cs | 8 +- MediaBrowser.Controller/Entities/Studio.cs | 8 +- MediaBrowser.Controller/Entities/TV/Season.cs | 6 +- MediaBrowser.Controller/Entities/TV/Series.cs | 16 +--- MediaBrowser.Controller/Entities/UserRootFolder.cs | 9 ++- MediaBrowser.Controller/Entities/UserView.cs | 5 +- .../Entities/UserViewBuilder.cs | 72 +++++++++++------ MediaBrowser.Controller/Entities/Year.cs | 9 ++- MediaBrowser.Controller/Playlists/Playlist.cs | 60 +++++++------- .../ContentDirectory/ControlHandler.cs | 6 +- .../MediaInfo/SubtitleScheduledTask.cs | 10 ++- .../Movies/MovieUpdatesPrescanTask.cs | 5 +- .../Music/AlbumImageFromSongProvider.cs | 3 +- .../Music/AlbumMetadataService.cs | 4 +- .../Music/ArtistMetadataService.cs | 4 +- .../People/TvdbPersonImageProvider.cs | 8 +- MediaBrowser.Providers/TV/DummySeasonProvider.cs | 4 +- .../TV/MissingEpisodeProvider.cs | 31 ++++---- MediaBrowser.Providers/TV/SeriesPostScanTask.cs | 8 +- MediaBrowser.Providers/TV/TvdbPrescanTask.cs | 12 +-- .../Dto/DtoService.cs | 38 +++++---- .../EntryPoints/LibraryChangedNotifier.cs | 3 +- .../FileOrganization/EpisodeFileOrganizer.cs | 11 ++- .../Intros/DefaultIntroProvider.cs | 40 +++++----- .../Library/LibraryManager.cs | 13 ++-- .../Library/LocalTrailerPostScanTask.cs | 7 +- .../Library/MusicManager.cs | 17 ++-- .../Library/SearchEngine.cs | 9 +-- .../Library/Validators/ArtistsValidator.cs | 7 +- .../Library/Validators/GameGenresValidator.cs | 2 +- .../Library/Validators/GenresValidator.cs | 2 +- .../Library/Validators/MusicGenresValidator.cs | 2 +- .../Library/Validators/StudiosValidator.cs | 2 +- .../Library/Validators/YearsPostScanTask.cs | 2 +- .../Photos/PhotoAlbumImageProvider.cs | 2 +- .../Playlists/ManualPlaylistsFolder.cs | 3 +- .../Playlists/PlaylistManager.cs | 3 +- .../ScheduledTasks/ChapterImagesTask.cs | 4 +- .../Session/SessionManager.cs | 7 +- .../Sync/SyncJobProcessor.cs | 10 +-- .../TV/TVSeriesManager.cs | 16 ++-- .../FFMpeg/FFMpegDownloadInfo.cs | 12 +-- MediaBrowser.XbmcMetadata/EntryPoint.cs | 3 +- MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs | 4 +- 67 files changed, 568 insertions(+), 432 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary') diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 2aaec8627a..dff433c9dc 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -174,7 +174,7 @@ namespace MediaBrowser.Api return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager)); } - protected IEnumerable GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId = null) + protected IList GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func filter) { if (!string.IsNullOrEmpty(parentId)) { @@ -189,10 +189,13 @@ namespace MediaBrowser.Api throw new ArgumentException("User not found"); } - return folder.GetRecursiveChildren(user); + return folder + .GetRecursiveChildren(user, filter) + .ToList(); } - return folder.GetRecursiveChildren(); + return folder + .GetRecursiveChildren(filter); } if (userId.HasValue) { @@ -203,10 +206,16 @@ namespace MediaBrowser.Api throw new ArgumentException("User not found"); } - return userManager.GetUserById(userId.Value).RootFolder.GetRecursiveChildren(user); + return userManager + .GetUserById(userId.Value) + .RootFolder + .GetRecursiveChildren(user, filter) + .ToList(); } - return libraryManager.RootFolder.GetRecursiveChildren(); + return libraryManager + .RootFolder + .GetRecursiveChildren(filter); } /// @@ -222,8 +231,9 @@ namespace MediaBrowser.Api return name; } - return libraryManager.RootFolder.RecursiveChildren - .OfType