예제 #1
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetSimilarAlbums request)
        {
            var result = SimilarItemsHelper.GetSimilarItemsResult(_userManager,
                                                                  _itemRepo,
                                                                  _libraryManager,
                                                                  _userDataRepository,
                                                                  _dtoService,
                                                                  Logger,
                                                                  request, item => item is MusicAlbum,
                                                                  GetAlbumSimilarityScore);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
예제 #2
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetSimilarAlbums request)
        {
            var dtoOptions = GetDtoOptions(request);

            var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
                                                                  _itemRepo,
                                                                  _libraryManager,
                                                                  _userDataRepository,
                                                                  _dtoService,
                                                                  Logger,
                                                                  request, new[] { typeof(MusicAlbum) },
                                                                  GetAlbumSimilarityScore);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
예제 #3
0
        public object Get(GetSimilarArtists request)
        {
            var dtoOptions = GetDtoOptions(_authContext, request);

            var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
                                                                  _itemRepo,
                                                                  _libraryManager,
                                                                  _userDataRepository,
                                                                  _dtoService,
                                                                  Logger,
                                                                  request, new[] { typeof(MusicArtist) },
                                                                  SimilarItemsHelper.GetSimiliarityScore);

            return(ToOptimizedResult(result));
        }
예제 #4
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public async Task <object> Get(GetSimilarAlbums request)
        {
            var dtoOptions = GetDtoOptions(_authContext, request);

            var result = await SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
                                                                        _itemRepo,
                                                                        _libraryManager,
                                                                        _userDataRepository,
                                                                        _dtoService,
                                                                        Logger,
                                                                        request, new[] { typeof(MusicAlbum) },
                                                                        GetAlbumSimilarityScore).ConfigureAwait(false);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
예제 #5
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetSimilarTrailers request)
        {
            var result = SimilarItemsHelper.GetSimilarItemsResult(_userManager,
                                                                  _itemRepo,
                                                                  _libraryManager,
                                                                  _userDataRepository,
                                                                  _dtoService,
                                                                  Logger,

                                                                  // Strip out secondary versions
                                                                  request, item => (item is Movie || item is Trailer) && !((Video)item).PrimaryVersionId.HasValue,

                                                                  SimilarItemsHelper.GetSimiliarityScore);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
예제 #6
0
        public ActionResult <QueryResult <BaseItemDto> > GetSimilarArtists(
            [FromRoute] string artistId,
            [FromQuery] Guid?userId,
            [FromQuery] string?excludeArtistIds,
            [FromQuery] int?limit)
        {
            var dtoOptions = new DtoOptions().AddClientFields(Request);

            return(SimilarItemsHelper.GetSimilarItemsResult(
                       dtoOptions,
                       _userManager,
                       _libraryManager,
                       _dtoService,
                       userId,
                       artistId,
                       excludeArtistIds,
                       limit,
                       new[] { typeof(MusicArtist) },
                       SimilarItemsHelper.GetSimiliarityScore));
        }