Enable nullable for more files
This commit is contained in:
parent
9db093b9d9
commit
651681c276
|
@ -146,7 +146,7 @@ namespace Emby.Server.Implementations
|
||||||
_startupConfig = startupConfig;
|
_startupConfig = startupConfig;
|
||||||
|
|
||||||
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
||||||
_deviceId = new DeviceId(ApplicationPaths, LoggerFactory);
|
_deviceId = new DeviceId(ApplicationPaths, LoggerFactory.CreateLogger<DeviceId>());
|
||||||
|
|
||||||
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
|
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
|
||||||
ApplicationVersionString = ApplicationVersion.ToString(3);
|
ApplicationVersionString = ApplicationVersion.ToString(3);
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -17,19 +15,19 @@ namespace Emby.Server.Implementations.Devices
|
||||||
private readonly ILogger<DeviceId> _logger;
|
private readonly ILogger<DeviceId> _logger;
|
||||||
private readonly object _syncLock = new object();
|
private readonly object _syncLock = new object();
|
||||||
|
|
||||||
private string _id;
|
private string? _id;
|
||||||
|
|
||||||
public DeviceId(IApplicationPaths appPaths, ILoggerFactory loggerFactory)
|
public DeviceId(IApplicationPaths appPaths, ILogger<DeviceId> logger)
|
||||||
{
|
{
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
_logger = loggerFactory.CreateLogger<DeviceId>();
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Value => _id ?? (_id = GetDeviceId());
|
public string Value => _id ??= GetDeviceId();
|
||||||
|
|
||||||
private string CachePath => Path.Combine(_appPaths.DataPath, "device.txt");
|
private string CachePath => Path.Combine(_appPaths.DataPath, "device.txt");
|
||||||
|
|
||||||
private string GetCachedId()
|
private string? GetCachedId()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -65,7 +63,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
{
|
{
|
||||||
var path = CachePath;
|
var path = CachePath;
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? throw new InvalidOperationException("Path can't be a root directory."));
|
||||||
|
|
||||||
lock (_syncLock)
|
lock (_syncLock)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -37,16 +35,16 @@ namespace Emby.Server.Implementations.Library
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string cacheKey, bool addProbeDelay, CancellationToken cancellationToken)
|
public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string? cacheKey, bool addProbeDelay, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var originalRuntime = mediaSource.RunTimeTicks;
|
var originalRuntime = mediaSource.RunTimeTicks;
|
||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
|
|
||||||
MediaInfo mediaInfo = null;
|
MediaInfo? mediaInfo = null;
|
||||||
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
|
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(cacheKey))
|
if (cacheFilePath is not null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -91,7 +89,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (cacheFilePath is not null)
|
if (cacheFilePath is not null)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
|
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath) ?? throw new InvalidOperationException("Path can't be a root directory."));
|
||||||
FileStream createStream = AsyncFile.OpenWrite(cacheFilePath);
|
FileStream createStream = AsyncFile.OpenWrite(cacheFilePath);
|
||||||
await using (createStream.ConfigureAwait(false))
|
await using (createStream.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -13,7 +11,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Model.Querying;
|
|
||||||
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
|
using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library
|
namespace Emby.Server.Implementations.Library
|
||||||
|
@ -27,33 +24,35 @@ namespace Emby.Server.Implementations.Library
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromSong(Audio item, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromSong(Audio item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var list = new List<Audio>
|
var list = new List<BaseItem>
|
||||||
{
|
{
|
||||||
item
|
item
|
||||||
};
|
};
|
||||||
|
|
||||||
return list.Concat(GetInstantMixFromGenres(item.Genres, user, dtoOptions)).ToList();
|
list.AddRange(GetInstantMixFromGenres(item.Genres, user, dtoOptions));
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
return GetInstantMixFromGenres(artist.Genres, user, dtoOptions);
|
return GetInstantMixFromGenres(artist.Genres, user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromAlbum(MusicAlbum item, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromAlbum(MusicAlbum item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
|
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromFolder(Folder item, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromFolder(Folder item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var genres = item
|
var genres = item
|
||||||
.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { BaseItemKind.Audio },
|
IncludeItemTypes = [BaseItemKind.Audio],
|
||||||
DtoOptions = dtoOptions
|
DtoOptions = dtoOptions
|
||||||
})
|
})
|
||||||
.Cast<Audio>()
|
.Cast<Audio>()
|
||||||
|
@ -64,12 +63,12 @@ namespace Emby.Server.Implementations.Library
|
||||||
return GetInstantMixFromGenres(genres, user, dtoOptions);
|
return GetInstantMixFromGenres(genres, user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromPlaylist(Playlist item, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromPlaylist(Playlist item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
|
return GetInstantMixFromGenres(item.Genres, user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var genreIds = genres.DistinctNames().Select(i =>
|
var genreIds = genres.DistinctNames().Select(i =>
|
||||||
{
|
{
|
||||||
|
@ -86,27 +85,23 @@ namespace Emby.Server.Implementations.Library
|
||||||
return GetInstantMixFromGenreIds(genreIds, user, dtoOptions);
|
return GetInstantMixFromGenreIds(genreIds, user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromGenreIds(Guid[] genreIds, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromGenreIds(Guid[] genreIds, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { BaseItemKind.Audio },
|
IncludeItemTypes = [BaseItemKind.Audio],
|
||||||
|
GenreIds = genreIds,
|
||||||
GenreIds = genreIds.ToArray(),
|
|
||||||
|
|
||||||
Limit = 200,
|
Limit = 200,
|
||||||
|
OrderBy = [(ItemSortBy.Random, SortOrder.Ascending)],
|
||||||
OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
|
|
||||||
|
|
||||||
DtoOptions = dtoOptions
|
DtoOptions = dtoOptions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BaseItem> GetInstantMixFromItem(BaseItem item, User user, DtoOptions dtoOptions)
|
public List<BaseItem> GetInstantMixFromItem(BaseItem item, User? user, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
if (item is MusicGenre)
|
if (item is MusicGenre)
|
||||||
{
|
{
|
||||||
return GetInstantMixFromGenreIds(new[] { item.Id }, user, dtoOptions);
|
return GetInstantMixFromGenreIds([item.Id], user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is Playlist playlist)
|
if (item is Playlist playlist)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -29,7 +27,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
public QueryResult<SearchHintInfo> GetSearchHints(SearchQuery query)
|
public QueryResult<SearchHintInfo> GetSearchHints(SearchQuery query)
|
||||||
{
|
{
|
||||||
User user = null;
|
User? user = null;
|
||||||
if (!query.UserId.IsEmpty())
|
if (!query.UserId.IsEmpty())
|
||||||
{
|
{
|
||||||
user = _userManager.GetUserById(query.UserId);
|
user = _userManager.GetUserById(query.UserId);
|
||||||
|
@ -69,7 +67,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>IEnumerable{SearchHintResult}.</returns>
|
/// <returns>IEnumerable{SearchHintResult}.</returns>
|
||||||
/// <exception cref="ArgumentException"><c>query.SearchTerm</c> is <c>null</c> or empty.</exception>
|
/// <exception cref="ArgumentException"><c>query.SearchTerm</c> is <c>null</c> or empty.</exception>
|
||||||
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
|
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User? user)
|
||||||
{
|
{
|
||||||
var searchTerm = query.SearchTerm;
|
var searchTerm = query.SearchTerm;
|
||||||
|
|
||||||
|
@ -78,7 +76,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
searchTerm = searchTerm.Trim().RemoveDiacritics();
|
searchTerm = searchTerm.Trim().RemoveDiacritics();
|
||||||
|
|
||||||
var excludeItemTypes = query.ExcludeItemTypes.ToList();
|
var excludeItemTypes = query.ExcludeItemTypes.ToList();
|
||||||
var includeItemTypes = (query.IncludeItemTypes ?? Array.Empty<BaseItemKind>()).ToList();
|
var includeItemTypes = query.IncludeItemTypes.ToList();
|
||||||
|
|
||||||
excludeItemTypes.Add(BaseItemKind.Year);
|
excludeItemTypes.Add(BaseItemKind.Year);
|
||||||
excludeItemTypes.Add(BaseItemKind.Folder);
|
excludeItemTypes.Add(BaseItemKind.Folder);
|
||||||
|
@ -179,7 +177,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (!searchQuery.ParentId.IsEmpty())
|
if (!searchQuery.ParentId.IsEmpty())
|
||||||
{
|
{
|
||||||
searchQuery.AncestorIds = new[] { searchQuery.ParentId };
|
searchQuery.AncestorIds = [searchQuery.ParentId];
|
||||||
searchQuery.ParentId = Guid.Empty;
|
searchQuery.ParentId = Guid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
@ -11,6 +9,6 @@ namespace MediaBrowser.Controller.Channels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
string GetCacheKey(string userId);
|
string? GetCacheKey(string? userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
|
||||||
{
|
|
||||||
public interface ISearchableChannel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Searches the specified search term.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchInfo">The search information.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
|
|
||||||
Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, CancellationToken cancellationToken);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable disable
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CA1002, CS1591
|
#pragma warning disable CA1002, CS1591
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -19,7 +17,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <param name="user">The user to use.</param>
|
/// <param name="user">The user to use.</param>
|
||||||
/// <param name="dtoOptions">The options to use.</param>
|
/// <param name="dtoOptions">The options to use.</param>
|
||||||
/// <returns>List of items.</returns>
|
/// <returns>List of items.</returns>
|
||||||
List<BaseItem> GetInstantMixFromItem(BaseItem item, User user, DtoOptions dtoOptions);
|
List<BaseItem> GetInstantMixFromItem(BaseItem item, User? user, DtoOptions dtoOptions);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the instant mix from artist.
|
/// Gets the instant mix from artist.
|
||||||
|
@ -28,7 +26,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <param name="user">The user to use.</param>
|
/// <param name="user">The user to use.</param>
|
||||||
/// <param name="dtoOptions">The options to use.</param>
|
/// <param name="dtoOptions">The options to use.</param>
|
||||||
/// <returns>List of items.</returns>
|
/// <returns>List of items.</returns>
|
||||||
List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, User user, DtoOptions dtoOptions);
|
List<BaseItem> GetInstantMixFromArtist(MusicArtist artist, User? user, DtoOptions dtoOptions);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the instant mix from genre.
|
/// Gets the instant mix from genre.
|
||||||
|
@ -37,6 +35,6 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <param name="user">The user to use.</param>
|
/// <param name="user">The user to use.</param>
|
||||||
/// <param name="dtoOptions">The options to use.</param>
|
/// <param name="dtoOptions">The options to use.</param>
|
||||||
/// <returns>List of items.</returns>
|
/// <returns>List of items.</returns>
|
||||||
List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User user, DtoOptions dtoOptions);
|
List<BaseItem> GetInstantMixFromGenres(IEnumerable<string> genres, User? user, DtoOptions dtoOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -31,7 +30,7 @@ namespace MediaBrowser.Model.Search
|
||||||
/// Gets or sets the search term.
|
/// Gets or sets the search term.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The search term.</value>
|
/// <value>The search term.</value>
|
||||||
public string SearchTerm { get; set; }
|
public required string SearchTerm { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the start index. Used for paging.
|
/// Gets or sets the start index. Used for paging.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -29,6 +28,6 @@ namespace MediaBrowser.Model.System
|
||||||
/// Gets or sets the name.
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -570,7 +570,6 @@ namespace Jellyfin.LiveTv.Channels
|
||||||
return new ChannelFeatures(channel.Name, channel.Id)
|
return new ChannelFeatures(channel.Name, channel.Id)
|
||||||
{
|
{
|
||||||
CanFilter = !features.MaxPageSize.HasValue,
|
CanFilter = !features.MaxPageSize.HasValue,
|
||||||
CanSearch = provider is ISearchableChannel,
|
|
||||||
ContentTypes = features.ContentTypes.ToArray(),
|
ContentTypes = features.ContentTypes.ToArray(),
|
||||||
DefaultSortFields = features.DefaultSortFields.ToArray(),
|
DefaultSortFields = features.DefaultSortFields.ToArray(),
|
||||||
MaxPageSize = features.MaxPageSize,
|
MaxPageSize = features.MaxPageSize,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user