Remove redundant qualifiers

This commit is contained in:
Patrick Barron 2020-05-20 13:07:53 -04:00
parent 7d9d54d2ec
commit c464f700db
63 changed files with 415 additions and 336 deletions

View File

@ -4,12 +4,12 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using Emby.Dlna.Service;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.TV;
@ -33,7 +33,8 @@ namespace Emby.Dlna.ContentDirectory
private readonly IMediaEncoder _mediaEncoder;
private readonly ITVSeriesManager _tvSeriesManager;
public ContentDirectory(IDlnaManager dlna,
public ContentDirectory(
IDlnaManager dlna,
IUserDataManager userDataManager,
IImageProcessor imageProcessor,
ILibraryManager libraryManager,
@ -106,7 +107,7 @@ namespace Emby.Dlna.ContentDirectory
.ProcessControlRequestAsync(request);
}
private Jellyfin.Data.Entities.User GetUser(DeviceProfile profile)
private User GetUser(DeviceProfile profile)
{
if (!string.IsNullOrEmpty(profile.UserId))
{

View File

@ -10,6 +10,7 @@ using System.Threading;
using System.Xml;
using Emby.Dlna.Didl;
using Emby.Dlna.Service;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
@ -17,7 +18,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding;
@ -28,6 +28,12 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
using Book = MediaBrowser.Controller.Entities.Book;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace Emby.Dlna.ContentDirectory
{
@ -36,7 +42,7 @@ namespace Emby.Dlna.ContentDirectory
private readonly ILibraryManager _libraryManager;
private readonly IUserDataManager _userDataManager;
private readonly IServerConfigurationManager _config;
private readonly Jellyfin.Data.Entities.User _user;
private readonly User _user;
private readonly IUserViewManager _userViewManager;
private readonly ITVSeriesManager _tvSeriesManager;
@ -59,7 +65,7 @@ namespace Emby.Dlna.ContentDirectory
string accessToken,
IImageProcessor imageProcessor,
IUserDataManager userDataManager,
Jellyfin.Data.Entities.User user,
User user,
int systemUpdateId,
IServerConfigurationManager config,
ILocalizationManager localization,
@ -432,7 +438,7 @@ namespace Emby.Dlna.ContentDirectory
xmlWriter.WriteElementString("UpdateID", _systemUpdateId.ToString(CultureInfo.InvariantCulture));
}
private QueryResult<BaseItem> GetChildrenSorted(BaseItem item, Jellyfin.Data.Entities.User user, SearchCriteria search, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<BaseItem> GetChildrenSorted(BaseItem item, User user, SearchCriteria search, SortCriteria sort, int? startIndex, int? limit)
{
var folder = (Folder)item;
@ -489,7 +495,7 @@ namespace Emby.Dlna.ContentDirectory
return new DtoOptions(true);
}
private QueryResult<ServerItem> GetUserItems(BaseItem item, StubType? stubType, Jellyfin.Data.Entities.User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetUserItems(BaseItem item, StubType? stubType, User user, SortCriteria sort, int? startIndex, int? limit)
{
if (item is MusicGenre)
{
@ -558,7 +564,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(queryResult);
}
private QueryResult<ServerItem> GetLiveTvChannels(Jellyfin.Data.Entities.User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetLiveTvChannels(User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -574,7 +580,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicFolders(BaseItem item, Jellyfin.Data.Entities.User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMusicFolders(BaseItem item, User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -692,7 +698,7 @@ namespace Emby.Dlna.ContentDirectory
};
}
private QueryResult<ServerItem> GetMovieFolders(BaseItem item, Jellyfin.Data.Entities.User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMovieFolders(BaseItem item, User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -766,7 +772,7 @@ namespace Emby.Dlna.ContentDirectory
};
}
private QueryResult<ServerItem> GetFolders(Jellyfin.Data.Entities.User user, int? startIndex, int? limit)
private QueryResult<ServerItem> GetFolders(User user, int? startIndex, int? limit)
{
var folders = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.OrderBy(i => i.SortName)
@ -783,7 +789,7 @@ namespace Emby.Dlna.ContentDirectory
}, startIndex, limit);
}
private QueryResult<ServerItem> GetTvFolders(BaseItem item, Jellyfin.Data.Entities.User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetTvFolders(BaseItem item, User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -871,7 +877,7 @@ namespace Emby.Dlna.ContentDirectory
};
}
private QueryResult<ServerItem> GetMovieContinueWatching(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMovieContinueWatching(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -891,7 +897,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetSeries(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetSeries(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -904,7 +910,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMovieMovies(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMovieMovies(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -917,7 +923,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMovieCollections(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMovieCollections(User user, InternalItemsQuery query)
{
query.Recursive = true;
//query.Parent = parent;
@ -930,7 +936,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicAlbums(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicAlbums(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -943,7 +949,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicSongs(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicSongs(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -956,7 +962,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetFavoriteSongs(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetFavoriteSongs(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -969,7 +975,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetFavoriteSeries(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetFavoriteSeries(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -982,7 +988,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetFavoriteEpisodes(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetFavoriteEpisodes(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -995,7 +1001,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMovieFavorites(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMovieFavorites(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -1008,7 +1014,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetFavoriteAlbums(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetFavoriteAlbums(BaseItem parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -1021,7 +1027,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetGenres(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetGenres(BaseItem parent, User user, InternalItemsQuery query)
{
var genresResult = _libraryManager.GetGenres(new InternalItemsQuery(user)
{
@ -1039,7 +1045,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicGenres(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicGenres(BaseItem parent, User user, InternalItemsQuery query)
{
var genresResult = _libraryManager.GetMusicGenres(new InternalItemsQuery(user)
{
@ -1057,7 +1063,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicAlbumArtists(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicAlbumArtists(BaseItem parent, User user, InternalItemsQuery query)
{
var artists = _libraryManager.GetAlbumArtists(new InternalItemsQuery(user)
{
@ -1075,7 +1081,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicArtists(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicArtists(BaseItem parent, User user, InternalItemsQuery query)
{
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
{
@ -1093,7 +1099,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetFavoriteArtists(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetFavoriteArtists(BaseItem parent, User user, InternalItemsQuery query)
{
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
{
@ -1112,7 +1118,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicPlaylists(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicPlaylists(User user, InternalItemsQuery query)
{
query.Parent = null;
query.IncludeItemTypes = new[] { nameof(Playlist) };
@ -1124,7 +1130,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicLatest(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMusicLatest(BaseItem parent, User user, InternalItemsQuery query)
{
query.OrderBy = Array.Empty<(string, SortOrder)>();
@ -1154,7 +1160,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetTvLatest(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetTvLatest(BaseItem parent, User user, InternalItemsQuery query)
{
query.OrderBy = Array.Empty<(string, SortOrder)>();
@ -1170,7 +1176,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(items);
}
private QueryResult<ServerItem> GetMovieLatest(BaseItem parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<ServerItem> GetMovieLatest(BaseItem parent, User user, InternalItemsQuery query)
{
query.OrderBy = Array.Empty<(string, SortOrder)>();
@ -1187,7 +1193,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(items);
}
private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid parentId, Jellyfin.Data.Entities.User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -1207,7 +1213,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid parentId, Jellyfin.Data.Entities.User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
@ -1231,7 +1237,7 @@ namespace Emby.Dlna.ContentDirectory
return ToResult(result);
}
private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid parentId, Jellyfin.Data.Entities.User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{

View File

@ -7,12 +7,12 @@ using System.Linq;
using System.Text;
using System.Xml;
using Emby.Dlna.ContentDirectory;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Playlists;
@ -22,6 +22,13 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
using XmlAttribute = MediaBrowser.Model.Dlna.XmlAttribute;
namespace Emby.Dlna.Didl
{
@ -38,7 +45,7 @@ namespace Emby.Dlna.Didl
private readonly IImageProcessor _imageProcessor;
private readonly string _serverAddress;
private readonly string _accessToken;
private readonly Jellyfin.Data.Entities.User _user;
private readonly User _user;
private readonly IUserDataManager _userDataManager;
private readonly ILocalizationManager _localization;
private readonly IMediaSourceManager _mediaSourceManager;
@ -48,7 +55,7 @@ namespace Emby.Dlna.Didl
public DidlBuilder(
DeviceProfile profile,
Jellyfin.Data.Entities.User user,
User user,
IImageProcessor imageProcessor,
string serverAddress,
string accessToken,
@ -77,7 +84,7 @@ namespace Emby.Dlna.Didl
return url + "&dlnaheaders=true";
}
public string GetItemDidl(BaseItem item, Jellyfin.Data.Entities.User user, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
public string GetItemDidl(BaseItem item, User user, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
{
var settings = new XmlWriterSettings
{
@ -131,7 +138,7 @@ namespace Emby.Dlna.Didl
public void WriteItemElement(
XmlWriter writer,
BaseItem item,
Jellyfin.Data.Entities.User user,
User user,
BaseItem context,
StubType? contextStubType,
string deviceId,
@ -420,7 +427,6 @@ namespace Emby.Dlna.Didl
case StubType.FavoriteSeries: return _localization.GetLocalizedString("HeaderFavoriteShows");
case StubType.FavoriteEpisodes: return _localization.GetLocalizedString("HeaderFavoriteEpisodes");
case StubType.Series: return _localization.GetLocalizedString("Shows");
default: break;
}
}
@ -662,14 +668,14 @@ namespace Emby.Dlna.Didl
writer.WriteFullEndElement();
}
private void AddSamsungBookmarkInfo(BaseItem item, Jellyfin.Data.Entities.User user, XmlWriter writer, StreamInfo streamInfo)
private void AddSamsungBookmarkInfo(BaseItem item, User user, XmlWriter writer, StreamInfo streamInfo)
{
if (!item.SupportsPositionTicksResume || item is Folder)
{
return;
}
MediaBrowser.Model.Dlna.XmlAttribute secAttribute = null;
XmlAttribute secAttribute = null;
foreach (var attribute in _profile.XmlRootAttributes)
{
if (string.Equals(attribute.Name, "xmlns:sec", StringComparison.OrdinalIgnoreCase))
@ -994,7 +1000,6 @@ namespace Emby.Dlna.Didl
}
AddImageResElement(item, writer, 160, 160, "jpg", "JPEG_TN");
}
private void AddImageResElement(

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna.Didl;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
@ -22,6 +23,7 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Session;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Logging;
using Photo = MediaBrowser.Controller.Entities.Photo;
namespace Emby.Dlna.PlayTo
{
@ -443,7 +445,7 @@ namespace Emby.Dlna.PlayTo
private PlaylistItem CreatePlaylistItem(
BaseItem item,
Jellyfin.Data.Entities.User user,
User user,
long startPostionTicks,
string mediaSourceId,
int? audioStreamIndex,

View File

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
@ -82,7 +83,7 @@ namespace Emby.Notifications
private Task SendNotification(
NotificationRequest request,
INotificationService service,
IEnumerable<Jellyfin.Data.Entities.User> users,
IEnumerable<User> users,
string title,
string description,
CancellationToken cancellationToken)
@ -130,7 +131,7 @@ namespace Emby.Notifications
INotificationService service,
string title,
string description,
Jellyfin.Data.Entities.User user,
User user,
CancellationToken cancellationToken)
{
var notification = new UserNotification
@ -155,7 +156,7 @@ namespace Emby.Notifications
}
}
private bool IsEnabledForUser(INotificationService service, Jellyfin.Data.Entities.User user)
private bool IsEnabledForUser(INotificationService service, User user)
{
try
{

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Channels;
@ -13,8 +14,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Channels;
@ -24,6 +23,11 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace Emby.Server.Implementations.Channels
{
@ -793,7 +797,7 @@ namespace Emby.Server.Implementations.Channels
private async Task<ChannelItemResult> GetChannelItems(
IChannel channel,
Jellyfin.Data.Entities.User user,
User user,
string externalFolderId,
ChannelItemSortField? sortField,
bool sortDescending,

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Configuration;
@ -121,7 +122,7 @@ namespace Emby.Server.Implementations.Collections
return EnsureLibraryFolder(GetCollectionsFolderPath(), createIfNeeded);
}
private IEnumerable<BoxSet> GetCollections(Jellyfin.Data.Entities.User user)
private IEnumerable<BoxSet> GetCollections(User user)
{
var folder = GetCollectionsFolder(false).Result;
@ -325,7 +326,7 @@ namespace Emby.Server.Implementations.Collections
}
/// <inheritdoc />
public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user)
public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, User user)
{
var results = new Dictionary<Guid, BaseItem>();

View File

@ -6,6 +6,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common;
using MediaBrowser.Controller.Channels;
@ -13,8 +14,6 @@ using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
@ -25,6 +24,14 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
using Book = MediaBrowser.Controller.Entities.Book;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Person = MediaBrowser.Controller.Entities.Person;
using Photo = MediaBrowser.Controller.Entities.Photo;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace Emby.Server.Implementations.Dto
{
@ -75,7 +82,7 @@ namespace Emby.Server.Implementations.Dto
/// <param name="owner">The owner.</param>
/// <returns>Task{DtoBaseItem}.</returns>
/// <exception cref="ArgumentNullException">item</exception>
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, Jellyfin.Data.Entities.User user = null, BaseItem owner = null)
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null)
{
var options = new DtoOptions
{
@ -86,7 +93,7 @@ namespace Emby.Server.Implementations.Dto
}
/// <inheritdoc />
public IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, Jellyfin.Data.Entities.User user = null, BaseItem owner = null)
public IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
{
var returnItems = new BaseItemDto[items.Count];
var programTuples = new List<(BaseItem, BaseItemDto)>();
@ -139,7 +146,7 @@ namespace Emby.Server.Implementations.Dto
return returnItems;
}
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, Jellyfin.Data.Entities.User user = null, BaseItem owner = null)
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
{
var dto = GetBaseItemDtoInternal(item, options, user, owner);
if (item is LiveTvChannel tvChannel)
@ -173,7 +180,7 @@ namespace Emby.Server.Implementations.Dto
return dto;
}
private static IList<BaseItem> GetTaggedItems(IItemByName byName, Jellyfin.Data.Entities.User user, DtoOptions options)
private static IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options)
{
return byName.GetTaggedItems(
new InternalItemsQuery(user)
@ -183,7 +190,7 @@ namespace Emby.Server.Implementations.Dto
});
}
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, Jellyfin.Data.Entities.User user = null, BaseItem owner = null)
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
{
var dto = new BaseItemDto
{
@ -316,7 +323,7 @@ namespace Emby.Server.Implementations.Dto
}
}
public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, Jellyfin.Data.Entities.User user = null)
public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null)
{
var dto = GetBaseItemDtoInternal(item, options, user);
@ -328,7 +335,7 @@ namespace Emby.Server.Implementations.Dto
return dto;
}
private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, Jellyfin.Data.Entities.User user = null)
private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)
{
if (item is MusicArtist)
{
@ -364,7 +371,7 @@ namespace Emby.Server.Implementations.Dto
/// <summary>
/// Attaches the user specific info.
/// </summary>
private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, Jellyfin.Data.Entities.User user, DtoOptions options)
private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, DtoOptions options)
{
if (item.IsFolder)
{
@ -423,7 +430,7 @@ namespace Emby.Server.Implementations.Dto
}
}
private static int GetChildCount(Folder folder, Jellyfin.Data.Entities.User user)
private static int GetChildCount(Folder folder, User user)
{
// Right now this is too slow to calculate for top level folders on a per-user basis
// Just return something so that apps that are expecting a value won't think the folders are empty

View File

@ -6,6 +6,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -446,7 +447,7 @@ namespace Emby.Server.Implementations.EntryPoints
/// <param name="user">The user.</param>
/// <param name="includeIfNotFound">if set to <c>true</c> [include if not found].</param>
/// <returns>IEnumerable{``0}.</returns>
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, Jellyfin.Data.Entities.User user, bool includeIfNotFound = false)
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, User user, bool includeIfNotFound = false)
where T : BaseItem
{
// If the physical root changed, return the user root

View File

@ -1,7 +1,7 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Controller.Entities;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Security;
@ -42,14 +42,14 @@ namespace Emby.Server.Implementations.HttpServer.Security
return GetSession((IRequest)requestContext);
}
public Jellyfin.Data.Entities.User GetUser(IRequest requestContext)
public User GetUser(IRequest requestContext)
{
var session = GetSession(requestContext);
return session == null || session.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(session.UserId);
}
public Jellyfin.Data.Entities.User GetUser(object requestContext)
public User GetUser(object requestContext)
{
return GetUser((IRequest)requestContext);
}

View File

@ -17,6 +17,7 @@ using Emby.Server.Implementations.Library.Resolvers;
using Emby.Server.Implementations.Library.Validators;
using Emby.Server.Implementations.Playlists;
using Emby.Server.Implementations.ScheduledTasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
@ -25,7 +26,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
@ -45,6 +45,9 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Providers.MediaInfo;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Person = MediaBrowser.Controller.Entities.Person;
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
using VideoResolver = Emby.Naming.Video.VideoResolver;
@ -1471,7 +1474,7 @@ namespace Emby.Server.Implementations.Library
query.Parent = null;
}
private void AddUserToQuery(InternalItemsQuery query, Jellyfin.Data.Entities.User user, bool allowExternalContent = true)
private void AddUserToQuery(InternalItemsQuery query, User user, bool allowExternalContent = true)
{
if (query.AncestorIds.Length == 0 &&
query.ParentId.Equals(Guid.Empty) &&
@ -1492,7 +1495,7 @@ namespace Emby.Server.Implementations.Library
}
}
private IEnumerable<Guid> GetTopParentIdsForQuery(BaseItem item, Jellyfin.Data.Entities.User user)
private IEnumerable<Guid> GetTopParentIdsForQuery(BaseItem item, User user)
{
if (item is UserView view)
{
@ -1559,7 +1562,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="item">The item.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{System.String}.</returns>
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, Jellyfin.Data.Entities.User user)
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user)
{
var tasks = IntroProviders
.OrderBy(i => i.GetType().Name.Contains("Default", StringComparison.OrdinalIgnoreCase) ? 1 : 0)
@ -1581,7 +1584,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="item">The item.</param>
/// <param name="user">The user.</param>
/// <returns>Task&lt;IEnumerable&lt;IntroInfo&gt;&gt;.</returns>
private async Task<IEnumerable<IntroInfo>> GetIntros(IIntroProvider provider, BaseItem item, Jellyfin.Data.Entities.User user)
private async Task<IEnumerable<IntroInfo>> GetIntros(IIntroProvider provider, BaseItem item, User user)
{
try
{
@ -1682,7 +1685,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="sortBy">The sort by.</param>
/// <param name="sortOrder">The sort order.</param>
/// <returns>IEnumerable{BaseItem}.</returns>
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user, IEnumerable<string> sortBy, SortOrder sortOrder)
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy, SortOrder sortOrder)
{
var isFirst = true;
@ -1705,7 +1708,7 @@ namespace Emby.Server.Implementations.Library
return orderedItems ?? items;
}
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user, IEnumerable<ValueTuple<string, SortOrder>> orderByList)
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ValueTuple<string, SortOrder>> orderByList)
{
var isFirst = true;
@ -1742,7 +1745,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="name">The name.</param>
/// <param name="user">The user.</param>
/// <returns>IBaseItemComparer.</returns>
private IBaseItemComparer GetComparer(string name, Jellyfin.Data.Entities.User user)
private IBaseItemComparer GetComparer(string name, User user)
{
var comparer = Comparers.FirstOrDefault(c => string.Equals(name, c.Name, StringComparison.OrdinalIgnoreCase));
@ -2074,7 +2077,7 @@ namespace Emby.Server.Implementations.Library
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
public UserView GetNamedView(
Jellyfin.Data.Entities.User user,
User user,
string name,
string viewType,
string sortName)
@ -2127,7 +2130,7 @@ namespace Emby.Server.Implementations.Library
}
public UserView GetNamedView(
Jellyfin.Data.Entities.User user,
User user,
string name,
Guid parentId,
string viewType,

View File

@ -7,6 +7,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
@ -145,7 +146,7 @@ namespace Emby.Server.Implementations.Library
});
}
public async Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, Jellyfin.Data.Entities.User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken)
public async Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken)
{
var mediaSources = GetStaticMediaSources(item, enablePathSubstitution, user);
@ -309,7 +310,7 @@ namespace Emby.Server.Implementations.Library
return sources.FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
}
public List<MediaSourceInfo> GetStaticMediaSources(BaseItem item, bool enablePathSubstitution, Jellyfin.Data.Entities.User user = null)
public List<MediaSourceInfo> GetStaticMediaSources(BaseItem item, bool enablePathSubstitution, User user = null)
{
if (item == null)
{
@ -347,7 +348,7 @@ namespace Emby.Server.Implementations.Library
return new string[] { language };
}
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, Jellyfin.Data.Entities.User user, bool allowRememberingSelection)
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
{
if (userData.SubtitleStreamIndex.HasValue
&& user.RememberSubtitleSelections
@ -380,7 +381,7 @@ namespace Emby.Server.Implementations.Library
MediaStreamSelector.SetSubtitleStreamScores(source.MediaStreams, preferredSubs, user.SubtitleMode, audioLangage);
}
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, Jellyfin.Data.Entities.User user, bool allowRememberingSelection)
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
{
if (userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection)
{
@ -400,7 +401,7 @@ namespace Emby.Server.Implementations.Library
source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(source.MediaStreams, preferredAudio, user.PlayDefaultAudioTrack);
}
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, Jellyfin.Data.Entities.User user)
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
{
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
var mediaType = item == null ? MediaType.Video : item.MediaType;
@ -538,7 +539,7 @@ namespace Emby.Server.Implementations.Library
mediaSource.RunTimeTicks = null;
}
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Audio);
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
if (audioStream == null || audioStream.Index == -1)
{
@ -549,7 +550,7 @@ namespace Emby.Server.Implementations.Library
mediaSource.DefaultAudioStreamIndex = audioStream.Index;
}
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Video);
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
if (videoStream != null)
{
if (!videoStream.BitRate.HasValue)

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -10,6 +11,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
namespace Emby.Server.Implementations.Library
{
@ -22,7 +24,7 @@ namespace Emby.Server.Implementations.Library
_libraryManager = libraryManager;
}
public List<BaseItem> GetInstantMixFromSong(Audio item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromSong(Audio item, User user, DtoOptions dtoOptions)
{
var list = new List<Audio>
{
@ -32,17 +34,17 @@ namespace Emby.Server.Implementations.Library
return list.Concat(GetInstantMixFromGenres(item.Genres, user, dtoOptions)).ToList();
}
public List<BaseItem> GetInstantMixFromArtist(MusicArtist item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromArtist(MusicArtist item, User user, DtoOptions dtoOptions)
{
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
}
public List<BaseItem> GetInstantMixFromAlbum(MusicAlbum item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromAlbum(MusicAlbum item, User user, DtoOptions dtoOptions)
{
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
}
public List<BaseItem> GetInstantMixFromFolder(Folder item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromFolder(Folder item, User user, DtoOptions dtoOptions)
{
var genres = item
.GetRecursiveChildren(user, new InternalItemsQuery(user)
@ -58,12 +60,12 @@ namespace Emby.Server.Implementations.Library
return GetInstantMixFromGenres(genres, user, dtoOptions);
}
public List<BaseItem> GetInstantMixFromPlaylist(Playlist item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromPlaylist(Playlist item, User user, DtoOptions dtoOptions)
{
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
}
public List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User user, DtoOptions dtoOptions)
{
var genreIds = genres.DistinctNames().Select(i =>
{
@ -80,7 +82,7 @@ namespace Emby.Server.Implementations.Library
return GetInstantMixFromGenreIds(genreIds, user, dtoOptions);
}
public List<BaseItem> GetInstantMixFromGenreIds(Guid[] genreIds, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromGenreIds(Guid[] genreIds, User user, DtoOptions dtoOptions)
{
return _libraryManager.GetItemList(new InternalItemsQuery(user)
{
@ -96,7 +98,7 @@ namespace Emby.Server.Implementations.Library
});
}
public List<BaseItem> GetInstantMixFromItem(BaseItem item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
public List<BaseItem> GetInstantMixFromItem(BaseItem item, User user, DtoOptions dtoOptions)
{
var genre = item as MusicGenre;
if (genre != null)

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -12,6 +13,8 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Search;
using Microsoft.Extensions.Logging;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Person = MediaBrowser.Controller.Entities.Person;
namespace Emby.Server.Implementations.Library
{
@ -30,7 +33,7 @@ namespace Emby.Server.Implementations.Library
public QueryResult<SearchHintInfo> GetSearchHints(SearchQuery query)
{
Jellyfin.Data.Entities.User user = null;
User user = null;
if (query.UserId.Equals(Guid.Empty))
{
@ -76,7 +79,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="user">The user.</param>
/// <returns>IEnumerable{SearchHintResult}.</returns>
/// <exception cref="ArgumentNullException">searchTerm</exception>
private List<SearchHintInfo> GetSearchHints(SearchQuery query, Jellyfin.Data.Entities.User user)
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
{
var searchTerm = query.SearchTerm;

View File

@ -5,6 +5,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@ -50,7 +51,7 @@ namespace Emby.Server.Implementations.Library
SaveUserData(user, item, userData, reason, cancellationToken);
}
public void SaveUserData(Jellyfin.Data.Entities.User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
public void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
{
if (userData == null)
{
@ -119,7 +120,7 @@ namespace Emby.Server.Implementations.Library
return GetUserData(user, itemId, keys);
}
public UserItemData GetUserData(Jellyfin.Data.Entities.User user, Guid itemId, List<string> keys)
public UserItemData GetUserData(User user, Guid itemId, List<string> keys)
{
var userId = user.InternalId;
@ -157,7 +158,7 @@ namespace Emby.Server.Implementations.Library
return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N", CultureInfo.InvariantCulture);
}
public UserItemData GetUserData(Jellyfin.Data.Entities.User user, BaseItem item)
public UserItemData GetUserData(User user, BaseItem item)
{
return GetUserData(user, item.Id, item.GetUserDataKeys());
}
@ -167,7 +168,7 @@ namespace Emby.Server.Implementations.Library
return GetUserData(userId, item.Id, item.GetUserDataKeys());
}
public UserItemDataDto GetUserDataDto(BaseItem item, Jellyfin.Data.Entities.User user)
public UserItemDataDto GetUserDataDto(BaseItem item, User user)
{
var userData = GetUserData(user, item);
var dto = GetUserItemDataDto(userData);
@ -176,7 +177,7 @@ namespace Emby.Server.Implementations.Library
return dto;
}
public UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, Jellyfin.Data.Entities.User user, DtoOptions options)
public UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, User user, DtoOptions options)
{
var userData = GetUserData(user, item);
var dto = GetUserItemDataDto(userData);

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
@ -18,6 +19,8 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Person = MediaBrowser.Controller.Entities.Person;
namespace Emby.Server.Implementations.Library
{
@ -233,7 +236,7 @@ namespace Emby.Server.Implementations.Library
return list;
}
private IReadOnlyList<BaseItem> GetItemsForLatestItems(Jellyfin.Data.Entities.User user, LatestItemsQuery request, DtoOptions options)
private IReadOnlyList<BaseItem> GetItemsForLatestItems(User user, LatestItemsQuery request, DtoOptions options)
{
var parentId = request.ParentId;

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
@ -17,8 +18,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
@ -34,6 +33,8 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
namespace Emby.Server.Implementations.LiveTv
{
@ -763,7 +764,7 @@ namespace Emby.Server.Implementations.LiveTv
return new Tuple<LiveTvProgram, bool, bool>(item, isNew, isUpdated);
}
public async Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, Jellyfin.Data.Entities.User user = null)
public async Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, User user = null)
{
var program = _libraryManager.GetItemById(id);
@ -938,7 +939,7 @@ namespace Emby.Server.Implementations.LiveTv
};
}
private int GetRecommendationScore(LiveTvProgram program, Jellyfin.Data.Entities.User user, bool factorChannelWatchCount)
private int GetRecommendationScore(LiveTvProgram program, User user, bool factorChannelWatchCount)
{
var score = 0;
@ -1324,7 +1325,7 @@ namespace Emby.Server.Implementations.LiveTv
return 7;
}
private QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, Jellyfin.Data.Entities.User user)
private QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, User user)
{
if (user == null)
{
@ -1432,7 +1433,7 @@ namespace Emby.Server.Implementations.LiveTv
return result;
}
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, ItemFields[] fields, Jellyfin.Data.Entities.User user = null)
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, ItemFields[] fields, User user = null)
{
var programTuples = new List<Tuple<BaseItemDto, string, string>>();
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
@ -1482,7 +1483,7 @@ namespace Emby.Server.Implementations.LiveTv
return EmbyTV.EmbyTV.Current.GetActiveRecordingInfo(path);
}
public void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, Jellyfin.Data.Entities.User user = null)
public void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, User user = null)
{
var service = EmbyTV.EmbyTV.Current;
@ -1894,7 +1895,7 @@ namespace Emby.Server.Implementations.LiveTv
return _libraryManager.GetItemById(internalChannelId);
}
public void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> tuples, DtoOptions options, Jellyfin.Data.Entities.User user)
public void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> tuples, DtoOptions options, User user)
{
var now = DateTime.UtcNow;
@ -2215,12 +2216,12 @@ namespace Emby.Server.Implementations.LiveTv
return info;
}
private bool IsLiveTvEnabled(Jellyfin.Data.Entities.User user)
private bool IsLiveTvEnabled(User user)
{
return user.HasPermission(PermissionKind.EnableLiveTvAccess) && (Services.Count > 1 || GetConfiguration().TunerHosts.Length > 0);
}
public IEnumerable<Jellyfin.Data.Entities.User> GetEnabledUsers()
public IEnumerable<User> GetEnabledUsers()
{
return _userManager.Users
.Where(IsLiveTvEnabled);
@ -2470,12 +2471,12 @@ namespace Emby.Server.Implementations.LiveTv
return _tvDtoService.GetInternalProgramId(externalId);
}
public List<BaseItem> GetRecordingFolders(Jellyfin.Data.Entities.User user)
public List<BaseItem> GetRecordingFolders(User user)
{
return GetRecordingFolders(user, false);
}
private List<BaseItem> GetRecordingFolders(Jellyfin.Data.Entities.User user, bool refreshChannels)
private List<BaseItem> GetRecordingFolders(User user, bool refreshChannels)
{
var folders = EmbyTV.EmbyTV.Current.GetRecordingFolders()
.SelectMany(i => i.Locations)

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Querying;
@ -14,12 +15,12 @@ namespace Emby.Server.Implementations.Playlists
Name = "Playlists";
}
public override bool IsVisible(Jellyfin.Data.Entities.User user)
public override bool IsVisible(User user)
{
return base.IsVisible(user) && GetChildren(user, true).Any();
}
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(Jellyfin.Data.Entities.User user)
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
return base.GetEligibleChildrenForRecursiveChildren(user).OfType<Playlist>();
}

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -19,6 +20,8 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using PlaylistsNET.Content;
using PlaylistsNET.Models;
using Genre = MediaBrowser.Controller.Entities.Genre;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
namespace Emby.Server.Implementations.Playlists
{
@ -175,7 +178,7 @@ namespace Emby.Server.Implementations.Playlists
return path;
}
private List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, string playlistMediaType, Jellyfin.Data.Entities.User user, DtoOptions options)
private List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, string playlistMediaType, User user, DtoOptions options)
{
var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i != null);
@ -192,7 +195,7 @@ namespace Emby.Server.Implementations.Playlists
});
}
private void AddToPlaylistInternal(string playlistId, ICollection<Guid> newItemIds, Jellyfin.Data.Entities.User user, DtoOptions options)
private void AddToPlaylistInternal(string playlistId, ICollection<Guid> newItemIds, User user, DtoOptions options)
{
// Retrieve the existing playlist
var playlist = _libraryManager.GetItemById(playlistId) as Playlist

View File

@ -1,4 +1,5 @@
using System;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -12,7 +13,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Gets or sets the user manager.

View File

@ -1,4 +1,5 @@
using System;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -15,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Gets or sets the user manager.

View File

@ -1,3 +1,4 @@
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -11,7 +12,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Compares the specified x.

View File

@ -1,3 +1,4 @@
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -11,7 +12,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Compares the specified x.

View File

@ -1,3 +1,4 @@
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -11,7 +12,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Compares the specified x.

View File

@ -1,3 +1,4 @@
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets or sets the user.
/// </summary>
/// <value>The user.</value>
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
/// <summary>
/// Compares the specified x.

View File

@ -2,15 +2,17 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace Emby.Server.Implementations.TV
{
@ -139,7 +141,7 @@ namespace Emby.Server.Implementations.TV
return GetResult(episodes, request);
}
public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, Jellyfin.Data.Entities.User user, IEnumerable<string> seriesKeys, DtoOptions dtoOptions)
public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, User user, IEnumerable<string> seriesKeys, DtoOptions dtoOptions)
{
// Avoid implicitly captured closure
var currentUser = user;
@ -188,7 +190,7 @@ namespace Emby.Server.Implementations.TV
/// Gets the next up.
/// </summary>
/// <returns>Task{Episode}.</returns>
private Tuple<DateTime, Func<Episode>> GetNextUp(string seriesKey, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
private Tuple<DateTime, Func<Episode>> GetNextUp(string seriesKey, User user, DtoOptions dtoOptions)
{
var lastWatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
{

View File

@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Common;
using MediaBrowser.Common.Cryptography;
using MediaBrowser.Controller.Authentication;
@ -42,7 +43,7 @@ namespace Jellyfin.Server.Implementations.Users
/// <inheritdoc />
// This is the version that we need to use for local users. Because reasons.
public Task<ProviderAuthenticationResult> Authenticate(string username, string password, Data.Entities.User resolvedUser)
public Task<ProviderAuthenticationResult> Authenticate(string username, string password, User resolvedUser)
{
if (resolvedUser == null)
{
@ -93,11 +94,11 @@ namespace Jellyfin.Server.Implementations.Users
}
/// <inheritdoc />
public bool HasPassword(Data.Entities.User user)
public bool HasPassword(User user)
=> !string.IsNullOrEmpty(user.Password);
/// <inheritdoc />
public Task ChangePassword(Data.Entities.User user, string newPassword)
public Task ChangePassword(User user, string newPassword)
{
if (string.IsNullOrEmpty(newPassword))
{
@ -112,7 +113,7 @@ namespace Jellyfin.Server.Implementations.Users
}
/// <inheritdoc />
public void ChangeEasyPassword(Data.Entities.User user, string newPassword, string newPasswordHash)
public void ChangeEasyPassword(User user, string newPassword, string newPasswordHash)
{
if (newPassword != null)
{
@ -128,7 +129,7 @@ namespace Jellyfin.Server.Implementations.Users
}
/// <inheritdoc />
public string GetEasyPasswordHash(Data.Entities.User user)
public string GetEasyPasswordHash(User user)
{
return string.IsNullOrEmpty(user.EasyPassword)
? null
@ -141,7 +142,7 @@ namespace Jellyfin.Server.Implementations.Users
/// <param name="user">The user.</param>
/// <param name="str">The string to hash.</param>
/// <returns>The hashed string.</returns>
public string GetHashedString(Data.Entities.User user, string str)
public string GetHashedString(User user, string str)
{
if (string.IsNullOrEmpty(user.Password))
{
@ -167,7 +168,7 @@ namespace Jellyfin.Server.Implementations.Users
/// <param name="user">The user.</param>
/// <param name="str">The string to hash.</param>
/// <returns>The hashed string.</returns>
public ReadOnlySpan<byte> GetHashed(Data.Entities.User user, string str)
public ReadOnlySpan<byte> GetHashed(User user, string str)
{
if (string.IsNullOrEmpty(user.Password))
{

View File

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Authentication;
namespace Jellyfin.Server.Implementations.Users
@ -21,25 +22,25 @@ namespace Jellyfin.Server.Implementations.Users
}
/// <inheritdoc />
public bool HasPassword(Data.Entities.User user)
public bool HasPassword(User user)
{
return true;
}
/// <inheritdoc />
public Task ChangePassword(Data.Entities.User user, string newPassword)
public Task ChangePassword(User user, string newPassword)
{
return Task.CompletedTask;
}
/// <inheritdoc />
public void ChangeEasyPassword(Data.Entities.User user, string newPassword, string newPasswordHash)
public void ChangeEasyPassword(User user, string newPassword, string newPasswordHash)
{
// Nothing here
}
/// <inheritdoc />
public string GetEasyPasswordHash(Data.Entities.User user)
public string GetEasyPasswordHash(User user)
{
return string.Empty;
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@ -220,7 +221,7 @@ namespace MediaBrowser.Api
return result;
}
private InternalItemsQuery GetItemsQuery(GetQueryFiltersLegacy request, Jellyfin.Data.Entities.User user)
private InternalItemsQuery GetItemsQuery(GetQueryFiltersLegacy request, User user)
{
var query = new InternalItemsQuery
{

View File

@ -6,6 +6,7 @@ using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Api.Movies;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
@ -14,7 +15,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Providers;
@ -27,6 +27,11 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
using Book = MediaBrowser.Controller.Entities.Book;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace MediaBrowser.Api.Library
{
@ -759,11 +764,11 @@ namespace MediaBrowser.Api.Library
});
}
private void LogDownload(BaseItem item, Jellyfin.Data.Entities.User user, AuthorizationInfo auth)
private void LogDownload(BaseItem item, User user, AuthorizationInfo auth)
{
try
{
_activityManager.Create(new Jellyfin.Data.Entities.ActivityLog(
_activityManager.Create(new ActivityLog(
string.Format(_localization.GetLocalizedString("UserDownloadingItemWithValues"), user.Username, item.Name),
"UserDownloadingContent",
auth.UserId)
@ -842,7 +847,7 @@ namespace MediaBrowser.Api.Library
return baseItemDtos;
}
private BaseItem TranslateParentItem(BaseItem item, Jellyfin.Data.Entities.User user)
private BaseItem TranslateParentItem(BaseItem item, User user)
{
return item.GetParent() is AggregateFolder
? _libraryManager.GetUserRootFolder().GetChildren(user, true)
@ -884,7 +889,7 @@ namespace MediaBrowser.Api.Library
return ToOptimizedResult(counts);
}
private int GetCount(Type type, Jellyfin.Data.Entities.User user, GetItemCounts request)
private int GetCount(Type type, User user, GetItemCounts request)
{
var query = new InternalItemsQuery(user)
{

View File

@ -2,11 +2,11 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Net;
@ -15,6 +15,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
namespace MediaBrowser.Api.Movies
{
@ -148,12 +149,7 @@ namespace MediaBrowser.Api.Movies
return result;
}
private IEnumerable<RecommendationDto> GetRecommendationCategories(
Jellyfin.Data.Entities.User user,
string parentId,
int categoryLimit,
int itemLimit,
DtoOptions dtoOptions)
private IEnumerable<RecommendationDto> GetRecommendationCategories(User user, string parentId, int categoryLimit, int itemLimit, DtoOptions dtoOptions)
{
var categories = new List<RecommendationDto>();
@ -257,7 +253,7 @@ namespace MediaBrowser.Api.Movies
}
private IEnumerable<RecommendationDto> GetWithDirector(
Jellyfin.Data.Entities.User user,
User user,
IEnumerable<string> names,
int itemLimit,
DtoOptions dtoOptions,
@ -303,12 +299,7 @@ namespace MediaBrowser.Api.Movies
}
}
private IEnumerable<RecommendationDto> GetWithActor(
Jellyfin.Data.Entities.User user,
IEnumerable<string> names,
int itemLimit,
DtoOptions dtoOptions,
RecommendationType type)
private IEnumerable<RecommendationDto> GetWithActor(User user, IEnumerable<string> names, int itemLimit, DtoOptions dtoOptions, RecommendationType type)
{
var itemTypes = new List<string> { typeof(Movie).Name };
if (ServerConfigurationManager.Configuration.EnableExternalContentInSuggestions)
@ -349,12 +340,7 @@ namespace MediaBrowser.Api.Movies
}
}
private IEnumerable<RecommendationDto> GetSimilarTo(
Jellyfin.Data.Entities.User user,
List<BaseItem> baselineItems,
int itemLimit,
DtoOptions dtoOptions,
RecommendationType type)
private IEnumerable<RecommendationDto> GetSimilarTo(User user, List<BaseItem> baselineItems, int itemLimit, DtoOptions dtoOptions, RecommendationType type)
{
var itemTypes = new List<string> { typeof(Movie).Name };
if (ServerConfigurationManager.Configuration.EnableExternalContentInSuggestions)

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@ -171,7 +172,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions);
}
private object GetResult(List<BaseItem> items, Jellyfin.Data.Entities.User user, BaseGetSimilarItems request, DtoOptions dtoOptions)
private object GetResult(List<BaseItem> items, User user, BaseGetSimilarItems request, DtoOptions dtoOptions)
{
var list = items;

View File

@ -1,5 +1,6 @@
using System;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@ -78,7 +79,7 @@ namespace MediaBrowser.Api
};
}
private QueryResult<BaseItem> GetItems(GetSuggestedItems request, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions)
private QueryResult<BaseItem> GetItems(GetSuggestedItems request, User user, DtoOptions dtoOptions)
{
return _libraryManager.GetItemsResult(new InternalItemsQuery(user)
{

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@ -94,7 +95,7 @@ namespace MediaBrowser.Api.UserLibrary
{
var dtoOptions = GetDtoOptions(AuthorizationContext, request);
Jellyfin.Data.Entities.User user = null;
User user = null;
BaseItem parentItem;
if (!request.UserId.Equals(Guid.Empty))
@ -246,7 +247,7 @@ namespace MediaBrowser.Api.UserLibrary
{
var dtoOptions = GetDtoOptions(AuthorizationContext, request);
Jellyfin.Data.Entities.User user = null;
User user = null;
BaseItem parentItem;
if (!request.UserId.Equals(Guid.Empty))

View File

@ -2,11 +2,11 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Dto;
@ -15,6 +15,7 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
namespace MediaBrowser.Api.UserLibrary
{
@ -180,7 +181,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <summary>
/// Gets the items to serialize.
/// </summary>
private QueryResult<BaseItem> GetQueryResult(GetItems request, DtoOptions dtoOptions, Jellyfin.Data.Entities.User user)
private QueryResult<BaseItem> GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
{
if (string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase)
|| string.Equals(request.IncludeItemTypes, "BoxSet", StringComparison.OrdinalIgnoreCase))
@ -255,7 +256,7 @@ namespace MediaBrowser.Api.UserLibrary
};
}
private InternalItemsQuery GetItemsQuery(GetItems request, DtoOptions dtoOptions, Jellyfin.Data.Entities.User user)
private InternalItemsQuery GetItemsQuery(GetItems request, DtoOptions dtoOptions, User user)
{
var query = new InternalItemsQuery(user)
{

View File

@ -1,8 +1,8 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
@ -437,7 +437,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="wasPlayed">if set to <c>true</c> [was played].</param>
/// <param name="datePlayed">The date played.</param>
/// <returns>Task.</returns>
private UserItemDataDto UpdatePlayedStatus(Jellyfin.Data.Entities.User user, string itemId, bool wasPlayed, DateTime? datePlayed)
private UserItemDataDto UpdatePlayedStatus(User user, string itemId, bool wasPlayed, DateTime? datePlayed)
{
var item = _libraryManager.GetItemById(itemId);

View File

@ -3,6 +3,7 @@ using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Entities;
@ -12,7 +13,7 @@ namespace MediaBrowser.Controller.Channels
{
public class Channel : Folder
{
public override bool IsVisible(Jellyfin.Data.Entities.User user)
public override bool IsVisible(User user)
{
if (user.GetPreference(PreferenceKind.BlockedChannels) != null)
{
@ -77,7 +78,7 @@ namespace MediaBrowser.Controller.Channels
return false;
}
internal static bool IsChannelVisible(BaseItem channelItem, Jellyfin.Data.Entities.User user)
internal static bool IsChannelVisible(BaseItem channelItem, User user)
{
var channel = ChannelManager.GetChannel(channelItem.ChannelId.ToString(""));

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
@ -51,6 +52,6 @@ namespace MediaBrowser.Controller.Collections
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{BaseItem}.</returns>
IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user);
IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, User user);
}
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
@ -50,7 +51,7 @@ namespace MediaBrowser.Controller.Drawing
string GetImageCacheTag(BaseItem item, ChapterInfo info);
string GetImageCacheTag(Jellyfin.Data.Entities.User user);
string GetImageCacheTag(User user);
/// <summary>
/// Processes the image.

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
@ -38,7 +39,7 @@ namespace MediaBrowser.Controller.Dto
/// <param name="fields">The fields.</param>
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, Jellyfin.Data.Entities.User user = null, BaseItem owner = null);
BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null);
/// <summary>
/// Gets the base item dto.
@ -48,7 +49,7 @@ namespace MediaBrowser.Controller.Dto
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
/// <returns>BaseItemDto.</returns>
BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, Jellyfin.Data.Entities.User user = null, BaseItem owner = null);
BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null);
/// <summary>
/// Gets the base item dtos.
@ -57,11 +58,11 @@ namespace MediaBrowser.Controller.Dto
/// <param name="options">The options.</param>
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, Jellyfin.Data.Entities.User user = null, BaseItem owner = null);
IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);
/// <summary>
/// Gets the item by name dto.
/// </summary>
BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, Jellyfin.Data.Entities.User user = null);
BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null);
}
}

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
@ -79,7 +80,7 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore]
public IEnumerable<Audio> Tracks => GetRecursiveChildren(i => i is Audio).Cast<Audio>();
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(Jellyfin.Data.Entities.User user)
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
return Tracks;
}
@ -116,7 +117,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return list;
}
protected override bool GetBlockUnratedValue(Jellyfin.Data.Entities.User user)
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
}

View File

@ -4,12 +4,11 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Users;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities.Audio
@ -75,13 +74,9 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
public override int GetChildCount(Jellyfin.Data.Entities.User user)
public override int GetChildCount(User user)
{
if (IsAccessedByName)
{
return 0;
}
return base.GetChildCount(user);
return IsAccessedByName ? 0 : base.GetChildCount(user);
}
public override bool IsSaveLocalMetadataEnabled()
@ -144,7 +139,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return "Artist-" + (Name ?? string.Empty).RemoveDiacritics();
}
protected override bool GetBlockUnratedValue(Jellyfin.Data.Entities.User user)
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
}

View File

@ -7,6 +7,7 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
@ -480,7 +481,7 @@ namespace MediaBrowser.Controller.Entities
return IsFileProtocol;
}
public virtual bool IsAuthorizedToDelete(Jellyfin.Data.Entities.User user, List<Folder> allCollectionFolders)
public virtual bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
{
if (user.HasPermission(PermissionKind.EnableContentDeletion))
{
@ -509,12 +510,12 @@ namespace MediaBrowser.Controller.Entities
return false;
}
public bool CanDelete(Jellyfin.Data.Entities.User user, List<Folder> allCollectionFolders)
public bool CanDelete(User user, List<Folder> allCollectionFolders)
{
return CanDelete() && IsAuthorizedToDelete(user, allCollectionFolders);
}
public bool CanDelete(Jellyfin.Data.Entities.User user)
public bool CanDelete(User user)
{
var allCollectionFolders = LibraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
@ -526,12 +527,12 @@ namespace MediaBrowser.Controller.Entities
return false;
}
public virtual bool IsAuthorizedToDownload(Jellyfin.Data.Entities.User user)
public virtual bool IsAuthorizedToDownload(User user)
{
return user.HasPermission(PermissionKind.EnableContentDownloading);
}
public bool CanDownload(Jellyfin.Data.Entities.User user)
public bool CanDownload(User user)
{
return CanDownload() && IsAuthorizedToDownload(user);
}
@ -1003,7 +1004,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns>PlayAccess.</returns>
public PlayAccess GetPlayAccess(Jellyfin.Data.Entities.User user)
public PlayAccess GetPlayAccess(User user)
{
if (!user.HasPermission(PermissionKind.EnableMediaPlayback))
{
@ -1214,11 +1215,11 @@ namespace MediaBrowser.Controller.Entities
{
if (video.IsoType.HasValue)
{
if (video.IsoType.Value == Model.Entities.IsoType.BluRay)
if (video.IsoType.Value == IsoType.BluRay)
{
terms.Add("Bluray");
}
else if (video.IsoType.Value == Model.Entities.IsoType.Dvd)
else if (video.IsoType.Value == IsoType.Dvd)
{
terms.Add("DVD");
}
@ -1761,7 +1762,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
/// <exception cref="ArgumentNullException">user</exception>
public bool IsParentalAllowed(Jellyfin.Data.Entities.User user)
public bool IsParentalAllowed(User user)
{
if (user == null)
{
@ -1857,7 +1858,7 @@ namespace MediaBrowser.Controller.Entities
return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
}
private bool IsVisibleViaTags(Jellyfin.Data.Entities.User user)
private bool IsVisibleViaTags(User user)
{
if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => Tags.Contains(i, StringComparer.OrdinalIgnoreCase)))
{
@ -1887,7 +1888,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The configuration.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
protected virtual bool GetBlockUnratedValue(Jellyfin.Data.Entities.User user)
protected virtual bool GetBlockUnratedValue(User user)
{
// Don't block plain folders that are unrated. Let the media underneath get blocked
// Special folders like series and albums will override this method.
@ -1906,7 +1907,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="user">The user.</param>
/// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns>
/// <exception cref="ArgumentNullException">user</exception>
public virtual bool IsVisible(Jellyfin.Data.Entities.User user)
public virtual bool IsVisible(User user)
{
if (user == null)
{
@ -1916,7 +1917,7 @@ namespace MediaBrowser.Controller.Entities
return IsParentalAllowed(user);
}
public virtual bool IsVisibleStandalone(Jellyfin.Data.Entities.User user)
public virtual bool IsVisibleStandalone(User user)
{
if (SourceType == SourceType.Channel)
{
@ -1929,7 +1930,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public virtual bool SupportsInheritedParentImages => false;
protected bool IsVisibleStandaloneInternal(Jellyfin.Data.Entities.User user, bool checkFolders)
protected bool IsVisibleStandaloneInternal(User user, bool checkFolders)
{
if (!IsVisible(user))
{
@ -2127,7 +2128,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>Task.</returns>
/// <exception cref="ArgumentNullException"></exception>
public virtual void MarkPlayed(
Jellyfin.Data.Entities.User user,
User user,
DateTime? datePlayed,
bool resetPosition)
{
@ -2164,7 +2165,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
/// <exception cref="ArgumentNullException"></exception>
public virtual void MarkUnplayed(Jellyfin.Data.Entities.User user)
public virtual void MarkUnplayed(User user)
{
if (user == null)
{
@ -2540,21 +2541,21 @@ namespace MediaBrowser.Controller.Entities
UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
}
public virtual bool IsPlayed(Jellyfin.Data.Entities.User user)
public virtual bool IsPlayed(User user)
{
var userdata = UserDataManager.GetUserData(user, this);
return userdata != null && userdata.Played;
}
public bool IsFavoriteOrLiked(Jellyfin.Data.Entities.User user)
public bool IsFavoriteOrLiked(User user)
{
var userdata = UserDataManager.GetUserData(user, this);
return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
}
public virtual bool IsUnplayed(Jellyfin.Data.Entities.User user)
public virtual bool IsUnplayed(User user)
{
if (user == null)
{
@ -2620,7 +2621,7 @@ namespace MediaBrowser.Controller.Entities
return path;
}
public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, Jellyfin.Data.Entities.User user, DtoOptions fields)
public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields)
{
if (RunTimeTicks.HasValue)
{
@ -2733,14 +2734,14 @@ namespace MediaBrowser.Controller.Entities
return RefreshMetadataForOwnedItem(video, copyTitleMetadata, newOptions, cancellationToken);
}
public string GetEtag(Jellyfin.Data.Entities.User user)
public string GetEtag(User user)
{
var list = GetEtagValues(user);
return string.Join("|", list).GetMD5().ToString("N", CultureInfo.InvariantCulture);
}
protected virtual List<string> GetEtagValues(Jellyfin.Data.Entities.User user)
protected virtual List<string> GetEtagValues(User user)
{
return new List<string>
{

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Channels;
@ -16,13 +17,16 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace MediaBrowser.Controller.Entities
{
@ -174,7 +178,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
public override bool IsVisible(Jellyfin.Data.Entities.User user)
public override bool IsVisible(User user)
{
if (this is ICollectionFolder && !(this is BasePluginFolder))
{
@ -586,7 +590,7 @@ namespace MediaBrowser.Controller.Entities
});
}
public virtual int GetChildCount(Jellyfin.Data.Entities.User user)
public virtual int GetChildCount(User user)
{
if (LinkedChildren.Length > 0)
{
@ -611,7 +615,7 @@ namespace MediaBrowser.Controller.Entities
return result.TotalRecordCount;
}
public virtual int GetRecursiveChildCount(Jellyfin.Data.Entities.User user)
public virtual int GetRecursiveChildCount(User user)
{
return GetItems(new InternalItemsQuery(user)
{
@ -954,7 +958,7 @@ namespace MediaBrowser.Controller.Entities
IEnumerable<BaseItem> items,
InternalItemsQuery query,
BaseItem queryParent,
Jellyfin.Data.Entities.User user,
User user,
IServerConfigurationManager configurationManager,
ICollectionManager collectionManager)
{
@ -973,7 +977,7 @@ namespace MediaBrowser.Controller.Entities
private static bool CollapseBoxSetItems(InternalItemsQuery query,
BaseItem queryParent,
Jellyfin.Data.Entities.User user,
User user,
IServerConfigurationManager configurationManager)
{
// Could end up stuck in a loop like this
@ -1196,7 +1200,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
public List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren)
public List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
if (user == null)
{
@ -1206,7 +1210,7 @@ namespace MediaBrowser.Controller.Entities
return GetChildren(user, includeLinkedChildren, null);
}
public virtual List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public virtual List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
if (user == null)
{
@ -1226,7 +1230,7 @@ namespace MediaBrowser.Controller.Entities
return result.Values.ToList();
}
protected virtual IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(Jellyfin.Data.Entities.User user)
protected virtual IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
return Children;
}
@ -1235,7 +1239,7 @@ namespace MediaBrowser.Controller.Entities
/// Adds the children to list.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private void AddChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
{
foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
{
@ -1284,12 +1288,12 @@ namespace MediaBrowser.Controller.Entities
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
/// <returns>IEnumerable{BaseItem}.</returns>
/// <exception cref="ArgumentNullException"></exception>
public IEnumerable<BaseItem> GetRecursiveChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren = true)
public IEnumerable<BaseItem> GetRecursiveChildren(User user, bool includeLinkedChildren = true)
{
return GetRecursiveChildren(user, null);
}
public virtual IEnumerable<BaseItem> GetRecursiveChildren(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
public virtual IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
if (user == null)
{
@ -1408,7 +1412,7 @@ namespace MediaBrowser.Controller.Entities
return false;
}
public List<BaseItem> GetLinkedChildren(Jellyfin.Data.Entities.User user)
public List<BaseItem> GetLinkedChildren(User user)
{
if (!FilterLinkedChildrenPerUser || user == null)
{
@ -1570,7 +1574,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="datePlayed">The date played.</param>
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
public override void MarkPlayed(Jellyfin.Data.Entities.User user,
public override void MarkPlayed(User user,
DateTime? datePlayed,
bool resetPosition)
{
@ -1611,7 +1615,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
public override void MarkUnplayed(Jellyfin.Data.Entities.User user)
public override void MarkUnplayed(User user)
{
var itemsResult = GetItemList(new InternalItemsQuery
{
@ -1629,7 +1633,7 @@ namespace MediaBrowser.Controller.Entities
}
}
public override bool IsPlayed(Jellyfin.Data.Entities.User user)
public override bool IsPlayed(User user)
{
var itemsResult = GetItemList(new InternalItemsQuery(user)
{
@ -1644,7 +1648,7 @@ namespace MediaBrowser.Controller.Entities
.All(i => i.IsPlayed(user));
}
public override bool IsUnplayed(Jellyfin.Data.Entities.User user)
public override bool IsUnplayed(User user)
{
return !IsPlayed(user);
}
@ -1689,7 +1693,7 @@ namespace MediaBrowser.Controller.Entities
}
}
public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, Jellyfin.Data.Entities.User user, DtoOptions fields)
public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields)
{
if (!SupportsUserDataFromChildren)
{

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Model.Configuration;
@ -16,7 +17,7 @@ namespace MediaBrowser.Controller.Entities
public int? Limit { get; set; }
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
public BaseItem SimilarTo { get; set; }
@ -214,13 +215,13 @@ namespace MediaBrowser.Controller.Entities
Years = Array.Empty<int>();
}
public InternalItemsQuery(Jellyfin.Data.Entities.User user)
public InternalItemsQuery(User user)
: this()
{
SetUser(user);
}
public void SetUser(Jellyfin.Data.Entities.User user)
public void SetUser(User user)
{
if (user != null)
{

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
@ -44,7 +45,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <value>The display order.</value>
public string DisplayOrder { get; set; }
protected override bool GetBlockUnratedValue(Jellyfin.Data.Entities.User user)
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie.ToString());
}
@ -100,7 +101,7 @@ namespace MediaBrowser.Controller.Entities.Movies
[JsonIgnore]
public override bool IsPreSorted => true;
public override bool IsAuthorizedToDelete(Jellyfin.Data.Entities.User user, List<Folder> allCollectionFolders)
public override bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
{
return true;
}
@ -110,7 +111,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return true;
}
public override List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
var children = base.GetChildren(user, includeLinkedChildren, query);
@ -130,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
}
public override IEnumerable<BaseItem> GetRecursiveChildren(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
var children = base.GetRecursiveChildren(user, query);
@ -148,7 +149,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return GetItemLookupInfo<BoxSetInfo>();
}
public override bool IsVisible(Jellyfin.Data.Entities.User user)
public override bool IsVisible(User user)
{
if (IsLegacyBoxSet)
{
@ -176,7 +177,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return false;
}
public override bool IsVisibleStandalone(Jellyfin.Data.Entities.User user)
public override bool IsVisibleStandalone(User user)
{
if (IsLegacyBoxSet)
{
@ -188,7 +189,7 @@ namespace MediaBrowser.Controller.Entities.Movies
public Guid[] LibraryFolderIds { get; set; }
private Guid[] GetLibraryFolderIds(Jellyfin.Data.Entities.User user)
private Guid[] GetLibraryFolderIds(User user)
{
return LibraryManager.GetUserRootFolder().GetChildren(user, true)
.Select(i => i.Id)

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Providers;
@ -61,7 +62,7 @@ namespace MediaBrowser.Controller.Entities.TV
return list;
}
public override int GetChildCount(Jellyfin.Data.Entities.User user)
public override int GetChildCount(User user)
{
var result = GetChildren(user, true).Count;
@ -144,17 +145,17 @@ namespace MediaBrowser.Controller.Entities.TV
/// <summary>
/// Gets the episodes.
/// </summary>
public List<BaseItem> GetEpisodes(Jellyfin.Data.Entities.User user, DtoOptions options)
public List<BaseItem> GetEpisodes(User user, DtoOptions options)
{
return GetEpisodes(Series, user, options);
}
public List<BaseItem> GetEpisodes(Series series, Jellyfin.Data.Entities.User user, DtoOptions options)
public List<BaseItem> GetEpisodes(Series series, User user, DtoOptions options)
{
return GetEpisodes(series, user, null, options);
}
public List<BaseItem> GetEpisodes(Series series, Jellyfin.Data.Entities.User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)
public List<BaseItem> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)
{
return series.GetSeasonEpisodes(this, user, allSeriesEpisodes, options);
}
@ -164,12 +165,12 @@ namespace MediaBrowser.Controller.Entities.TV
return Series.GetSeasonEpisodes(this, null, null, new DtoOptions(true));
}
public override List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
return GetEpisodes(user, new DtoOptions(true));
}
protected override bool GetBlockUnratedValue(Jellyfin.Data.Entities.User config)
protected override bool GetBlockUnratedValue(User config)
{
// Don't block. Let either the entire series rating or episode rating determine it
return false;

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Providers;
@ -110,7 +111,7 @@ namespace MediaBrowser.Controller.Entities.TV
return series.GetPresentationUniqueKey();
}
public override int GetChildCount(Jellyfin.Data.Entities.User user)
public override int GetChildCount(User user)
{
var seriesKey = GetUniqueSeriesKey(this);
@ -130,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.TV
return result;
}
public override int GetRecursiveChildCount(Jellyfin.Data.Entities.User user)
public override int GetRecursiveChildCount(User user)
{
var seriesKey = GetUniqueSeriesKey(this);
@ -178,12 +179,12 @@ namespace MediaBrowser.Controller.Entities.TV
return list;
}
public override List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
return GetSeasons(user, new DtoOptions(true));
}
public List<BaseItem> GetSeasons(Jellyfin.Data.Entities.User user, DtoOptions options)
public List<BaseItem> GetSeasons(User user, DtoOptions options)
{
var query = new InternalItemsQuery(user)
{
@ -195,7 +196,7 @@ namespace MediaBrowser.Controller.Entities.TV
return LibraryManager.GetItemList(query);
}
private void SetSeasonQueryOptions(InternalItemsQuery query, Jellyfin.Data.Entities.User user)
private void SetSeasonQueryOptions(InternalItemsQuery query, User user)
{
var seriesKey = GetUniqueSeriesKey(this);
@ -239,7 +240,7 @@ namespace MediaBrowser.Controller.Entities.TV
return LibraryManager.GetItemsResult(query);
}
public IEnumerable<BaseItem> GetEpisodes(Jellyfin.Data.Entities.User user, DtoOptions options)
public IEnumerable<BaseItem> GetEpisodes(User user, DtoOptions options)
{
var seriesKey = GetUniqueSeriesKey(this);
@ -345,7 +346,7 @@ namespace MediaBrowser.Controller.Entities.TV
await ProviderManager.RefreshSingleItem(this, refreshOptions, cancellationToken).ConfigureAwait(false);
}
public List<BaseItem> GetSeasonEpisodes(Season parentSeason, Jellyfin.Data.Entities.User user, DtoOptions options)
public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, DtoOptions options)
{
var queryFromSeries = ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons;
@ -375,7 +376,7 @@ namespace MediaBrowser.Controller.Entities.TV
return GetSeasonEpisodes(parentSeason, user, allItems, options);
}
public List<BaseItem> GetSeasonEpisodes(Season parentSeason, Jellyfin.Data.Entities.User user, IEnumerable<BaseItem> allSeriesEpisodes, DtoOptions options)
public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<BaseItem> allSeriesEpisodes, DtoOptions options)
{
if (allSeriesEpisodes == null)
{
@ -445,7 +446,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
protected override bool GetBlockUnratedValue(Jellyfin.Data.Entities.User user)
protected override bool GetBlockUnratedValue(User user)
{
return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series.ToString());
}

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
@ -63,7 +64,7 @@ namespace MediaBrowser.Controller.Entities
return UserViewBuilder.SortAndPage(result, null, query, LibraryManager, true);
}
public override int GetChildCount(Jellyfin.Data.Entities.User user)
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count;
}
@ -74,7 +75,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override bool IsPreSorted => true;
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(Jellyfin.Data.Entities.User user)
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
var list = base.GetEligibleChildrenForRecursiveChildren(user).ToList();
list.AddRange(LibraryManager.RootFolder.VirtualChildren);

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Querying;
@ -48,7 +49,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
public override int GetChildCount(Jellyfin.Data.Entities.User user)
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count;
}
@ -70,7 +71,7 @@ namespace MediaBrowser.Controller.Entities
.GetUserItems(parent, this, CollectionType, query);
}
public override List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
if (query == null)
{
@ -93,7 +94,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
public override IEnumerable<BaseItem> GetRecursiveChildren(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
query.SetUser(user);
query.Recursive = true;
@ -103,14 +104,14 @@ namespace MediaBrowser.Controller.Entities
return GetItemList(query);
}
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(Jellyfin.Data.Entities.User user)
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
return GetChildren(user, false);
}
private static string[] UserSpecificViewTypes = new string[]
{
MediaBrowser.Model.Entities.CollectionType.Playlists
Model.Entities.CollectionType.Playlists
};
public static bool IsUserSpecific(Folder folder)
@ -139,8 +140,8 @@ namespace MediaBrowser.Controller.Entities
private static string[] ViewTypesEligibleForGrouping = new string[]
{
MediaBrowser.Model.Entities.CollectionType.Movies,
MediaBrowser.Model.Entities.CollectionType.TvShows,
Model.Entities.CollectionType.Movies,
Model.Entities.CollectionType.TvShows,
string.Empty
};
@ -151,12 +152,12 @@ namespace MediaBrowser.Controller.Entities
private static string[] OriginalFolderViewTypes = new string[]
{
MediaBrowser.Model.Entities.CollectionType.Books,
MediaBrowser.Model.Entities.CollectionType.MusicVideos,
MediaBrowser.Model.Entities.CollectionType.HomeVideos,
MediaBrowser.Model.Entities.CollectionType.Photos,
MediaBrowser.Model.Entities.CollectionType.Music,
MediaBrowser.Model.Entities.CollectionType.BoxSets
Model.Entities.CollectionType.Books,
Model.Entities.CollectionType.MusicVideos,
Model.Entities.CollectionType.HomeVideos,
Model.Entities.CollectionType.Photos,
Model.Entities.CollectionType.Music,
Model.Entities.CollectionType.BoxSets
};
public static bool EnableOriginalFolder(string viewType)

View File

@ -2,14 +2,18 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace MediaBrowser.Controller.Entities
{
@ -125,7 +129,7 @@ namespace MediaBrowser.Controller.Entities
return 50;
}
private QueryResult<BaseItem> GetMovieFolders(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieFolders(Folder parent, User user, InternalItemsQuery query)
{
if (query.Recursive)
{
@ -153,7 +157,7 @@ namespace MediaBrowser.Controller.Entities
return GetResult(list, parent, query);
}
private QueryResult<BaseItem> GetFavoriteMovies(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetFavoriteMovies(Folder parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -164,7 +168,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetFavoriteSeries(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetFavoriteSeries(Folder parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -175,7 +179,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetFavoriteEpisodes(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetFavoriteEpisodes(Folder parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -186,7 +190,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetMovieMovies(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieMovies(Folder parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -197,7 +201,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetMovieCollections(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieCollections(Folder parent, User user, InternalItemsQuery query)
{
query.Parent = null;
query.IncludeItemTypes = new[] { typeof(BoxSet).Name };
@ -207,7 +211,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetMovieLatest(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieLatest(Folder parent, User user, InternalItemsQuery query)
{
query.OrderBy = new[] { ItemSortBy.DateCreated, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
@ -220,7 +224,7 @@ namespace MediaBrowser.Controller.Entities
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> GetMovieResume(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieResume(Folder parent, User user, InternalItemsQuery query)
{
query.OrderBy = new[] { ItemSortBy.DatePlayed, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
query.IsResumable = true;
@ -243,7 +247,7 @@ namespace MediaBrowser.Controller.Entities
};
}
private QueryResult<BaseItem> GetMovieGenres(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
{
var genres = parent.QueryRecursive(new InternalItemsQuery(user)
{
@ -273,7 +277,7 @@ namespace MediaBrowser.Controller.Entities
return GetResult(genres, parent, query);
}
private QueryResult<BaseItem> GetMovieGenreItems(Folder queryParent, Folder displayParent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetMovieGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = queryParent;
@ -285,7 +289,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetTvView(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvView(Folder parent, User user, InternalItemsQuery query)
{
if (query.Recursive)
{
@ -319,7 +323,7 @@ namespace MediaBrowser.Controller.Entities
return GetResult(list, parent, query);
}
private QueryResult<BaseItem> GetTvLatest(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvLatest(Folder parent, User user, InternalItemsQuery query)
{
query.OrderBy = new[] { ItemSortBy.DateCreated, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
@ -348,7 +352,7 @@ namespace MediaBrowser.Controller.Entities
return result;
}
private QueryResult<BaseItem> GetTvResume(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvResume(Folder parent, User user, InternalItemsQuery query)
{
query.OrderBy = new[] { ItemSortBy.DatePlayed, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
query.IsResumable = true;
@ -361,7 +365,7 @@ namespace MediaBrowser.Controller.Entities
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> GetTvSeries(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvSeries(Folder parent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = parent;
@ -372,7 +376,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query);
}
private QueryResult<BaseItem> GetTvGenres(Folder parent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
{
var genres = parent.QueryRecursive(new InternalItemsQuery(user)
{
@ -402,7 +406,7 @@ namespace MediaBrowser.Controller.Entities
return GetResult(genres, parent, query);
}
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private QueryResult<BaseItem> GetTvGenreItems(Folder queryParent, Folder displayParent, User user, InternalItemsQuery query)
{
query.Recursive = true;
query.Parent = queryParent;
@ -492,7 +496,7 @@ namespace MediaBrowser.Controller.Entities
};
}
public static bool Filter(BaseItem item, Jellyfin.Data.Entities.User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager)
public static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager)
{
if (query.MediaTypes.Length > 0 && !query.MediaTypes.Contains(item.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
@ -950,7 +954,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
private IEnumerable<BaseItem> GetMediaFolders(Jellyfin.Data.Entities.User user)
private IEnumerable<BaseItem> GetMediaFolders(User user)
{
if (user == null)
{
@ -965,7 +969,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => user.IsFolderGrouped(i.Id) && UserView.IsEligibleForGrouping(i));
}
private BaseItem[] GetMediaFolders(Jellyfin.Data.Entities.User user, IEnumerable<string> viewTypes)
private BaseItem[] GetMediaFolders(User user, IEnumerable<string> viewTypes)
{
if (user == null)
{
@ -986,7 +990,7 @@ namespace MediaBrowser.Controller.Entities
}).ToArray();
}
private BaseItem[] GetMediaFolders(Folder parent, Jellyfin.Data.Entities.User user, IEnumerable<string> viewTypes)
private BaseItem[] GetMediaFolders(Folder parent, User user, IEnumerable<string> viewTypes)
{
if (parent == null || parent is UserView)
{

View File

@ -2,10 +2,10 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
@ -14,6 +14,9 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using Genre = MediaBrowser.Controller.Entities.Genre;
using Person = MediaBrowser.Controller.Entities.Person;
namespace MediaBrowser.Controller.Library
{
@ -28,8 +31,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="fileInfo">The file information.</param>
/// <param name="parent">The parent.</param>
/// <returns>BaseItem.</returns>
BaseItem ResolvePath(FileSystemMetadata fileInfo,
Folder parent = null);
BaseItem ResolvePath(FileSystemMetadata fileInfo, Folder parent = null);
/// <summary>
/// Resolves a set of files into a list of BaseItem
@ -141,7 +143,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="item">The item.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{System.String}.</returns>
Task<IEnumerable<Video>> GetIntros(BaseItem item, Jellyfin.Data.Entities.User user);
Task<IEnumerable<Video>> GetIntros(BaseItem item, User user);
/// <summary>
/// Gets all intro files.
@ -172,8 +174,8 @@ namespace MediaBrowser.Controller.Library
/// <param name="sortBy">The sort by.</param>
/// <param name="sortOrder">The sort order.</param>
/// <returns>IEnumerable{BaseItem}.</returns>
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user, IEnumerable<string> sortBy, SortOrder sortOrder);
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, Jellyfin.Data.Entities.User user, IEnumerable<ValueTuple<string, SortOrder>> orderBy);
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy, SortOrder sortOrder);
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ValueTuple<string, SortOrder>> orderBy);
/// <summary>
/// Gets the user root folder.
@ -285,7 +287,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
UserView GetNamedView(
Jellyfin.Data.Entities.User user,
User user,
string name,
Guid parentId,
string viewType,
@ -299,7 +301,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
UserView GetNamedView(
Jellyfin.Data.Entities.User user,
User user,
string name,
string viewType,
string sortName);

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
@ -55,12 +56,12 @@ namespace MediaBrowser.Controller.Library
/// <summary>
/// Gets the playack media sources.
/// </summary>
Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, Jellyfin.Data.Entities.User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken);
Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken);
/// <summary>
/// Gets the static media sources.
/// </summary>
List<MediaSourceInfo> GetStaticMediaSources(BaseItem item, bool enablePathSubstitution, Jellyfin.Data.Entities.User user = null);
List<MediaSourceInfo> GetStaticMediaSources(BaseItem item, bool enablePathSubstitution, User user = null);
/// <summary>
/// Gets the static media source.
@ -100,7 +101,7 @@ namespace MediaBrowser.Controller.Library
MediaProtocol GetPathProtocol(string path);
void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, Jellyfin.Data.Entities.User user);
void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user);
Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string cacheKey, bool addProbeDelay, bool isLiveStream, CancellationToken cancellationToken);

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -10,16 +11,16 @@ namespace MediaBrowser.Controller.Library
/// <summary>
/// Gets the instant mix from song.
/// </summary>
List<BaseItem> GetInstantMixFromItem(BaseItem item, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions);
List<BaseItem> GetInstantMixFromItem(BaseItem item, User user, DtoOptions dtoOptions);
/// <summary>
/// Gets the instant mix from artist.
/// </summary>
List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions);
List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, User user, DtoOptions dtoOptions);
/// <summary>
/// Gets the instant mix from genre.
/// </summary>
List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, Jellyfin.Data.Entities.User user, DtoOptions dtoOptions);
List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User user, DtoOptions dtoOptions);
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
@ -27,18 +28,18 @@ namespace MediaBrowser.Controller.Library
/// <param name="reason">The reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
void SaveUserData(Jellyfin.Data.Entities.User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
UserItemData GetUserData(Jellyfin.Data.Entities.User user, BaseItem item);
UserItemData GetUserData(User user, BaseItem item);
UserItemData GetUserData(Guid userId, BaseItem item);
/// <summary>
/// Gets the user data dto.
/// </summary>
UserItemDataDto GetUserDataDto(BaseItem item, Jellyfin.Data.Entities.User user);
UserItemDataDto GetUserDataDto(BaseItem item, User user);
UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, Jellyfin.Data.Entities.User user, DtoOptions dto_options);
UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, User user, DtoOptions dto_options);
/// <summary>
/// Get all user data for the given user

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dto;
@ -11,7 +12,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
public class PlaybackProgressEventArgs : EventArgs
{
public List<Jellyfin.Data.Entities.User> Users { get; set; }
public List<User> Users { get; set; }
public long? PlaybackPositionTicks { get; set; }
public BaseItem Item { get; set; }
public BaseItemDto MediaInfo { get; set; }
@ -28,7 +29,7 @@ namespace MediaBrowser.Controller.Library
public PlaybackProgressEventArgs()
{
Users = new List<Jellyfin.Data.Entities.User>();
Users = new List<User>();
}
}
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@ -115,7 +116,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="user">The user.</param>
/// <returns>Task{ProgramInfoDto}.</returns>
Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, Jellyfin.Data.Entities.User user = null);
Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, User user = null);
/// <summary>
/// Gets the programs.
@ -202,7 +203,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the enabled users.
/// </summary>
/// <returns>IEnumerable{User}.</returns>
IEnumerable<Jellyfin.Data.Entities.User> GetEnabledUsers();
IEnumerable<User> GetEnabledUsers();
/// <summary>
/// Gets the internal channels.
@ -221,7 +222,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="fields">The fields.</param>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, ItemFields[] fields, Jellyfin.Data.Entities.User user = null);
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, ItemFields[] fields, User user = null);
/// <summary>
/// Saves the tuner host.
@ -258,7 +259,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="items">The items.</param>
/// <param name="options">The options.</param>
/// <param name="user">The user.</param>
void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> items, DtoOptions options, Jellyfin.Data.Entities.User user);
void AddChannelInfo(IReadOnlyCollection<(BaseItemDto, LiveTvChannel)> items, DtoOptions options, User user);
Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken);
@ -277,9 +278,9 @@ namespace MediaBrowser.Controller.LiveTv
ActiveRecordingInfo GetActiveRecordingInfo(string path);
void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, Jellyfin.Data.Entities.User user = null);
void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, User user = null);
List<BaseItem> GetRecordingFolders(Jellyfin.Data.Entities.User user);
List<BaseItem> GetRecordingFolders(User user);
}
public class ActiveRecordingInfo

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
@ -49,7 +50,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public MediaSourceInfo MediaSource { get; set; }
public Jellyfin.Data.Entities.User User { get; set; }
public User User { get; set; }
public long? RunTimeTicks { get; set; }

View File

@ -1,6 +1,6 @@
#nullable enable
using MediaBrowser.Controller.Entities;
using Jellyfin.Data.Entities;
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
@ -9,6 +9,7 @@ namespace MediaBrowser.Controller.Net
public interface IAuthService
{
void Authenticate(IRequest request, IAuthenticationAttributes authAttribtues);
Jellyfin.Data.Entities.User? Authenticate(HttpRequest request, IAuthenticationAttributes authAttribtues);
User? Authenticate(HttpRequest request, IAuthenticationAttributes authAttribtues);
}
}

View File

@ -1,6 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using Jellyfin.Data.Entities;
namespace MediaBrowser.Controller.Notifications
{
@ -25,6 +25,6 @@ namespace MediaBrowser.Controller.Notifications
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is enabled for user] [the specified user identifier]; otherwise, <c>false</c>.</returns>
bool IsEnabledForUser(Jellyfin.Data.Entities.User user);
bool IsEnabledForUser(User user);
}
}

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -78,7 +79,7 @@ namespace MediaBrowser.Controller.Playlists
return 1;
}
public override bool IsAuthorizedToDelete(Jellyfin.Data.Entities.User user, List<Folder> allCollectionFolders)
public override bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
{
return true;
}
@ -99,7 +100,7 @@ namespace MediaBrowser.Controller.Playlists
return Task.CompletedTask;
}
public override List<BaseItem> GetChildren(Jellyfin.Data.Entities.User user, bool includeLinkedChildren, InternalItemsQuery query)
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
{
return GetPlayableItems(user, query);
}
@ -109,7 +110,7 @@ namespace MediaBrowser.Controller.Playlists
return new List<BaseItem>();
}
public override IEnumerable<BaseItem> GetRecursiveChildren(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
return GetPlayableItems(user, query);
}
@ -119,7 +120,7 @@ namespace MediaBrowser.Controller.Playlists
return GetLinkedChildrenInfos();
}
private List<BaseItem> GetPlayableItems(Jellyfin.Data.Entities.User user, InternalItemsQuery query)
private List<BaseItem> GetPlayableItems(User user, InternalItemsQuery query)
{
if (query == null)
{
@ -131,7 +132,7 @@ namespace MediaBrowser.Controller.Playlists
return base.GetChildren(user, true, query);
}
public static List<BaseItem> GetPlaylistItems(string playlistMediaType, IEnumerable<BaseItem> inputItems, Jellyfin.Data.Entities.User user, DtoOptions options)
public static List<BaseItem> GetPlaylistItems(string playlistMediaType, IEnumerable<BaseItem> inputItems, User user, DtoOptions options)
{
if (user != null)
{
@ -149,7 +150,7 @@ namespace MediaBrowser.Controller.Playlists
return list;
}
private static IEnumerable<BaseItem> GetPlaylistItems(BaseItem item, Jellyfin.Data.Entities.User user, string mediaType, DtoOptions options)
private static IEnumerable<BaseItem> GetPlaylistItems(BaseItem item, User user, string mediaType, DtoOptions options)
{
if (item is MusicGenre musicGenre)
{
@ -222,7 +223,7 @@ namespace MediaBrowser.Controller.Playlists
}
}
public override bool IsVisible(Jellyfin.Data.Entities.User user)
public override bool IsVisible(User user)
{
if (!IsSharedItem)
{
@ -244,7 +245,7 @@ namespace MediaBrowser.Controller.Playlists
return shares.Any(share => string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase));
}
public override bool IsVisibleStandalone(Jellyfin.Data.Entities.User user)
public override bool IsVisibleStandalone(User user)
{
if (!IsSharedItem)
{

View File

@ -4,6 +4,7 @@ using System;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Extensions;
using System.Linq;
using Jellyfin.Data.Entities;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Model.Notifications
@ -115,7 +116,7 @@ namespace MediaBrowser.Model.Notifications
!opt.DisabledMonitorUsers.Contains(userId.ToString(""), StringComparer.OrdinalIgnoreCase);
}
public bool IsEnabledToSendToUser(string type, string userId, Jellyfin.Data.Entities.User user)
public bool IsEnabledToSendToUser(string type, string userId, User user)
{
NotificationOption opt = GetOptions(type);

View File

@ -7,6 +7,7 @@ using AutoFixture;
using AutoFixture.AutoMoq;
using Jellyfin.Api.Auth;
using Jellyfin.Api.Constants;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Net;
@ -84,7 +85,7 @@ namespace Jellyfin.Api.Tests.Auth
a => a.Authenticate(
It.IsAny<HttpRequest>(),
It.IsAny<AuthenticatedAttribute>()))
.Returns((Jellyfin.Data.Entities.User?)null);
.Returns((User?)null);
var authenticateResult = await _sut.AuthenticateAsync();
@ -149,9 +150,9 @@ namespace Jellyfin.Api.Tests.Auth
Assert.Equal(_scheme.Name, authenticatedResult.Ticket.AuthenticationScheme);
}
private Jellyfin.Data.Entities.User SetupUser(bool isAdmin = false)
private User SetupUser(bool isAdmin = false)
{
var user = _fixture.Create<Jellyfin.Data.Entities.User>();
var user = _fixture.Create<User>();
user.SetPermission(PermissionKind.IsAdministrator, isAdmin);
_jellyfinAuthServiceMock.Setup(