< Summary - Jellyfin

Information
Class: Jellyfin.Api.Controllers.TrailersController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Controllers/TrailersController.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 92
Coverable lines: 92
Total lines: 297
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
GetTrailers(...)100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Controllers/TrailersController.cs

#LineLine coverage
 1using System;
 2using Jellyfin.Api.ModelBinders;
 3using Jellyfin.Data.Enums;
 4using MediaBrowser.Model.Dto;
 5using MediaBrowser.Model.Entities;
 6using MediaBrowser.Model.Querying;
 7using Microsoft.AspNetCore.Authorization;
 8using Microsoft.AspNetCore.Http;
 9using Microsoft.AspNetCore.Mvc;
 10
 11namespace Jellyfin.Api.Controllers;
 12
 13/// <summary>
 14/// The trailers controller.
 15/// </summary>
 16[Authorize]
 17public class TrailersController : BaseJellyfinApiController
 18{
 19    private readonly ItemsController _itemsController;
 20
 21    /// <summary>
 22    /// Initializes a new instance of the <see cref="TrailersController"/> class.
 23    /// </summary>
 24    /// <param name="itemsController">Instance of <see cref="ItemsController"/>.</param>
 025    public TrailersController(ItemsController itemsController)
 26    {
 027        _itemsController = itemsController;
 028    }
 29
 30    /// <summary>
 31    /// Finds movies and trailers similar to a given trailer.
 32    /// </summary>
 33    /// <param name="userId">The user id supplied as query parameter; this is required when not using an API key.</param
 34    /// <param name="maxOfficialRating">Optional filter by maximum official rating (PG, PG-13, TV-MA, etc).</param>
 35    /// <param name="hasThemeSong">Optional filter by items with theme songs.</param>
 36    /// <param name="hasThemeVideo">Optional filter by items with theme videos.</param>
 37    /// <param name="hasSubtitles">Optional filter by items with subtitles.</param>
 38    /// <param name="hasSpecialFeature">Optional filter by items with special features.</param>
 39    /// <param name="hasTrailer">Optional filter by items with trailers.</param>
 40    /// <param name="adjacentTo">Optional. Return items that are siblings of a supplied item.</param>
 41    /// <param name="parentIndexNumber">Optional filter by parent index number.</param>
 42    /// <param name="hasParentalRating">Optional filter by items that have or do not have a parental rating.</param>
 43    /// <param name="isHd">Optional filter by items that are HD or not.</param>
 44    /// <param name="is4K">Optional filter by items that are 4K or not.</param>
 45    /// <param name="locationTypes">Optional. If specified, results will be filtered based on LocationType. This allows 
 46    /// <param name="excludeLocationTypes">Optional. If specified, results will be filtered based on the LocationType. T
 47    /// <param name="isMissing">Optional filter by items that are missing episodes or not.</param>
 48    /// <param name="isUnaired">Optional filter by items that are unaired episodes or not.</param>
 49    /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
 50    /// <param name="minCriticRating">Optional filter by minimum critic rating.</param>
 51    /// <param name="minPremiereDate">Optional. The minimum premiere date. Format = ISO.</param>
 52    /// <param name="minDateLastSaved">Optional. The minimum last saved date. Format = ISO.</param>
 53    /// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.<
 54    /// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
 55    /// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
 56    /// <param name="hasImdbId">Optional filter by items that have an IMDb id or not.</param>
 57    /// <param name="hasTmdbId">Optional filter by items that have a TMDb id or not.</param>
 58    /// <param name="hasTvdbId">Optional filter by items that have a TVDb id or not.</param>
 59    /// <param name="isMovie">Optional filter for live tv movies.</param>
 60    /// <param name="isSeries">Optional filter for live tv series.</param>
 61    /// <param name="isNews">Optional filter for live tv news.</param>
 62    /// <param name="isKids">Optional filter for live tv kids.</param>
 63    /// <param name="isSports">Optional filter for live tv sports.</param>
 64    /// <param name="excludeItemIds">Optional. If specified, results will be filtered by excluding item ids. This allows
 65    /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped fr
 66    /// <param name="limit">Optional. The maximum number of records to return.</param>
 67    /// <param name="recursive">When searching within folders, this determines whether or not the search will be recursi
 68    /// <param name="searchTerm">Optional. Filter based on a search term.</param>
 69    /// <param name="sortOrder">Sort Order - Ascending, Descending.</param>
 70    /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</
 71    /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows mul
 72    /// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows 
 73    /// <param name="filters">Optional. Specify additional filters to apply. This allows multiple, comma delimited. Opti
 74    /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
 75    /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
 76    /// <param name="imageTypes">Optional. If specified, results will be filtered based on those containing image types.
 77    /// <param name="sortBy">Optional. Specify one or more sort orders, comma delimited. Options: Album, AlbumArtist, Ar
 78    /// <param name="isPlayed">Optional filter by items that are played, or not.</param>
 79    /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe
 80    /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This all
 81    /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe del
 82    /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multi
 83    /// <param name="enableUserData">Optional, include user data.</param>
 84    /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
 85    /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
 86    /// <param name="person">Optional. If specified, results will be filtered to include only those containing the speci
 87    /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the sp
 88    /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only th
 89    /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pi
 90    /// <param name="artists">Optional. If specified, results will be filtered based on artists. This allows multiple, p
 91    /// <param name="excludeArtistIds">Optional. If specified, results will be filtered based on artist id. This allows 
 92    /// <param name="artistIds">Optional. If specified, results will be filtered to include only those containing the sp
 93    /// <param name="albumArtistIds">Optional. If specified, results will be filtered to include only those containing t
 94    /// <param name="contributingArtistIds">Optional. If specified, results will be filtered to include only those conta
 95    /// <param name="albums">Optional. If specified, results will be filtered based on album. This allows multiple, pipe
 96    /// <param name="albumIds">Optional. If specified, results will be filtered based on album id. This allows multiple,
 97    /// <param name="ids">Optional. If specific items are needed, specify a list of item id's to retrieve. This allows m
 98    /// <param name="videoTypes">Optional filter by VideoType (videofile, dvd, bluray, iso). Allows multiple, comma deli
 99    /// <param name="minOfficialRating">Optional filter by minimum official rating (PG, PG-13, TV-MA, etc).</param>
 100    /// <param name="isLocked">Optional filter by items that are locked.</param>
 101    /// <param name="isPlaceHolder">Optional filter by items that are placeholders.</param>
 102    /// <param name="hasOfficialRating">Optional filter by items that have official ratings.</param>
 103    /// <param name="collapseBoxSetItems">Whether or not to hide items behind their boxsets.</param>
 104    /// <param name="minWidth">Optional. Filter by the minimum width of the item.</param>
 105    /// <param name="minHeight">Optional. Filter by the minimum height of the item.</param>
 106    /// <param name="maxWidth">Optional. Filter by the maximum width of the item.</param>
 107    /// <param name="maxHeight">Optional. Filter by the maximum height of the item.</param>
 108    /// <param name="is3D">Optional filter by items that are 3D, or not.</param>
 109    /// <param name="seriesStatus">Optional filter by Series Status. Allows multiple, comma delimited.</param>
 110    /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a gi
 111    /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</p
 112    /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</
 113    /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multipl
 114    /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple,
 115    /// <param name="enableTotalRecordCount">Optional. Enable the total record count.</param>
 116    /// <param name="enableImages">Optional, include image information in output.</param>
 117    /// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the trailers.</returns>
 118    [HttpGet]
 119    [ProducesResponseType(StatusCodes.Status200OK)]
 120    public ActionResult<QueryResult<BaseItemDto>> GetTrailers(
 121        [FromQuery] Guid? userId,
 122        [FromQuery] string? maxOfficialRating,
 123        [FromQuery] bool? hasThemeSong,
 124        [FromQuery] bool? hasThemeVideo,
 125        [FromQuery] bool? hasSubtitles,
 126        [FromQuery] bool? hasSpecialFeature,
 127        [FromQuery] bool? hasTrailer,
 128        [FromQuery] Guid? adjacentTo,
 129        [FromQuery] int? parentIndexNumber,
 130        [FromQuery] bool? hasParentalRating,
 131        [FromQuery] bool? isHd,
 132        [FromQuery] bool? is4K,
 133        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] LocationType[] locationTypes,
 134        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] LocationType[] excludeLocationTypes,
 135        [FromQuery] bool? isMissing,
 136        [FromQuery] bool? isUnaired,
 137        [FromQuery] double? minCommunityRating,
 138        [FromQuery] double? minCriticRating,
 139        [FromQuery] DateTime? minPremiereDate,
 140        [FromQuery] DateTime? minDateLastSaved,
 141        [FromQuery] DateTime? minDateLastSavedForUser,
 142        [FromQuery] DateTime? maxPremiereDate,
 143        [FromQuery] bool? hasOverview,
 144        [FromQuery] bool? hasImdbId,
 145        [FromQuery] bool? hasTmdbId,
 146        [FromQuery] bool? hasTvdbId,
 147        [FromQuery] bool? isMovie,
 148        [FromQuery] bool? isSeries,
 149        [FromQuery] bool? isNews,
 150        [FromQuery] bool? isKids,
 151        [FromQuery] bool? isSports,
 152        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] excludeItemIds,
 153        [FromQuery] int? startIndex,
 154        [FromQuery] int? limit,
 155        [FromQuery] bool? recursive,
 156        [FromQuery] string? searchTerm,
 157        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
 158        [FromQuery] Guid? parentId,
 159        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
 160        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
 161        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
 162        [FromQuery] bool? isFavorite,
 163        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] MediaType[] mediaTypes,
 164        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
 165        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
 166        [FromQuery] bool? isPlayed,
 167        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
 168        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
 169        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] tags,
 170        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] int[] years,
 171        [FromQuery] bool? enableUserData,
 172        [FromQuery] int? imageTypeLimit,
 173        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
 174        [FromQuery] string? person,
 175        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] personIds,
 176        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] personTypes,
 177        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] studios,
 178        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] artists,
 179        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] excludeArtistIds,
 180        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] artistIds,
 181        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] albumArtistIds,
 182        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] contributingArtistIds,
 183        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] albums,
 184        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] albumIds,
 185        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] ids,
 186        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] VideoType[] videoTypes,
 187        [FromQuery] string? minOfficialRating,
 188        [FromQuery] bool? isLocked,
 189        [FromQuery] bool? isPlaceHolder,
 190        [FromQuery] bool? hasOfficialRating,
 191        [FromQuery] bool? collapseBoxSetItems,
 192        [FromQuery] int? minWidth,
 193        [FromQuery] int? minHeight,
 194        [FromQuery] int? maxWidth,
 195        [FromQuery] int? maxHeight,
 196        [FromQuery] bool? is3D,
 197        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SeriesStatus[] seriesStatus,
 198        [FromQuery] string? nameStartsWithOrGreater,
 199        [FromQuery] string? nameStartsWith,
 200        [FromQuery] string? nameLessThan,
 201        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] studioIds,
 202        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] genreIds,
 203        [FromQuery] bool enableTotalRecordCount = true,
 204        [FromQuery] bool? enableImages = true)
 205    {
 0206        var includeItemTypes = new[] { BaseItemKind.Trailer };
 207
 0208        return _itemsController
 0209            .GetItems(
 0210                userId,
 0211                maxOfficialRating,
 0212                hasThemeSong,
 0213                hasThemeVideo,
 0214                hasSubtitles,
 0215                hasSpecialFeature,
 0216                hasTrailer,
 0217                adjacentTo,
 0218                null,
 0219                parentIndexNumber,
 0220                hasParentalRating,
 0221                isHd,
 0222                is4K,
 0223                locationTypes,
 0224                excludeLocationTypes,
 0225                isMissing,
 0226                isUnaired,
 0227                minCommunityRating,
 0228                minCriticRating,
 0229                minPremiereDate,
 0230                minDateLastSaved,
 0231                minDateLastSavedForUser,
 0232                maxPremiereDate,
 0233                hasOverview,
 0234                hasImdbId,
 0235                hasTmdbId,
 0236                hasTvdbId,
 0237                isMovie,
 0238                isSeries,
 0239                isNews,
 0240                isKids,
 0241                isSports,
 0242                excludeItemIds,
 0243                startIndex,
 0244                limit,
 0245                recursive,
 0246                searchTerm,
 0247                sortOrder,
 0248                parentId,
 0249                fields,
 0250                excludeItemTypes,
 0251                includeItemTypes,
 0252                filters,
 0253                isFavorite,
 0254                mediaTypes,
 0255                imageTypes,
 0256                sortBy,
 0257                isPlayed,
 0258                genres,
 0259                officialRatings,
 0260                tags,
 0261                years,
 0262                enableUserData,
 0263                imageTypeLimit,
 0264                enableImageTypes,
 0265                person,
 0266                personIds,
 0267                personTypes,
 0268                studios,
 0269                artists,
 0270                excludeArtistIds,
 0271                artistIds,
 0272                albumArtistIds,
 0273                contributingArtistIds,
 0274                albums,
 0275                albumIds,
 0276                ids,
 0277                videoTypes,
 0278                minOfficialRating,
 0279                isLocked,
 0280                isPlaceHolder,
 0281                hasOfficialRating,
 0282                collapseBoxSetItems,
 0283                minWidth,
 0284                minHeight,
 0285                maxWidth,
 0286                maxHeight,
 0287                is3D,
 0288                seriesStatus,
 0289                nameStartsWithOrGreater,
 0290                nameStartsWith,
 0291                nameLessThan,
 0292                studioIds,
 0293                genreIds,
 0294                enableTotalRecordCount,
 0295                enableImages);
 296    }
 297}

Methods/Properties

.ctor(Jellyfin.Api.Controllers.ItemsController)
GetTrailers(System.Nullable`1<System.Guid>,System.String,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Guid>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,MediaBrowser.Model.Entities.LocationType[],MediaBrowser.Model.Entities.LocationType[],System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Double>,System.Nullable`1<System.Double>,System.Nullable`1<System.DateTime>,System.Nullable`1<System.DateTime>,System.Nullable`1<System.DateTime>,System.Nullable`1<System.DateTime>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Guid[],System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Boolean>,System.String,Jellyfin.Data.Enums.SortOrder[],System.Nullable`1<System.Guid>,MediaBrowser.Model.Querying.ItemFields[],Jellyfin.Data.Enums.BaseItemKind[],MediaBrowser.Model.Querying.ItemFilter[],System.Nullable`1<System.Boolean>,Jellyfin.Data.Enums.MediaType[],MediaBrowser.Model.Entities.ImageType[],Jellyfin.Data.Enums.ItemSortBy[],System.Nullable`1<System.Boolean>,System.String[],System.String[],System.String[],System.Int32[],System.Nullable`1<System.Boolean>,System.Nullable`1<System.Int32>,MediaBrowser.Model.Entities.ImageType[],System.String,System.Guid[],System.String[],System.String[],System.String[],System.Guid[],System.Guid[],System.Guid[],System.Guid[],System.String[],System.Guid[],System.Guid[],MediaBrowser.Model.Entities.VideoType[],System.String,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Boolean>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Boolean>,MediaBrowser.Model.Entities.SeriesStatus[],System.String,System.String,System.String,System.Guid[],System.Guid[],System.Boolean,System.Nullable`1<System.Boolean>)