mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-01 07:51:54 +01:00
Merge remote-tracking branch 'upstream/master' into quickconnect
This commit is contained in:
@@ -88,25 +88,26 @@ namespace Emby.Server.Implementations.Activity
|
||||
|
||||
_subManager.SubtitleDownloadFailure += OnSubtitleDownloadFailure;
|
||||
|
||||
_userManager.UserCreated += OnUserCreated;
|
||||
_userManager.UserPasswordChanged += OnUserPasswordChanged;
|
||||
_userManager.UserDeleted += OnUserDeleted;
|
||||
_userManager.UserPolicyUpdated += OnUserPolicyUpdated;
|
||||
_userManager.UserLockedOut += OnUserLockedOut;
|
||||
_userManager.OnUserCreated += OnUserCreated;
|
||||
_userManager.OnUserPasswordChanged += OnUserPasswordChanged;
|
||||
_userManager.OnUserDeleted += OnUserDeleted;
|
||||
_userManager.OnUserLockedOut += OnUserLockedOut;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnUserLockedOut(object sender, GenericEventArgs<MediaBrowser.Controller.Entities.User> e)
|
||||
private async void OnUserLockedOut(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserLockedOutWithName"),
|
||||
e.Argument.Name),
|
||||
e.Argument.Username),
|
||||
NotificationType.UserLockedOut.ToString(),
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
e.Argument.Id)
|
||||
{
|
||||
LogSeverity = LogLevel.Error
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnSubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
|
||||
@@ -152,7 +153,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserStoppedPlayingItemWithValues"),
|
||||
user.Name,
|
||||
user.Username,
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackStoppedNotificationType(item.MediaType),
|
||||
@@ -187,7 +188,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserStartedPlayingItemWithValues"),
|
||||
user.Name,
|
||||
user.Username,
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackNotificationType(item.MediaType),
|
||||
@@ -304,49 +305,37 @@ namespace Emby.Server.Implementations.Activity
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserPolicyUpdated(object sender, GenericEventArgs<MediaBrowser.Controller.Entities.User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserPolicyUpdatedWithName"),
|
||||
e.Argument.Name),
|
||||
"UserPolicyUpdated",
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserDeleted(object sender, GenericEventArgs<MediaBrowser.Controller.Entities.User> e)
|
||||
private async void OnUserDeleted(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserDeletedWithName"),
|
||||
e.Argument.Name),
|
||||
e.Argument.Username),
|
||||
"UserDeleted",
|
||||
Guid.Empty))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserPasswordChanged(object sender, GenericEventArgs<MediaBrowser.Controller.Entities.User> e)
|
||||
private async void OnUserPasswordChanged(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserPasswordChangedWithName"),
|
||||
e.Argument.Name),
|
||||
e.Argument.Username),
|
||||
"UserPasswordChanged",
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserCreated(object sender, GenericEventArgs<MediaBrowser.Controller.Entities.User> e)
|
||||
private async void OnUserCreated(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserCreatedWithName"),
|
||||
e.Argument.Name),
|
||||
e.Argument.Username),
|
||||
"UserCreated",
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
@@ -510,11 +499,10 @@ namespace Emby.Server.Implementations.Activity
|
||||
|
||||
_subManager.SubtitleDownloadFailure -= OnSubtitleDownloadFailure;
|
||||
|
||||
_userManager.UserCreated -= OnUserCreated;
|
||||
_userManager.UserPasswordChanged -= OnUserPasswordChanged;
|
||||
_userManager.UserDeleted -= OnUserDeleted;
|
||||
_userManager.UserPolicyUpdated -= OnUserPolicyUpdated;
|
||||
_userManager.UserLockedOut -= OnUserLockedOut;
|
||||
_userManager.OnUserCreated -= OnUserCreated;
|
||||
_userManager.OnUserPasswordChanged -= OnUserPasswordChanged;
|
||||
_userManager.OnUserDeleted -= OnUserDeleted;
|
||||
_userManager.OnUserLockedOut -= OnUserLockedOut;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
CommonApplicationPaths = applicationPaths;
|
||||
XmlSerializer = xmlSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
Logger = loggerFactory.CreateLogger(GetType().Name);
|
||||
Logger = loggerFactory.CreateLogger<BaseConfigurationManager>();
|
||||
|
||||
UpdateCachePath();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
/// <value>The logger.</value>
|
||||
protected ILogger Logger { get; private set; }
|
||||
protected ILogger<BaseConfigurationManager> Logger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the XML serializer.
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Emby.Server.Implementations
|
||||
/// <summary>
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
protected ILogger Logger { get; }
|
||||
protected ILogger<ApplicationHost> Logger { get; }
|
||||
|
||||
private IPlugin[] _plugins;
|
||||
|
||||
@@ -564,11 +564,8 @@ namespace Emby.Server.Implementations
|
||||
|
||||
serviceCollection.AddSingleton<IAuthenticationRepository, AuthenticationRepository>();
|
||||
|
||||
serviceCollection.AddSingleton<IUserRepository, SqliteUserRepository>();
|
||||
|
||||
// TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required
|
||||
serviceCollection.AddTransient(provider => new Lazy<IDtoService>(provider.GetRequiredService<IDtoService>));
|
||||
serviceCollection.AddSingleton<IUserManager, UserManager>();
|
||||
|
||||
// TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required
|
||||
// TODO: Add StartupOptions.FFmpegPath to IConfiguration and remove this custom activation
|
||||
@@ -662,15 +659,11 @@ namespace Emby.Server.Implementations
|
||||
|
||||
((SqliteDisplayPreferencesRepository)Resolve<IDisplayPreferencesRepository>()).Initialize();
|
||||
((AuthenticationRepository)Resolve<IAuthenticationRepository>()).Initialize();
|
||||
((SqliteUserRepository)Resolve<IUserRepository>()).Initialize();
|
||||
|
||||
SetStaticProperties();
|
||||
|
||||
var userManager = (UserManager)Resolve<IUserManager>();
|
||||
userManager.Initialize();
|
||||
|
||||
var userDataRepo = (SqliteUserDataRepository)Resolve<IUserDataRepository>();
|
||||
((SqliteItemRepository)Resolve<IItemRepository>()).Initialize(userDataRepo, userManager);
|
||||
((SqliteItemRepository)Resolve<IItemRepository>()).Initialize(userDataRepo, Resolve<IUserManager>());
|
||||
|
||||
FindParts();
|
||||
}
|
||||
@@ -753,7 +746,6 @@ namespace Emby.Server.Implementations
|
||||
BaseItem.ProviderManager = Resolve<IProviderManager>();
|
||||
BaseItem.LocalizationManager = Resolve<ILocalizationManager>();
|
||||
BaseItem.ItemRepository = Resolve<IItemRepository>();
|
||||
User.UserManager = Resolve<IUserManager>();
|
||||
BaseItem.FileSystem = _fileSystemManager;
|
||||
BaseItem.UserDataManager = Resolve<IUserDataManager>();
|
||||
BaseItem.ChannelManager = Resolve<IChannelManager>();
|
||||
@@ -967,7 +959,7 @@ namespace Emby.Server.Implementations
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies that the kernel that a change has been made that requires a restart
|
||||
/// Notifies that the kernel that a change has been made that requires a restart.
|
||||
/// </summary>
|
||||
public void NotifyPendingRestart()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Browser
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var logger = appHost.Resolve<ILogger>();
|
||||
var logger = appHost.Resolve<ILogger<IServerApplicationHost>>();
|
||||
logger?.LogError(ex, "Failed to open browser window with URL {URL}", relativeUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -36,7 +40,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ChannelManager> _logger;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
@@ -791,7 +795,8 @@ namespace Emby.Server.Implementations.Channels
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<ChannelItemResult> GetChannelItems(IChannel channel,
|
||||
private async Task<ChannelItemResult> GetChannelItems(
|
||||
IChannel channel,
|
||||
User user,
|
||||
string externalFolderId,
|
||||
ChannelItemSortField? sortField,
|
||||
@@ -1067,7 +1072,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
}
|
||||
|
||||
// was used for status
|
||||
//if (!string.Equals(item.ExternalEtag ?? string.Empty, info.Etag ?? string.Empty, StringComparison.Ordinal))
|
||||
// if (!string.Equals(item.ExternalEtag ?? string.Empty, info.Etag ?? string.Empty, StringComparison.Ordinal))
|
||||
//{
|
||||
// item.ExternalEtag = info.Etag;
|
||||
// forceUpdate = true;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
public class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
|
||||
{
|
||||
private readonly IChannelManager _channelManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<RefreshChannelsScheduledTask> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILocalizationManager _localization;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -29,7 +30,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILibraryMonitor _iLibraryMonitor;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<CollectionManager> _logger;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly ILocalizationManager _localizationManager;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
@@ -56,7 +57,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
_libraryManager = libraryManager;
|
||||
_fileSystem = fileSystem;
|
||||
_iLibraryMonitor = iLibraryMonitor;
|
||||
_logger = loggerFactory.CreateLogger(nameof(CollectionManager));
|
||||
_logger = loggerFactory.CreateLogger<CollectionManager>();
|
||||
_providerManager = providerManager;
|
||||
_localizationManager = localizationManager;
|
||||
_appPaths = appPaths;
|
||||
@@ -370,7 +371,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
{
|
||||
private readonly CollectionManager _collectionManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<CollectionManagerEntryPoint> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionManagerEntryPoint"/> class.
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// Initializes a new instance of the <see cref="BaseSqliteRepository"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
protected BaseSqliteRepository(ILogger logger)
|
||||
protected BaseSqliteRepository(ILogger<BaseSqliteRepository> logger)
|
||||
{
|
||||
Logger = logger;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
/// <value>The logger.</value>
|
||||
protected ILogger Logger { get; }
|
||||
protected ILogger<BaseSqliteRepository> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default connection flags.
|
||||
@@ -162,7 +162,6 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}, ReadTransactionMode);
|
||||
}
|
||||
|
||||
@@ -248,12 +247,12 @@ namespace Emby.Server.Implementations.Data
|
||||
public enum SynchronousMode
|
||||
{
|
||||
/// <summary>
|
||||
/// SQLite continues without syncing as soon as it has handed data off to the operating system
|
||||
/// SQLite continues without syncing as soon as it has handed data off to the operating system.
|
||||
/// </summary>
|
||||
Off = 0,
|
||||
|
||||
/// <summary>
|
||||
/// SQLite database engine will still sync at the most critical moments
|
||||
/// SQLite database engine will still sync at the most critical moments.
|
||||
/// </summary>
|
||||
Normal = 1,
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.Data
|
||||
public class CleanDatabaseScheduledTask : ILibraryPostScanTask
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<CleanDatabaseScheduledTask> _logger;
|
||||
|
||||
public CleanDatabaseScheduledTask(ILibraryManager libraryManager, ILogger<CleanDatabaseScheduledTask> logger)
|
||||
{
|
||||
@@ -51,7 +51,6 @@ namespace Emby.Server.Implementations.Data
|
||||
_libraryManager.DeleteItem(item, new DeleteOptions
|
||||
{
|
||||
DeleteFileLocation = false
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable CS1591
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// Opens the connection to the database.
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
private void InitializeInternal()
|
||||
@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the display preferences associated with an item in the repo
|
||||
/// Save the display preferences associated with an item in the repo.
|
||||
/// </summary>
|
||||
/// <param name="displayPreferences">The display preferences.</param>
|
||||
/// <param name="userId">The user id.</param>
|
||||
@@ -122,7 +122,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save all display preferences associated with a user in the repo
|
||||
/// Save all display preferences associated with a user in the repo.
|
||||
/// </summary>
|
||||
/// <param name="displayPreferences">The display preferences.</param>
|
||||
/// <param name="userId">The user id.</param>
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Data
|
||||
protected override TempStoreMode TempStore => TempStoreMode.Memory;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// Opens the connection to the database.
|
||||
/// </summary>
|
||||
public void Initialize(SqliteUserDataRepository userDataRepo, IUserManager userManager)
|
||||
{
|
||||
@@ -321,7 +321,6 @@ namespace Emby.Server.Implementations.Data
|
||||
AddColumn(db, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames);
|
||||
AddColumn(db, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames);
|
||||
AddColumn(db, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames);
|
||||
|
||||
}, TransactionMode);
|
||||
|
||||
connection.RunQueries(postQueries);
|
||||
@@ -549,7 +548,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save a standard item in the repo
|
||||
/// Save a standard item in the repo.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
@@ -794,6 +793,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
saveItemStatement.TryBindNull("@Width");
|
||||
}
|
||||
|
||||
if (item.Height > 0)
|
||||
{
|
||||
saveItemStatement.TryBind("@Height", item.Height);
|
||||
@@ -933,6 +933,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
saveItemStatement.TryBindNull("@SeriesName");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userDataKey))
|
||||
{
|
||||
saveItemStatement.TryBindNull("@UserDataKey");
|
||||
@@ -1008,6 +1009,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
artists = string.Join("|", hasArtists.Artists);
|
||||
}
|
||||
|
||||
saveItemStatement.TryBind("@Artists", artists);
|
||||
|
||||
string albumArtists = null;
|
||||
@@ -1107,6 +1109,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
str.Append(ToValueString(i) + "|");
|
||||
}
|
||||
|
||||
@@ -1205,7 +1208,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Internal retrieve from items or users table
|
||||
/// Internal retrieve from items or users table.
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>BaseItem.</returns>
|
||||
@@ -1367,6 +1370,7 @@ namespace Emby.Server.Implementations.Data
|
||||
hasStartDate.StartDate = reader[index].ReadDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1374,12 +1378,14 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.EndDate = reader[index].TryReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.ChannelId = new Guid(reader.GetString(index));
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (enableProgramAttributes)
|
||||
@@ -1390,24 +1396,28 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
hasProgramAttributes.IsMovie = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
hasProgramAttributes.IsSeries = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
hasProgramAttributes.EpisodeTitle = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
hasProgramAttributes.IsRepeat = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
else
|
||||
@@ -1420,6 +1430,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.CommunityRating = reader.GetFloat(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.CustomRating))
|
||||
@@ -1428,6 +1439,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.CustomRating = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1435,6 +1447,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.IndexNumber = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.Settings))
|
||||
@@ -1443,18 +1456,21 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.IsLocked = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.PreferredMetadataLanguage = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.PreferredMetadataCountryCode = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1464,6 +1480,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Width = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1473,6 +1490,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Height = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1482,6 +1500,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.DateLastRefreshed = reader[index].ReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1489,18 +1508,21 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Name = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.Path = RestorePath(reader.GetString(index));
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.PremiereDate = reader[index].TryReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.Overview))
|
||||
@@ -1509,6 +1531,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Overview = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1516,18 +1539,21 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ParentIndexNumber = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.ProductionYear = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.OfficialRating = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.SortName))
|
||||
@@ -1536,6 +1562,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ForcedSortName = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1543,12 +1570,14 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.RunTimeTicks = reader.GetInt64(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.Size = reader.GetInt64(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.DateCreated))
|
||||
@@ -1557,6 +1586,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.DateCreated = reader[index].ReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1564,6 +1594,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.DateModified = reader[index].ReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
item.Id = reader.GetGuid(index);
|
||||
@@ -1575,6 +1606,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Genres = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1582,6 +1614,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ParentId = reader.GetGuid(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
@@ -1591,6 +1624,7 @@ namespace Emby.Server.Implementations.Data
|
||||
item.Audio = audio;
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
// TODO: Even if not needed by apps, the server needs it internally
|
||||
@@ -1604,6 +1638,7 @@ namespace Emby.Server.Implementations.Data
|
||||
liveTvChannel.ServiceName = reader.GetString(index);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1611,6 +1646,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.IsInMixedFolder = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.DateLastSaved))
|
||||
@@ -1619,6 +1655,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.DateLastSaved = reader[index].ReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1626,18 +1663,20 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
IEnumerable<MetadataFields> GetLockedFields(string s)
|
||||
IEnumerable<MetadataField> GetLockedFields(string s)
|
||||
{
|
||||
foreach (var i in s.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (Enum.TryParse(i, true, out MetadataFields parsedValue))
|
||||
if (Enum.TryParse(i, true, out MetadataField parsedValue))
|
||||
{
|
||||
yield return parsedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.LockedFields = GetLockedFields(reader.GetString(index)).ToArray();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1647,6 +1686,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Studios = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1656,6 +1696,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Tags = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1675,9 +1716,11 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trailer.TrailerTypes = GetTrailerTypes(reader.GetString(index)).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1687,6 +1730,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.OriginalTitle = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1697,6 +1741,7 @@ namespace Emby.Server.Implementations.Data
|
||||
video.PrimaryVersionId = reader.GetString(index);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.DateLastMediaAdded))
|
||||
@@ -1705,6 +1750,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
folder.DateLastMediaAdded = reader[index].TryReadDateTime();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1712,18 +1758,21 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Album = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.CriticRating = reader.GetFloat(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.IsVirtualItem = reader.GetBoolean(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (item is IHasSeries hasSeriesName)
|
||||
@@ -1733,6 +1782,7 @@ namespace Emby.Server.Implementations.Data
|
||||
hasSeriesName.SeriesName = reader.GetString(index);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (hasEpisodeAttributes)
|
||||
@@ -1743,6 +1793,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
episode.SeasonName = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
@@ -1753,6 +1804,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1766,6 +1818,7 @@ namespace Emby.Server.Implementations.Data
|
||||
hasSeries.SeriesId = reader.GetGuid(index);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1775,6 +1828,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.PresentationUniqueKey = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1784,6 +1838,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.InheritedParentalRatingValue = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1793,6 +1848,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ExternalSeriesId = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1802,6 +1858,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.Tagline = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1809,6 +1866,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
DeserializeProviderIds(reader.GetString(index), item);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (query.DtoOptions.EnableImages)
|
||||
@@ -1817,6 +1875,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
DeserializeImages(reader.GetString(index), item);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1826,6 +1885,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ProductionLocations = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1835,6 +1895,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ExtraIds = SplitToGuids(reader.GetString(index));
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1842,6 +1903,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.TotalBitrate = reader.GetInt32(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
@@ -1851,6 +1913,7 @@ namespace Emby.Server.Implementations.Data
|
||||
item.ExtraType = extraType;
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (hasArtistFields)
|
||||
@@ -1859,12 +1922,14 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
hasArtists.Artists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (item is IHasAlbumArtist hasAlbumArtists && !reader.IsDBNull(index))
|
||||
{
|
||||
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1872,6 +1937,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.ExternalId = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (HasField(query, ItemFields.SeriesPresentationUniqueKey))
|
||||
@@ -1883,6 +1949,7 @@ namespace Emby.Server.Implementations.Data
|
||||
hasSeries.SeriesPresentationUniqueKey = reader.GetString(index);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1892,6 +1959,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
program.ShowId = reader.GetString(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -1899,6 +1967,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
item.OwnerId = reader.GetGuid(index);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
return item;
|
||||
@@ -1919,7 +1988,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets chapters for an item
|
||||
/// Gets chapters for an item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
||||
@@ -1947,7 +2016,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single chapter for an item
|
||||
/// Gets a single chapter for an item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="index">The index.</param>
|
||||
@@ -2044,7 +2113,6 @@ namespace Emby.Server.Implementations.Data
|
||||
db.Execute("delete from " + ChaptersTableName + " where ItemId=@ItemId", idBlob);
|
||||
|
||||
InsertChapters(idBlob, chapters, db);
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
@@ -2475,6 +2543,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@SearchTermStartsWith", searchTerm + "%");
|
||||
}
|
||||
|
||||
if (commandText.IndexOf("@SearchTermContains", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
statement.TryBind("@SearchTermContains", "%" + searchTerm + "%");
|
||||
@@ -2734,7 +2803,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
foreach (var providerId in newItem.ProviderIds)
|
||||
{
|
||||
if (providerId.Key == MetadataProviders.TmdbCollection.ToString())
|
||||
if (providerId.Key == MetadataProvider.TmdbCollection.ToString())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2745,6 +2814,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
items[i] = newItem;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2837,6 +2907,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statementTexts.Add(commandText);
|
||||
}
|
||||
|
||||
if (query.EnableTotalRecordCount)
|
||||
{
|
||||
commandText = string.Empty;
|
||||
@@ -3241,6 +3312,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statementTexts.Add(commandText);
|
||||
}
|
||||
|
||||
if (query.EnableTotalRecordCount)
|
||||
{
|
||||
commandText = string.Empty;
|
||||
@@ -3594,11 +3666,13 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add("IndexNumber=@IndexNumber");
|
||||
statement?.TryBind("@IndexNumber", query.IndexNumber.Value);
|
||||
}
|
||||
|
||||
if (query.ParentIndexNumber.HasValue)
|
||||
{
|
||||
whereClauses.Add("ParentIndexNumber=@ParentIndexNumber");
|
||||
statement?.TryBind("@ParentIndexNumber", query.ParentIndexNumber.Value);
|
||||
}
|
||||
|
||||
if (query.ParentIndexNumberNotEquals.HasValue)
|
||||
{
|
||||
whereClauses.Add("(ParentIndexNumber<>@ParentIndexNumberNotEquals or ParentIndexNumber is null)");
|
||||
@@ -3884,6 +3958,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, artistId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -3904,6 +3979,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, artistId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -3924,8 +4000,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, artistId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -3943,8 +4021,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, albumId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -3962,8 +4042,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, artistId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -3981,8 +4063,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, genreId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -3998,8 +4082,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@Genre" + index, GetCleanValue(item));
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -4015,8 +4101,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@Tag" + index, GetCleanValue(item));
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -4032,8 +4120,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@ExcludeTag" + index, GetCleanValue(item));
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -4052,8 +4142,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, studioId.ToByteArray());
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -4069,8 +4161,10 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@OfficialRating" + index, item);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
var clause = "(" + string.Join(" OR ", clauses) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
@@ -4245,6 +4339,7 @@ namespace Emby.Server.Implementations.Data
|
||||
statement.TryBind("@IsVirtualItem", isVirtualItem.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (query.IsSpecialSeason.HasValue)
|
||||
{
|
||||
if (query.IsSpecialSeason.Value)
|
||||
@@ -4256,6 +4351,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add("IndexNumber <> 0");
|
||||
}
|
||||
}
|
||||
|
||||
if (query.IsUnaired.HasValue)
|
||||
{
|
||||
if (query.IsUnaired.Value)
|
||||
@@ -4267,6 +4363,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add("PremiereDate < DATETIME('now')");
|
||||
}
|
||||
}
|
||||
|
||||
var queryMediaTypes = query.MediaTypes.Where(IsValidMediaType).ToArray();
|
||||
if (queryMediaTypes.Length == 1)
|
||||
{
|
||||
@@ -4282,6 +4379,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
whereClauses.Add("MediaType in (" + val + ")");
|
||||
}
|
||||
|
||||
if (query.ItemIds.Length > 0)
|
||||
{
|
||||
var includeIds = new List<string>();
|
||||
@@ -4294,11 +4392,13 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@IncludeId" + index, id);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
whereClauses.Add("(" + string.Join(" OR ", includeIds) + ")");
|
||||
}
|
||||
|
||||
if (query.ExcludeItemIds.Length > 0)
|
||||
{
|
||||
var excludeIds = new List<string>();
|
||||
@@ -4311,6 +4411,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind("@ExcludeId" + index, id);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -4324,7 +4425,7 @@ namespace Emby.Server.Implementations.Data
|
||||
var index = 0;
|
||||
foreach (var pair in query.ExcludeProviderIds)
|
||||
{
|
||||
if (string.Equals(pair.Key, MetadataProviders.TmdbCollection.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(pair.Key, MetadataProvider.TmdbCollection.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -4335,6 +4436,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
break;
|
||||
@@ -4353,14 +4455,14 @@ namespace Emby.Server.Implementations.Data
|
||||
var index = 0;
|
||||
foreach (var pair in query.HasAnyProviderId)
|
||||
{
|
||||
if (string.Equals(pair.Key, MetadataProviders.TmdbCollection.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(pair.Key, MetadataProvider.TmdbCollection.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO this seems to be an idea for a better schema where ProviderIds are their own table
|
||||
// buut this is not implemented
|
||||
//hasProviderIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = '" + pair.Key + "'), '') <> " + paramName + ")");
|
||||
// hasProviderIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = '" + pair.Key + "'), '') <> " + paramName + ")");
|
||||
|
||||
// TODO this is a really BAD way to do it since the pair:
|
||||
// Tmdb, 1234 matches Tmdb=1234 but also Tmdb=1234567
|
||||
@@ -4377,6 +4479,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
break;
|
||||
@@ -4427,6 +4530,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
whereClauses.Add("(TopParentId=@TopParentId)");
|
||||
}
|
||||
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@TopParentId", queryTopParentIds[0].ToString("N", CultureInfo.InvariantCulture));
|
||||
@@ -4464,11 +4568,13 @@ namespace Emby.Server.Implementations.Data
|
||||
statement.TryBind("@AncestorId", query.AncestorIds[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (query.AncestorIds.Length > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.AncestorIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
|
||||
whereClauses.Add(string.Format("Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey))
|
||||
{
|
||||
var inClause = "select guid from TypedBaseItems where PresentationUniqueKey=@AncestorWithPresentationUniqueKey";
|
||||
@@ -4497,6 +4603,7 @@ namespace Emby.Server.Implementations.Data
|
||||
statement.TryBind("@UnratedType", query.BlockUnratedItems[0].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (query.BlockUnratedItems.Length > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.BlockUnratedItems.Select(i => "'" + i.ToString() + "'"));
|
||||
@@ -4789,7 +4896,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
connection.RunInTransaction(db =>
|
||||
{
|
||||
connection.ExecuteAll(sql);
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
@@ -4972,6 +5078,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
statement.TryBind("@ItemId", query.ItemId.ToByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
if (!query.AppearsInItemId.Equals(Guid.Empty))
|
||||
{
|
||||
whereClauses.Add("Name in (Select Name from People where ItemId=@AppearsInItemId)");
|
||||
@@ -4980,6 +5087,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
statement.TryBind("@AppearsInItemId", query.AppearsInItemId.ToByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
var queryPersonTypes = query.PersonTypes.Where(IsValidPersonType).ToList();
|
||||
|
||||
if (queryPersonTypes.Count == 1)
|
||||
@@ -4996,6 +5104,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
|
||||
whereClauses.Add("PersonType in (" + val + ")");
|
||||
}
|
||||
|
||||
var queryExcludePersonTypes = query.ExcludePersonTypes.Where(IsValidPersonType).ToList();
|
||||
|
||||
if (queryExcludePersonTypes.Count == 1)
|
||||
@@ -5012,6 +5121,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
|
||||
whereClauses.Add("PersonType not in (" + val + ")");
|
||||
}
|
||||
|
||||
if (query.MaxListOrder.HasValue)
|
||||
{
|
||||
whereClauses.Add("ListOrder<=@MaxListOrder");
|
||||
@@ -5020,6 +5130,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
statement.TryBind("@MaxListOrder", query.MaxListOrder.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
||||
{
|
||||
whereClauses.Add("Name like @NameContains");
|
||||
@@ -5159,6 +5270,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
var typeString = string.Join(",", withItemTypes.Select(i => "'" + i + "'"));
|
||||
commandText += " AND ItemId In (select guid from typedbaseitems where type in (" + typeString + "))";
|
||||
}
|
||||
|
||||
if (excludeItemTypes.Count > 0)
|
||||
{
|
||||
var typeString = string.Join(",", excludeItemTypes.Select(i => "'" + i + "'"));
|
||||
@@ -5180,7 +5292,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LogQueryTime("GetItemValueNames", commandText, now);
|
||||
@@ -5631,7 +5742,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
db.Execute("delete from People where ItemId=@ItemId", itemIdBlob);
|
||||
|
||||
InsertPeople(itemIdBlob, people, db);
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
@@ -5788,7 +5898,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
db.Execute("delete from mediastreams where ItemId=@ItemId", itemIdBlob);
|
||||
|
||||
InsertMediaStreams(itemIdBlob, streams, db);
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
@@ -6134,7 +6243,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob);
|
||||
|
||||
InsertMediaAttachments(itemIdBlob, attachments, db, cancellationToken);
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -134,10 +135,12 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
throw new ArgumentNullException(nameof(userData));
|
||||
}
|
||||
|
||||
if (internalUserId <= 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(internalUserId));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
@@ -152,6 +155,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
throw new ArgumentNullException(nameof(userData));
|
||||
}
|
||||
|
||||
if (internalUserId <= 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(internalUserId));
|
||||
@@ -234,7 +238,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Persist all user data for the specified user
|
||||
/// Persist all user data for the specified user.
|
||||
/// </summary>
|
||||
private void PersistAllUserData(long internalUserId, UserItemData[] userDataList, CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -308,7 +312,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return all user-data associated with the given user
|
||||
/// Return all user-data associated with the given user.
|
||||
/// </summary>
|
||||
/// <param name="internalUserId"></param>
|
||||
/// <returns></returns>
|
||||
@@ -338,7 +342,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a row from the specified reader into the provided userData object
|
||||
/// Read a row from the specified reader into the provided userData object.
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
private UserItemData ReadRow(IReadOnlyList<IResultSetValue> reader)
|
||||
@@ -346,7 +350,7 @@ namespace Emby.Server.Implementations.Data
|
||||
var userData = new UserItemData();
|
||||
|
||||
userData.Key = reader[0].ToString();
|
||||
//userData.UserId = reader[1].ReadGuidFromBlob();
|
||||
// userData.UserId = reader[1].ReadGuidFromBlob();
|
||||
|
||||
if (reader[2].SQLiteType != SQLiteType.Null)
|
||||
{
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using MediaBrowser.Common.Json;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SQLiteUserRepository
|
||||
/// </summary>
|
||||
public class SqliteUserRepository : BaseSqliteRepository, IUserRepository
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions;
|
||||
|
||||
public SqliteUserRepository(
|
||||
ILogger<SqliteUserRepository> logger,
|
||||
IServerApplicationPaths appPaths)
|
||||
: base(logger)
|
||||
{
|
||||
_jsonOptions = JsonDefaults.GetOptions();
|
||||
|
||||
DbFilePath = Path.Combine(appPaths.DataPath, "users.db");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the repository
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name => "SQLite";
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database.
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
using (var connection = GetConnection())
|
||||
{
|
||||
var localUsersTableExists = TableExists(connection, "LocalUsersv2");
|
||||
|
||||
connection.RunQueries(new[] {
|
||||
"create table if not exists LocalUsersv2 (Id INTEGER PRIMARY KEY, guid GUID NOT NULL, data BLOB NOT NULL)",
|
||||
"drop index if exists idx_users"
|
||||
});
|
||||
|
||||
if (!localUsersTableExists && TableExists(connection, "Users"))
|
||||
{
|
||||
TryMigrateToLocalUsersTable(connection);
|
||||
}
|
||||
|
||||
RemoveEmptyPasswordHashes(connection);
|
||||
}
|
||||
}
|
||||
|
||||
private void TryMigrateToLocalUsersTable(ManagedConnection connection)
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.RunQueries(new[]
|
||||
{
|
||||
"INSERT INTO LocalUsersv2 (guid, data) SELECT guid,data from users"
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error migrating users database");
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveEmptyPasswordHashes(ManagedConnection connection)
|
||||
{
|
||||
foreach (var user in RetrieveAllUsers(connection))
|
||||
{
|
||||
// If the user password is the sha1 hash of the empty string, remove it
|
||||
if (!string.Equals(user.Password, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", StringComparison.Ordinal)
|
||||
&& !string.Equals(user.Password, "$SHA1$DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
user.Password = null;
|
||||
var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions);
|
||||
|
||||
connection.RunInTransaction(db =>
|
||||
{
|
||||
using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
|
||||
{
|
||||
statement.TryBind("@InternalId", user.InternalId);
|
||||
statement.TryBind("@data", serialized);
|
||||
statement.MoveNext();
|
||||
}
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save a user in the repo
|
||||
/// </summary>
|
||||
public void CreateUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions);
|
||||
|
||||
using (var connection = GetConnection())
|
||||
{
|
||||
connection.RunInTransaction(db =>
|
||||
{
|
||||
using (var statement = db.PrepareStatement("insert into LocalUsersv2 (guid, data) values (@guid, @data)"))
|
||||
{
|
||||
statement.TryBind("@guid", user.Id.ToByteArray());
|
||||
statement.TryBind("@data", serialized);
|
||||
|
||||
statement.MoveNext();
|
||||
}
|
||||
|
||||
var createdUser = GetUser(user.Id, connection);
|
||||
|
||||
if (createdUser == null)
|
||||
{
|
||||
throw new ApplicationException("created user should never be null");
|
||||
}
|
||||
|
||||
user.InternalId = createdUser.InternalId;
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions);
|
||||
|
||||
using (var connection = GetConnection())
|
||||
{
|
||||
connection.RunInTransaction(db =>
|
||||
{
|
||||
using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
|
||||
{
|
||||
statement.TryBind("@InternalId", user.InternalId);
|
||||
statement.TryBind("@data", serialized);
|
||||
statement.MoveNext();
|
||||
}
|
||||
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
|
||||
private User GetUser(Guid guid, ManagedConnection connection)
|
||||
{
|
||||
using (var statement = connection.PrepareStatement("select id,guid,data from LocalUsersv2 where guid=@guid"))
|
||||
{
|
||||
statement.TryBind("@guid", guid);
|
||||
|
||||
foreach (var row in statement.ExecuteQuery())
|
||||
{
|
||||
return GetUser(row);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private User GetUser(IReadOnlyList<IResultSetValue> row)
|
||||
{
|
||||
var id = row[0].ToInt64();
|
||||
var guid = row[1].ReadGuidFromBlob();
|
||||
|
||||
var user = JsonSerializer.Deserialize<User>(row[2].ToBlob(), _jsonOptions);
|
||||
user.InternalId = id;
|
||||
user.Id = guid;
|
||||
return user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all users from the database
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{User}.</returns>
|
||||
public List<User> RetrieveAllUsers()
|
||||
{
|
||||
using (var connection = GetConnection(true))
|
||||
{
|
||||
return new List<User>(RetrieveAllUsers(connection));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all users from the database
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{User}.</returns>
|
||||
private IEnumerable<User> RetrieveAllUsers(ManagedConnection connection)
|
||||
{
|
||||
foreach (var row in connection.Query("select id,guid,data from LocalUsersv2"))
|
||||
{
|
||||
yield return GetUser(row);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
public void DeleteUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
using (var connection = GetConnection())
|
||||
{
|
||||
connection.RunInTransaction(db =>
|
||||
{
|
||||
using (var statement = db.PrepareStatement("delete from LocalUsersv2 where Id=@id"))
|
||||
{
|
||||
statement.TryBind("@id", user.InternalId);
|
||||
statement.MoveNext();
|
||||
}
|
||||
}, TransactionMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.Devices
|
||||
public class DeviceId
|
||||
{
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<DeviceId> _logger;
|
||||
|
||||
private readonly object _syncLock = new object();
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Emby.Server.Implementations.Devices
|
||||
public DeviceId(IApplicationPaths appPaths, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_appPaths = appPaths;
|
||||
_logger = loggerFactory.CreateLogger("SystemId");
|
||||
_logger = loggerFactory.CreateLogger<DeviceId>();
|
||||
}
|
||||
|
||||
public string Value => _id ?? (_id = GetDeviceId());
|
||||
|
||||
@@ -5,10 +5,11 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Devices;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Security;
|
||||
using MediaBrowser.Model.Devices;
|
||||
@@ -16,7 +17,6 @@ using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
@@ -27,11 +27,10 @@ namespace Emby.Server.Implementations.Devices
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IAuthenticationRepository _authRepo;
|
||||
private readonly Dictionary<string, ClientCapabilities> _capabilitiesCache;
|
||||
private readonly object _capabilitiesSyncLock = new object();
|
||||
|
||||
public event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
|
||||
|
||||
private readonly object _capabilitiesSyncLock = new object();
|
||||
|
||||
public DeviceManager(
|
||||
IAuthenticationRepository authRepo,
|
||||
IJsonSerializer json,
|
||||
@@ -113,7 +112,7 @@ namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
IEnumerable<AuthenticationInfo> sessions = _authRepo.Get(new AuthenticationInfoQuery
|
||||
{
|
||||
//UserId = query.UserId
|
||||
// UserId = query.UserId
|
||||
HasUser = true
|
||||
}).Items;
|
||||
|
||||
@@ -170,12 +169,18 @@ namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
throw new ArgumentException("user not found");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(deviceId))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(deviceId));
|
||||
}
|
||||
|
||||
if (!CanAccessDevice(user.Policy, deviceId))
|
||||
if (user.HasPermission(PermissionKind.EnableAllDevices) || user.HasPermission(PermissionKind.IsAdministrator))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!user.GetPreference(PreferenceKind.EnabledDevices).Contains(deviceId, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
var capabilities = GetCapabilities(deviceId);
|
||||
|
||||
@@ -187,20 +192,5 @@ namespace Emby.Server.Implementations.Devices
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool CanAccessDevice(UserPolicy policy, string id)
|
||||
{
|
||||
if (policy.EnableAllDevices)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (policy.IsAdministrator)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return policy.EnabledDevices.Contains(id, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ 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;
|
||||
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;
|
||||
@@ -24,12 +24,20 @@ 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
|
||||
{
|
||||
public class DtoService : IDtoService
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<DtoService> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserDataManager _userDataRepository;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
@@ -66,7 +74,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a BaseItem to a DTOBaseItem
|
||||
/// Converts a BaseItem to a DTOBaseItem.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="fields">The fields.</param>
|
||||
@@ -269,6 +277,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.EpisodeTitle = dto.Name;
|
||||
dto.Name = dto.SeriesName;
|
||||
}
|
||||
|
||||
liveTvManager.AddInfoToRecordingDto(item, dto, activeRecording, user);
|
||||
}
|
||||
|
||||
@@ -284,6 +293,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var containers = container.Split(new[] { ',' });
|
||||
if (containers.Length < 2)
|
||||
{
|
||||
@@ -384,7 +394,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (options.ContainsField(ItemFields.ChildCount))
|
||||
{
|
||||
dto.ChildCount = dto.ChildCount ?? GetChildCount(folder, user);
|
||||
dto.ChildCount ??= GetChildCount(folder, user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +408,6 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.DateLastMediaAdded = folder.DateLastMediaAdded;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (options.EnableUserData)
|
||||
@@ -414,7 +423,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (options.ContainsField(ItemFields.BasicSyncInfo))
|
||||
{
|
||||
var userCanSync = user != null && user.Policy.EnableContentDownloading;
|
||||
var userCanSync = user != null && user.HasPermission(PermissionKind.EnableContentDownloading);
|
||||
if (userCanSync && item.SupportsExternalTransfer)
|
||||
{
|
||||
dto.SupportsSync = true;
|
||||
@@ -435,7 +444,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets client-side Id of a server-side BaseItem
|
||||
/// Gets client-side Id of a server-side BaseItem.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
@@ -449,6 +458,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
dto.SeriesName = item.SeriesName;
|
||||
}
|
||||
|
||||
private static void SetPhotoProperties(BaseItemDto dto, Photo item)
|
||||
{
|
||||
dto.CameraMake = item.CameraMake;
|
||||
@@ -530,7 +540,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attaches People DTO's to a DTOBaseItem
|
||||
/// Attaches People DTO's to a DTOBaseItem.
|
||||
/// </summary>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
@@ -547,22 +557,27 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i.IsType(PersonType.GuestStar))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (i.IsType(PersonType.Director))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (i.IsType(PersonType.Writer))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (i.IsType(PersonType.Producer))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (i.IsType(PersonType.Composer))
|
||||
{
|
||||
return 4;
|
||||
@@ -586,7 +601,6 @@ namespace Emby.Server.Implementations.Dto
|
||||
_logger.LogError(ex, "Error getting person {Name}", c);
|
||||
return null;
|
||||
}
|
||||
|
||||
}).Where(i => i != null)
|
||||
.GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.Select(x => x.First())
|
||||
@@ -607,6 +621,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary);
|
||||
baseItemPerson.Id = entity.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
baseItemPerson.ImageBlurHashes = dto.ImageBlurHashes;
|
||||
list.Add(baseItemPerson);
|
||||
}
|
||||
}
|
||||
@@ -719,7 +734,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets simple property values on a DTOBaseItem
|
||||
/// Sets simple property values on a DTOBaseItem.
|
||||
/// </summary>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
@@ -939,7 +954,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.AlbumPrimaryImageTag = GetTagAndFillBlurhash(dto, albumParent, ImageType.Primary);
|
||||
}
|
||||
|
||||
//if (options.ContainsField(ItemFields.MediaSourceCount))
|
||||
// if (options.ContainsField(ItemFields.MediaSourceCount))
|
||||
//{
|
||||
// Songs always have one
|
||||
//}
|
||||
@@ -949,13 +964,13 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
dto.Artists = hasArtist.Artists;
|
||||
|
||||
//var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
|
||||
// var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
|
||||
//{
|
||||
// EnableTotalRecordCount = false,
|
||||
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
|
||||
//});
|
||||
|
||||
//dto.ArtistItems = artistItems.Items
|
||||
// dto.ArtistItems = artistItems.Items
|
||||
// .Select(i =>
|
||||
// {
|
||||
// var artist = i.Item1;
|
||||
@@ -968,7 +983,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
// .ToList();
|
||||
|
||||
// Include artists that are not in the database yet, e.g., just added via metadata editor
|
||||
//var foundArtists = artistItems.Items.Select(i => i.Item1.Name).ToList();
|
||||
// var foundArtists = artistItems.Items.Select(i => i.Item1.Name).ToList();
|
||||
dto.ArtistItems = hasArtist.Artists
|
||||
//.Except(foundArtists, new DistinctNameComparer())
|
||||
.Select(i =>
|
||||
@@ -993,7 +1008,6 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}).Where(i => i != null).ToArray();
|
||||
}
|
||||
|
||||
@@ -1002,13 +1016,13 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();
|
||||
|
||||
//var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
|
||||
// var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
|
||||
//{
|
||||
// EnableTotalRecordCount = false,
|
||||
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
|
||||
//});
|
||||
|
||||
//dto.AlbumArtists = artistItems.Items
|
||||
// dto.AlbumArtists = artistItems.Items
|
||||
// .Select(i =>
|
||||
// {
|
||||
// var artist = i.Item1;
|
||||
@@ -1044,7 +1058,6 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}).Where(i => i != null).ToArray();
|
||||
}
|
||||
|
||||
@@ -1158,7 +1171,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
// this block will add the series poster for episodes without a poster
|
||||
// TODO maybe remove the if statement entirely
|
||||
//if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
episodeSeries = episodeSeries ?? episode.Series;
|
||||
if (episodeSeries != null)
|
||||
@@ -1204,7 +1217,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
// this block will add the series poster for seasons without a poster
|
||||
// TODO maybe remove the if statement entirely
|
||||
//if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
series = series ?? season.Series;
|
||||
if (series != null)
|
||||
@@ -1342,6 +1355,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.ParentLogoImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (artLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && dto.ParentArtItemId == null)
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Art);
|
||||
@@ -1352,6 +1366,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.ParentArtImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId == null || parent is Series) && !(parent is ICollectionFolder) && !(parent is UserView))
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb);
|
||||
@@ -1362,6 +1377,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.ParentThumbImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (backdropLimit > 0 && !((dto.BackdropImageTags != null && dto.BackdropImageTags.Length > 0) || (dto.ParentBackdropImageTags != null && dto.ParentBackdropImageTags.Length > 0)))
|
||||
{
|
||||
var images = allImages.Where(i => i.Type == ImageType.Backdrop).Take(backdropLimit).ToList();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IPNetwork2" Version="2.4.0.126" />
|
||||
<PackageReference Include="IPNetwork2" Version="2.5.211" />
|
||||
<PackageReference Include="Jellyfin.XmlTv" Version="10.4.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
|
||||
@@ -34,14 +34,14 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.5" />
|
||||
<PackageReference Include="Mono.Nat" Version="2.0.1" />
|
||||
<PackageReference Include="prometheus-net.DotNetRuntime" Version="3.3.1" />
|
||||
<PackageReference Include="ServiceStack.Text.Core" Version="5.8.0" />
|
||||
<PackageReference Include="sharpcompress" Version="0.25.0" />
|
||||
<PackageReference Include="ServiceStack.Text.Core" Version="5.9.0" />
|
||||
<PackageReference Include="sharpcompress" Version="0.25.1" />
|
||||
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.1.0" />
|
||||
<PackageReference Include="DotNet.Glob" Version="3.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
public class ExternalPortForwarding : IServerEntryPoint
|
||||
{
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ExternalPortForwarding> _logger;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -28,7 +29,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LibraryChangedNotifier> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The library changed sync lock.
|
||||
@@ -131,7 +132,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
@@ -17,7 +18,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
private readonly ILiveTvManager _liveTvManager;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<RecordingNotifier> _logger;
|
||||
|
||||
public RecordingNotifier(
|
||||
ISessionManager sessionManager,
|
||||
@@ -64,7 +65,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
private async Task SendMessage(string name, TimerEventInfo info)
|
||||
{
|
||||
var users = _userManager.Users.Where(i => i.Policy.EnableLiveTvAccess).Select(i => i.Id).ToList();
|
||||
var users = _userManager.Users.Where(i => i.HasPermission(PermissionKind.EnableLiveTvAccess)).Select(i => i.Id).ToList();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class RefreshUsersMetadata.
|
||||
/// </summary>
|
||||
public class RefreshUsersMetadata : IScheduledTask, IConfigurableScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// The user manager.
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RefreshUsersMetadata" /> class.
|
||||
/// </summary>
|
||||
public RefreshUsersMetadata(IUserManager userManager, IFileSystem fileSystem)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Refresh Users";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => "RefreshUsers";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description => "Refresh user infos";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Category => "Library";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsHidden => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsLogged => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
foreach (var user in _userManager.Users)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
await user.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem)), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
IntervalTicks = TimeSpan.FromDays(1).Ticks,
|
||||
Type = TaskTriggerInfo.TriggerInterval
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
@@ -68,10 +68,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
/// <inheritdoc />
|
||||
public Task RunAsync()
|
||||
{
|
||||
_userManager.UserDeleted += OnUserDeleted;
|
||||
_userManager.UserUpdated += OnUserUpdated;
|
||||
_userManager.UserPolicyUpdated += OnUserPolicyUpdated;
|
||||
_userManager.UserConfigurationUpdated += OnUserConfigurationUpdated;
|
||||
_userManager.OnUserDeleted += OnUserDeleted;
|
||||
_userManager.OnUserUpdated += OnUserUpdated;
|
||||
|
||||
_appHost.HasPendingRestartChanged += OnHasPendingRestartChanged;
|
||||
|
||||
@@ -153,20 +151,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
await SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserPolicyUpdated(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
var dto = _userManager.GetUserDto(e.Argument);
|
||||
|
||||
await SendMessageToUserSession(e.Argument, "UserPolicyUpdated", dto).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserConfigurationUpdated(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
var dto = _userManager.GetUserDto(e.Argument);
|
||||
|
||||
await SendMessageToUserSession(e.Argument, "UserConfigurationUpdated", dto).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task SendMessageToAdminSessions<T>(string name, T data)
|
||||
{
|
||||
try
|
||||
@@ -175,7 +159,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +174,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,10 +192,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
if (dispose)
|
||||
{
|
||||
_userManager.UserDeleted -= OnUserDeleted;
|
||||
_userManager.UserUpdated -= OnUserUpdated;
|
||||
_userManager.UserPolicyUpdated -= OnUserPolicyUpdated;
|
||||
_userManager.UserConfigurationUpdated -= OnUserConfigurationUpdated;
|
||||
_userManager.OnUserDeleted -= OnUserDeleted;
|
||||
_userManager.OnUserUpdated -= OnUserUpdated;
|
||||
|
||||
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
||||
_installationManager.PackageInstalling -= OnPackageInstalling;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<UdpServerEntryPoint> _logger;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IConfiguration _config;
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
_logger = logger;
|
||||
_appHost = appHost;
|
||||
_config = configuration;
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
/// </summary>
|
||||
public class HttpClientManager : IHttpClient
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<HttpClientManager> _logger;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IApplicationHost _appHost;
|
||||
@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
=> SendAsync(options, HttpMethod.Get);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a GET request and returns the resulting stream
|
||||
/// Performs a GET request and returns the resulting stream.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>Task{Stream}.</returns>
|
||||
|
||||
@@ -32,12 +32,12 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// The _options
|
||||
/// The _options.
|
||||
/// </summary>
|
||||
private readonly IDictionary<string, string> _options = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// The _requested ranges
|
||||
/// The _requested ranges.
|
||||
/// </summary>
|
||||
private List<KeyValuePair<long, long?>> _requestedRanges;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// </summary>
|
||||
public const string DefaultRedirectKey = "HttpListenerHost:DefaultRedirectPath";
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<HttpListenerHost> _logger;
|
||||
private readonly ILoggerFactory _loggerFactory;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly INetworkManager _networkManager;
|
||||
@@ -230,7 +230,9 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
|
||||
httpRes.StatusCode = statusCode;
|
||||
|
||||
var errContent = NormalizeExceptionMessage(ex) ?? string.Empty;
|
||||
var errContent = _hostEnvironment.IsDevelopment()
|
||||
? (NormalizeExceptionMessage(ex) ?? string.Empty)
|
||||
: "Error processing request.";
|
||||
httpRes.ContentType = "text/plain";
|
||||
httpRes.ContentLength = errContent.Length;
|
||||
await httpRes.WriteAsync(errContent).ConfigureAwait(false);
|
||||
@@ -397,7 +399,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
var response = context.Response;
|
||||
var localPath = context.Request.Path.ToString();
|
||||
|
||||
var req = new WebSocketSharpRequest(request, response, request.Path, _logger);
|
||||
var req = new WebSocketSharpRequest(request, response, request.Path);
|
||||
return RequestHandler(req, request.GetDisplayUrl(), request.Host.ToString(), localPath, context.RequestAborted);
|
||||
}
|
||||
|
||||
@@ -451,6 +453,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
{
|
||||
httpRes.Headers.Add(key, value);
|
||||
}
|
||||
|
||||
httpRes.ContentType = "text/plain";
|
||||
await httpRes.WriteAsync(string.Empty, cancellationToken).ConfigureAwait(false);
|
||||
return;
|
||||
@@ -589,7 +592,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default CORS headers
|
||||
/// Get the default CORS headers.
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<HttpResultFactory> _logger;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IStreamHelper _streamHelper;
|
||||
@@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
_fileSystem = fileSystem;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_streamHelper = streamHelper;
|
||||
_logger = loggerfactory.CreateLogger("HttpResultFactory");
|
||||
_logger = loggerfactory.CreateLogger<HttpResultFactory>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -580,7 +580,6 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,7 +692,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// When the browser sends the IfModifiedDate, it's precision is limited to seconds, so this will account for that
|
||||
/// When the browser sends the IfModifiedDate, it's precision is limited to seconds, so this will account for that.
|
||||
/// </summary>
|
||||
/// <param name="date">The date.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
|
||||
@@ -20,31 +20,37 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// </summary>
|
||||
/// <value>The source stream.</value>
|
||||
private Stream SourceStream { get; set; }
|
||||
|
||||
private string RangeHeader { get; set; }
|
||||
|
||||
private bool IsHeadRequest { get; set; }
|
||||
|
||||
private long RangeStart { get; set; }
|
||||
|
||||
private long RangeEnd { get; set; }
|
||||
|
||||
private long RangeLength { get; set; }
|
||||
|
||||
private long TotalContentLength { get; set; }
|
||||
|
||||
public Action OnComplete { get; set; }
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private const int BufferSize = 81920;
|
||||
|
||||
/// <summary>
|
||||
/// The _options
|
||||
/// The _options.
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, string> _options = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// The us culture
|
||||
/// The us culture.
|
||||
/// </summary>
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
|
||||
/// <summary>
|
||||
/// Additional HTTP Headers
|
||||
/// Additional HTTP Headers.
|
||||
/// </summary>
|
||||
/// <value>The headers.</value>
|
||||
public IDictionary<string, string> Headers => _options;
|
||||
@@ -110,7 +116,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _requested ranges
|
||||
/// The _requested ranges.
|
||||
/// </summary>
|
||||
private List<KeyValuePair<long, long?>> _requestedRanges;
|
||||
/// <summary>
|
||||
@@ -139,6 +145,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
{
|
||||
start = long.Parse(vals[0], UsCulture);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(vals[1]))
|
||||
{
|
||||
end = long.Parse(vals[1], UsCulture);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using MediaBrowser.Controller.Net;
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Authentication;
|
||||
using Emby.Server.Implementations.SocketSharp;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Security;
|
||||
using MediaBrowser.Controller.Session;
|
||||
@@ -45,7 +46,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
|
||||
public User Authenticate(HttpRequest request, IAuthenticationAttributes authAttributes)
|
||||
{
|
||||
var req = new WebSocketSharpRequest(request, null, request.Path, _logger);
|
||||
var req = new WebSocketSharpRequest(request, null, request.Path);
|
||||
var user = ValidateUser(req, authAttributes);
|
||||
return user;
|
||||
}
|
||||
@@ -90,7 +91,8 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
!string.IsNullOrEmpty(auth.Client) &&
|
||||
!string.IsNullOrEmpty(auth.Device))
|
||||
{
|
||||
_sessionManager.LogSessionActivity(auth.Client,
|
||||
_sessionManager.LogSessionActivity(
|
||||
auth.Client,
|
||||
auth.Version,
|
||||
auth.DeviceId,
|
||||
auth.Device,
|
||||
@@ -104,21 +106,21 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
private void ValidateUserAccess(
|
||||
User user,
|
||||
IRequest request,
|
||||
IAuthenticationAttributes authAttribtues,
|
||||
IAuthenticationAttributes authAttributes,
|
||||
AuthorizationInfo auth)
|
||||
{
|
||||
if (user.Policy.IsDisabled)
|
||||
if (user.HasPermission(PermissionKind.IsDisabled))
|
||||
{
|
||||
throw new SecurityException("User account has been disabled.");
|
||||
}
|
||||
|
||||
if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(request.RemoteIp))
|
||||
if (!user.HasPermission(PermissionKind.EnableRemoteAccess) && !_networkManager.IsInLocalNetwork(request.RemoteIp))
|
||||
{
|
||||
throw new SecurityException("User account has been disabled.");
|
||||
}
|
||||
|
||||
if (!user.Policy.IsAdministrator
|
||||
&& !authAttribtues.EscapeParentalControl
|
||||
if (!user.HasPermission(PermissionKind.IsAdministrator)
|
||||
&& !authAttributes.EscapeParentalControl
|
||||
&& !user.IsParentalScheduleAllowed())
|
||||
{
|
||||
request.Response.Headers.Add("X-Application-Error-Code", "ParentalControl");
|
||||
@@ -138,6 +140,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (authAttribtues.AllowLocalOnly && request.IsLocal)
|
||||
{
|
||||
return true;
|
||||
@@ -180,7 +183,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
{
|
||||
if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
if (user == null || !user.Policy.IsAdministrator)
|
||||
if (user == null || !user.HasPermission(PermissionKind.IsAdministrator))
|
||||
{
|
||||
throw new SecurityException("User does not have admin access.");
|
||||
}
|
||||
@@ -188,7 +191,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
|
||||
if (roles.Contains("delete", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
if (user == null || !user.Policy.EnableContentDeletion)
|
||||
if (user == null || !user.HasPermission(PermissionKind.EnableContentDeletion))
|
||||
{
|
||||
throw new SecurityException("User does not have delete access.");
|
||||
}
|
||||
@@ -196,7 +199,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
|
||||
if (roles.Contains("download", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
if (user == null || !user.Policy.EnableContentDownloading)
|
||||
if (user == null || !user.HasPermission(PermissionKind.EnableContentDownloading))
|
||||
{
|
||||
throw new SecurityException("User does not have download access.");
|
||||
}
|
||||
@@ -223,7 +226,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
throw new AuthenticationException("Access token is invalid or expired.");
|
||||
}
|
||||
|
||||
//if (!string.IsNullOrEmpty(info.UserId))
|
||||
// if (!string.IsNullOrEmpty(info.UserId))
|
||||
//{
|
||||
// var user = _userManager.GetUserById(info.UserId);
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
{
|
||||
token = httpReq.Headers["X-MediaBrowser-Token"];
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
token = httpReq.QueryString["api_key"];
|
||||
@@ -116,7 +117,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
{
|
||||
info.Device = tokenInfo.DeviceName;
|
||||
}
|
||||
|
||||
else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (allowTokenInfoUpdate)
|
||||
@@ -149,9 +149,9 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
{
|
||||
info.User = _userManager.GetUserById(tokenInfo.UserId);
|
||||
|
||||
if (info.User != null && !string.Equals(info.User.Name, tokenInfo.UserName, StringComparison.OrdinalIgnoreCase))
|
||||
if (info.User != null && !string.Equals(info.User.Username, tokenInfo.UserName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
tokenInfo.UserName = info.User.Name;
|
||||
tokenInfo.UserName = info.User.Username;
|
||||
updateToken = true;
|
||||
}
|
||||
}
|
||||
@@ -161,6 +161,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
_authRepo.Update(tokenInfo);
|
||||
}
|
||||
}
|
||||
|
||||
httpReq.Items["OriginalAuthenticationInfo"] = tokenInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<WebSocketConnection> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The json serializer options.
|
||||
@@ -234,10 +234,12 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
private Task SendKeepAliveResponse()
|
||||
{
|
||||
LastKeepAliveDate = DateTime.UtcNow;
|
||||
return SendAsync(new WebSocketMessage<string>
|
||||
{
|
||||
MessageType = "KeepAlive"
|
||||
}, CancellationToken.None);
|
||||
return SendAsync(
|
||||
new WebSocketMessage<string>
|
||||
{
|
||||
MessageId = Guid.NewGuid(),
|
||||
MessageType = "KeepAlive"
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
public class LibraryMonitor : ILibraryMonitor
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LibraryMonitor> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IServerConfigurationManager _configurationManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
@@ -266,7 +266,6 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
DisposeWatcher(newWatcher, false);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -393,7 +392,6 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}))
|
||||
{
|
||||
monitorPath = false;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// </summary>
|
||||
public class ManagedFileSystem : IFileSystem
|
||||
{
|
||||
protected ILogger Logger;
|
||||
protected ILogger<ManagedFileSystem> Logger;
|
||||
|
||||
private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>();
|
||||
private readonly string _tempPath;
|
||||
@@ -237,7 +237,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
result.IsDirectory = info is DirectoryInfo || (info.Attributes & FileAttributes.Directory) == FileAttributes.Directory;
|
||||
|
||||
//if (!result.IsDirectory)
|
||||
// if (!result.IsDirectory)
|
||||
//{
|
||||
// result.IsHidden = (info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
|
||||
//}
|
||||
@@ -628,6 +628,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return extensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
||||
});
|
||||
}
|
||||
@@ -682,6 +683,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return extensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace Emby.Server.Implementations.Images
|
||||
new ValueTuple<string, SortOrder>(ItemSortBy.Random, SortOrder.Ascending)
|
||||
},
|
||||
IncludeItemTypes = includeItemTypes
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ namespace Emby.Server.Implementations.Images
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
}).GroupBy(x => x.Id)
|
||||
.Select(x => x.First());
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using MediaBrowser.Model.IO;
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the core resolver ignore rules
|
||||
/// Provides the core resolver ignore rules.
|
||||
/// </summary>
|
||||
public class CoreResolutionIgnoreRule : IResolverIgnoreRule
|
||||
{
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Cryptography;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// The default authentication provider.
|
||||
/// </summary>
|
||||
public class DefaultAuthenticationProvider : IAuthenticationProvider, IRequiresResolvedUser
|
||||
{
|
||||
private readonly ICryptoProvider _cryptographyProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DefaultAuthenticationProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="cryptographyProvider">The cryptography provider.</param>
|
||||
public DefaultAuthenticationProvider(ICryptoProvider cryptographyProvider)
|
||||
{
|
||||
_cryptographyProvider = cryptographyProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Default";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
// This is dumb and an artifact of the backwards way auth providers were designed.
|
||||
// This version of authenticate was never meant to be called, but needs to be here for interface compat
|
||||
// Only the providers that don't provide local user support use this
|
||||
public Task<ProviderAuthenticationResult> Authenticate(string username, string password)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
// This is the version that we need to use for local users. Because reasons.
|
||||
public Task<ProviderAuthenticationResult> Authenticate(string username, string password, User resolvedUser)
|
||||
{
|
||||
if (resolvedUser == null)
|
||||
{
|
||||
throw new AuthenticationException($"Specified user does not exist.");
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
|
||||
// As long as jellyfin supports passwordless users, we need this little block here to accommodate
|
||||
if (!HasPassword(resolvedUser) && string.IsNullOrEmpty(password))
|
||||
{
|
||||
return Task.FromResult(new ProviderAuthenticationResult
|
||||
{
|
||||
Username = username
|
||||
});
|
||||
}
|
||||
|
||||
byte[] passwordbytes = Encoding.UTF8.GetBytes(password);
|
||||
|
||||
PasswordHash readyHash = PasswordHash.Parse(resolvedUser.Password);
|
||||
if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id)
|
||||
|| _cryptographyProvider.DefaultHashMethod == readyHash.Id)
|
||||
{
|
||||
byte[] calculatedHash = _cryptographyProvider.ComputeHash(
|
||||
readyHash.Id,
|
||||
passwordbytes,
|
||||
readyHash.Salt.ToArray());
|
||||
|
||||
if (readyHash.Hash.SequenceEqual(calculatedHash))
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AuthenticationException($"Requested crypto method not available in provider: {readyHash.Id}");
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
throw new AuthenticationException("Invalid username or password");
|
||||
}
|
||||
|
||||
return Task.FromResult(new ProviderAuthenticationResult
|
||||
{
|
||||
Username = username
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasPassword(User user)
|
||||
=> !string.IsNullOrEmpty(user.Password);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task ChangePassword(User user, string newPassword)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newPassword))
|
||||
{
|
||||
user.Password = null;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
PasswordHash newPasswordHash = _cryptographyProvider.CreatePasswordHash(newPassword);
|
||||
user.Password = newPasswordHash.ToString();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeEasyPassword(User user, string newPassword, string newPasswordHash)
|
||||
{
|
||||
if (newPassword != null)
|
||||
{
|
||||
newPasswordHash = _cryptographyProvider.CreatePasswordHash(newPassword).ToString();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(newPasswordHash))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(newPasswordHash));
|
||||
}
|
||||
|
||||
user.EasyPassword = newPasswordHash;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetEasyPasswordHash(User user)
|
||||
{
|
||||
return string.IsNullOrEmpty(user.EasyPassword)
|
||||
? null
|
||||
: Hex.Encode(PasswordHash.Parse(user.EasyPassword).Hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// The default password reset provider.
|
||||
/// </summary>
|
||||
public class DefaultPasswordResetProvider : IPasswordResetProvider
|
||||
{
|
||||
private const string BaseResetFileName = "passwordreset";
|
||||
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly string _passwordResetFileBase;
|
||||
private readonly string _passwordResetFileBaseDir;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DefaultPasswordResetProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="configurationManager">The configuration manager.</param>
|
||||
/// <param name="jsonSerializer">The JSON serializer.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
public DefaultPasswordResetProvider(
|
||||
IServerConfigurationManager configurationManager,
|
||||
IJsonSerializer jsonSerializer,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_passwordResetFileBaseDir = configurationManager.ApplicationPaths.ProgramDataPath;
|
||||
_passwordResetFileBase = Path.Combine(_passwordResetFileBaseDir, BaseResetFileName);
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Default Password Reset Provider";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<PinRedeemResult> RedeemPasswordResetPin(string pin)
|
||||
{
|
||||
SerializablePasswordReset spr;
|
||||
List<string> usersreset = new List<string>();
|
||||
foreach (var resetfile in Directory.EnumerateFiles(_passwordResetFileBaseDir, $"{BaseResetFileName}*"))
|
||||
{
|
||||
using (var str = File.OpenRead(resetfile))
|
||||
{
|
||||
spr = await _jsonSerializer.DeserializeFromStreamAsync<SerializablePasswordReset>(str).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (spr.ExpirationDate < DateTime.Now)
|
||||
{
|
||||
File.Delete(resetfile);
|
||||
}
|
||||
else if (string.Equals(
|
||||
spr.Pin.Replace("-", string.Empty, StringComparison.Ordinal),
|
||||
pin.Replace("-", string.Empty, StringComparison.Ordinal),
|
||||
StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var resetUser = _userManager.GetUserByName(spr.UserName);
|
||||
if (resetUser == null)
|
||||
{
|
||||
throw new ResourceNotFoundException($"User with a username of {spr.UserName} not found");
|
||||
}
|
||||
|
||||
await _userManager.ChangePassword(resetUser, pin).ConfigureAwait(false);
|
||||
usersreset.Add(resetUser.Name);
|
||||
File.Delete(resetfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (usersreset.Count < 1)
|
||||
{
|
||||
throw new ResourceNotFoundException($"No Users found with a password reset request matching pin {pin}");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new PinRedeemResult
|
||||
{
|
||||
Success = true,
|
||||
UsersReset = usersreset.ToArray()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<ForgotPasswordResult> StartForgotPasswordProcess(MediaBrowser.Controller.Entities.User user, bool isInNetwork)
|
||||
{
|
||||
string pin = string.Empty;
|
||||
using (var cryptoRandom = RandomNumberGenerator.Create())
|
||||
{
|
||||
byte[] bytes = new byte[4];
|
||||
cryptoRandom.GetBytes(bytes);
|
||||
pin = BitConverter.ToString(bytes);
|
||||
}
|
||||
|
||||
DateTime expireTime = DateTime.Now.AddMinutes(30);
|
||||
string filePath = _passwordResetFileBase + user.InternalId + ".json";
|
||||
SerializablePasswordReset spr = new SerializablePasswordReset
|
||||
{
|
||||
ExpirationDate = expireTime,
|
||||
Pin = pin,
|
||||
PinFile = filePath,
|
||||
UserName = user.Name
|
||||
};
|
||||
|
||||
using (FileStream fileStream = File.OpenWrite(filePath))
|
||||
{
|
||||
_jsonSerializer.SerializeToStream(spr, fileStream);
|
||||
await fileStream.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return new ForgotPasswordResult
|
||||
{
|
||||
Action = ForgotPasswordAction.PinCode,
|
||||
PinExpirationDate = expireTime,
|
||||
PinFile = filePath
|
||||
};
|
||||
}
|
||||
|
||||
private class SerializablePasswordReset : PasswordPinCreationResult
|
||||
{
|
||||
public string Pin { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,13 @@ namespace Emby.Server.Implementations.Library
|
||||
public class ExclusiveLiveStream : ILiveStream
|
||||
{
|
||||
public int ConsumerCount { get; set; }
|
||||
|
||||
public string OriginalStreamId { get; set; }
|
||||
|
||||
public string TunerHostId => null;
|
||||
|
||||
public bool EnableStreamSharing { get; set; }
|
||||
|
||||
public MediaSourceInfo MediaSource { get; set; }
|
||||
|
||||
public string UniqueId { get; private set; }
|
||||
|
||||
@@ -4,12 +4,12 @@ using DotNet.Globbing;
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Glob patterns for files to ignore
|
||||
/// Glob patterns for files to ignore.
|
||||
/// </summary>
|
||||
public static class IgnorePatterns
|
||||
{
|
||||
/// <summary>
|
||||
/// Files matching these glob patterns will be ignored
|
||||
/// Files matching these glob patterns will be ignored.
|
||||
/// </summary>
|
||||
public static readonly string[] Patterns = new string[]
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Library
|
||||
private static readonly Glob[] _globs = Patterns.Select(p => Glob.Parse(p, _globOptions)).ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the supplied path should be ignored
|
||||
/// Returns true if the supplied path should be ignored.
|
||||
/// </summary>
|
||||
public static bool ShouldIgnore(string path)
|
||||
{
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// An invalid authentication provider.
|
||||
/// </summary>
|
||||
public class InvalidAuthProvider : IAuthenticationProvider
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Name => "InvalidOrMissingAuthenticationProvider";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<ProviderAuthenticationResult> Authenticate(string username, string password)
|
||||
{
|
||||
throw new AuthenticationException("User Account cannot login with this provider. The Normal provider for this user cannot be found");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasPassword(User user)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task ChangePassword(User user, string newPassword)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeEasyPassword(User user, string newPassword, string newPasswordHash)
|
||||
{
|
||||
// Nothing here
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetPasswordHash(User user)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetEasyPasswordHash(User user)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ 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;
|
||||
using MediaBrowser.Controller;
|
||||
@@ -25,7 +27,6 @@ using MediaBrowser.Controller.Drawing;
|
||||
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;
|
||||
@@ -46,6 +47,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;
|
||||
|
||||
@@ -56,7 +60,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
public class LibraryManager : ILibraryManager
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LibraryManager> _logger;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataManager _userDataRepository;
|
||||
@@ -93,13 +97,13 @@ namespace Emby.Server.Implementations.Library
|
||||
private IIntroProvider[] IntroProviders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of entity resolution ignore rules
|
||||
/// Gets or sets the list of entity resolution ignore rules.
|
||||
/// </summary>
|
||||
/// <value>The entity resolution ignore rules.</value>
|
||||
private IResolverIgnoreRule[] EntityResolutionIgnoreRules { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of currently registered entity resolvers
|
||||
/// Gets or sets the list of currently registered entity resolvers.
|
||||
/// </summary>
|
||||
/// <value>The entity resolvers enumerable.</value>
|
||||
private IItemResolver[] EntityResolvers { get; set; }
|
||||
@@ -205,12 +209,12 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _root folder
|
||||
/// The _root folder.
|
||||
/// </summary>
|
||||
private volatile AggregateFolder _rootFolder;
|
||||
|
||||
/// <summary>
|
||||
/// The _root folder sync lock
|
||||
/// The _root folder sync lock.
|
||||
/// </summary>
|
||||
private readonly object _rootFolderSyncLock = new object();
|
||||
|
||||
@@ -623,7 +627,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a path should be ignored based on its contents - called after the contents have been read
|
||||
/// Determines whether a path should be ignored based on its contents - called after the contents have been read.
|
||||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
@@ -905,7 +909,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Genre
|
||||
/// Gets a Genre.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>Task{Genre}.</returns>
|
||||
@@ -986,7 +990,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the root media folder
|
||||
/// Reloads the root media folder.
|
||||
/// </summary>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
@@ -1539,7 +1543,8 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
// Handle grouping
|
||||
if (user != null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType) && user.Configuration.GroupedFolders.Length > 0)
|
||||
if (user != null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType)
|
||||
&& user.GetPreference(PreferenceKind.GroupedFolders).Length > 0)
|
||||
{
|
||||
return GetUserRootFolder()
|
||||
.GetChildren(user, true)
|
||||
@@ -2590,7 +2595,7 @@ namespace Emby.Server.Implementations.Library
|
||||
Anime series don't generally have a season in their file name, however,
|
||||
tvdb needs a season to correctly get the metadata.
|
||||
Hence, a null season needs to be filled with something. */
|
||||
//FIXME perhaps this would be better for tvdb parser to ask for season 1 if no season is specified
|
||||
// FIXME perhaps this would be better for tvdb parser to ask for season 1 if no season is specified
|
||||
episode.ParentIndexNumber = 1;
|
||||
}
|
||||
|
||||
@@ -2779,10 +2784,12 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(from))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(from));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(to))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(to));
|
||||
@@ -2856,7 +2863,6 @@ namespace Emby.Server.Implementations.Library
|
||||
_logger.LogError(ex, "Error getting person");
|
||||
return null;
|
||||
}
|
||||
|
||||
}).Where(i => i != null).ToList();
|
||||
}
|
||||
|
||||
@@ -2986,7 +2992,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private static bool ValidateNetworkPath(string path)
|
||||
{
|
||||
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
// if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
//{
|
||||
// // We can't validate protocol-based paths, so just allow them
|
||||
// if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
mediaInfo = _json.DeserializeFromFile<MediaInfo>(cacheFilePath);
|
||||
|
||||
//_logger.LogDebug("Found cached media info");
|
||||
// _logger.LogDebug("Found cached media info");
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.Library
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
|
||||
_json.SerializeToFile(mediaInfo, cacheFilePath);
|
||||
|
||||
//_logger.LogDebug("Saved media info to {0}", cacheFilePath);
|
||||
// _logger.LogDebug("Saved media info to {0}", cacheFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,17 +148,14 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
videoStream.BitRate = 30000000;
|
||||
}
|
||||
|
||||
else if (width >= 1900)
|
||||
{
|
||||
videoStream.BitRate = 20000000;
|
||||
}
|
||||
|
||||
else if (width >= 1200)
|
||||
{
|
||||
videoStream.BitRate = 8000000;
|
||||
}
|
||||
|
||||
else if (width >= 700)
|
||||
{
|
||||
videoStream.BitRate = 2000000;
|
||||
|
||||
@@ -7,6 +7,8 @@ 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;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -14,7 +16,6 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -33,7 +34,7 @@ namespace Emby.Server.Implementations.Library
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<MediaSourceManager> _logger;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly ILocalizationManager _localizationManager;
|
||||
@@ -190,10 +191,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!user.Policy.EnableAudioPlaybackTranscoding)
|
||||
{
|
||||
source.SupportsTranscoding = false;
|
||||
}
|
||||
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,22 +205,27 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
return MediaProtocol.Rtsp;
|
||||
}
|
||||
|
||||
if (path.StartsWith("Rtmp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaProtocol.Rtmp;
|
||||
}
|
||||
|
||||
if (path.StartsWith("Http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaProtocol.Http;
|
||||
}
|
||||
|
||||
if (path.StartsWith("rtp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaProtocol.Rtp;
|
||||
}
|
||||
|
||||
if (path.StartsWith("ftp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaProtocol.Ftp;
|
||||
}
|
||||
|
||||
if (path.StartsWith("udp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaProtocol.Udp;
|
||||
@@ -352,7 +355,9 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
|
||||
{
|
||||
if (userData.SubtitleStreamIndex.HasValue && user.Configuration.RememberSubtitleSelections && user.Configuration.SubtitleMode != SubtitlePlaybackMode.None && allowRememberingSelection)
|
||||
if (userData.SubtitleStreamIndex.HasValue
|
||||
&& user.RememberSubtitleSelections
|
||||
&& user.SubtitleMode != SubtitlePlaybackMode.None && allowRememberingSelection)
|
||||
{
|
||||
var index = userData.SubtitleStreamIndex.Value;
|
||||
// Make sure the saved index is still valid
|
||||
@@ -363,26 +368,27 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
var preferredSubs = string.IsNullOrEmpty(user.Configuration.SubtitleLanguagePreference)
|
||||
? Array.Empty<string>() : NormalizeLanguage(user.Configuration.SubtitleLanguagePreference);
|
||||
|
||||
var preferredSubs = string.IsNullOrEmpty(user.SubtitleLanguagePreference)
|
||||
? Array.Empty<string>() : NormalizeLanguage(user.SubtitleLanguagePreference);
|
||||
|
||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||
var audioLangage = defaultAudioIndex == null
|
||||
? null
|
||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||
|
||||
source.DefaultSubtitleStreamIndex = MediaStreamSelector.GetDefaultSubtitleStreamIndex(source.MediaStreams,
|
||||
source.DefaultSubtitleStreamIndex = MediaStreamSelector.GetDefaultSubtitleStreamIndex(
|
||||
source.MediaStreams,
|
||||
preferredSubs,
|
||||
user.Configuration.SubtitleMode,
|
||||
user.SubtitleMode,
|
||||
audioLangage);
|
||||
|
||||
MediaStreamSelector.SetSubtitleStreamScores(source.MediaStreams, preferredSubs,
|
||||
user.Configuration.SubtitleMode, audioLangage);
|
||||
MediaStreamSelector.SetSubtitleStreamScores(source.MediaStreams, preferredSubs, user.SubtitleMode, audioLangage);
|
||||
}
|
||||
|
||||
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
|
||||
{
|
||||
if (userData.AudioStreamIndex.HasValue && user.Configuration.RememberAudioSelections && allowRememberingSelection)
|
||||
if (userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection)
|
||||
{
|
||||
var index = userData.AudioStreamIndex.Value;
|
||||
// Make sure the saved index is still valid
|
||||
@@ -393,11 +399,11 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
var preferredAudio = string.IsNullOrEmpty(user.Configuration.AudioLanguagePreference)
|
||||
var preferredAudio = string.IsNullOrEmpty(user.AudioLanguagePreference)
|
||||
? Array.Empty<string>()
|
||||
: NormalizeLanguage(user.Configuration.AudioLanguagePreference);
|
||||
: NormalizeLanguage(user.AudioLanguagePreference);
|
||||
|
||||
source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(source.MediaStreams, preferredAudio, user.Configuration.PlayDefaultAudioTrack);
|
||||
source.DefaultAudioStreamIndex = MediaStreamSelector.GetDefaultAudioStreamIndex(source.MediaStreams, preferredAudio, user.PlayDefaultAudioTrack);
|
||||
}
|
||||
|
||||
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
||||
@@ -435,7 +441,6 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
|
||||
.ThenByDescending(i =>
|
||||
{
|
||||
@@ -534,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)
|
||||
{
|
||||
@@ -545,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)
|
||||
@@ -556,17 +561,14 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
videoStream.BitRate = 30000000;
|
||||
}
|
||||
|
||||
else if (width >= 1900)
|
||||
{
|
||||
videoStream.BitRate = 20000000;
|
||||
}
|
||||
|
||||
else if (width >= 1200)
|
||||
{
|
||||
videoStream.BitRate = 8000000;
|
||||
}
|
||||
|
||||
else if (width >= 700)
|
||||
{
|
||||
videoStream.BitRate = 2000000;
|
||||
@@ -622,7 +624,6 @@ namespace Emby.Server.Implementations.Library
|
||||
MediaSource = mediaSource,
|
||||
ExtractChapters = false,
|
||||
MediaType = DlnaProfileType.Video
|
||||
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
mediaSource.MediaStreams = info.MediaStreams;
|
||||
@@ -648,7 +649,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
mediaInfo = _jsonSerializer.DeserializeFromFile<MediaInfo>(cacheFilePath);
|
||||
|
||||
//_logger.LogDebug("Found cached media info");
|
||||
// _logger.LogDebug("Found cached media info");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -670,20 +671,21 @@ namespace Emby.Server.Implementations.Library
|
||||
mediaSource.AnalyzeDurationMs = 3000;
|
||||
}
|
||||
|
||||
mediaInfo = await _mediaEncoder.GetMediaInfo(new MediaInfoRequest
|
||||
mediaInfo = await _mediaEncoder.GetMediaInfo(
|
||||
new MediaInfoRequest
|
||||
{
|
||||
MediaSource = mediaSource,
|
||||
MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video,
|
||||
ExtractChapters = false
|
||||
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
},
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (cacheFilePath != null)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
|
||||
_jsonSerializer.SerializeToFile(mediaInfo, cacheFilePath);
|
||||
|
||||
//_logger.LogDebug("Saved media info to {0}", cacheFilePath);
|
||||
// _logger.LogDebug("Saved media info to {0}", cacheFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,17 +751,14 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
videoStream.BitRate = 30000000;
|
||||
}
|
||||
|
||||
else if (width >= 1900)
|
||||
{
|
||||
videoStream.BitRate = 20000000;
|
||||
}
|
||||
|
||||
else if (width >= 1200)
|
||||
{
|
||||
videoStream.BitRate = 8000000;
|
||||
}
|
||||
|
||||
else if (width >= 700)
|
||||
{
|
||||
videoStream.BitRate = 2000000;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -75,7 +77,6 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
return Guid.Empty;
|
||||
}
|
||||
|
||||
}).Where(i => !i.Equals(Guid.Empty)).ToArray();
|
||||
|
||||
return GetInstantMixFromGenreIds(genreIds, user, dtoOptions);
|
||||
@@ -105,32 +106,27 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetInstantMixFromGenreIds(new[] { item.Id }, user, dtoOptions);
|
||||
}
|
||||
|
||||
var playlist = item as Playlist;
|
||||
if (playlist != null)
|
||||
if (item is Playlist playlist)
|
||||
{
|
||||
return GetInstantMixFromPlaylist(playlist, user, dtoOptions);
|
||||
}
|
||||
|
||||
var album = item as MusicAlbum;
|
||||
if (album != null)
|
||||
if (item is MusicAlbum album)
|
||||
{
|
||||
return GetInstantMixFromAlbum(album, user, dtoOptions);
|
||||
}
|
||||
|
||||
var artist = item as MusicArtist;
|
||||
if (artist != null)
|
||||
if (item is MusicArtist artist)
|
||||
{
|
||||
return GetInstantMixFromArtist(artist, user, dtoOptions);
|
||||
}
|
||||
|
||||
var song = item as Audio;
|
||||
if (song != null)
|
||||
if (item is Audio song)
|
||||
{
|
||||
return GetInstantMixFromSong(song, user, dtoOptions);
|
||||
}
|
||||
|
||||
var folder = item as Folder;
|
||||
if (folder != null)
|
||||
if (item is Folder folder)
|
||||
{
|
||||
return GetInstantMixFromFolder(folder, user, dtoOptions);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures DateCreated and DateModified have values
|
||||
/// Ensures DateCreated and DateModified have values.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
|
||||
@@ -209,8 +209,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
Name = parseName ?
|
||||
resolvedItem.Name :
|
||||
Path.GetFileNameWithoutExtension(firstMedia.Path),
|
||||
//AdditionalParts = resolvedItem.Files.Skip(1).Select(i => i.Path).ToArray(),
|
||||
//LocalAlternateVersions = resolvedItem.AlternateVersions.Select(i => i.Path).ToArray()
|
||||
// AdditionalParts = resolvedItem.Files.Skip(1).Select(i => i.Path).ToArray(),
|
||||
// LocalAlternateVersions = resolvedItem.AlternateVersions.Select(i => i.Path).ToArray()
|
||||
};
|
||||
|
||||
result.Items.Add(libraryItem);
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
// Args points to an album if parent is an Artist folder or it directly contains music
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
// if (args.Parent is MusicArtist) return true; //saves us from testing children twice
|
||||
// if (args.Parent is MusicArtist) return true; // saves us from testing children twice
|
||||
if (ContainsMusic(args.FileSystemChildren, true, args.DirectoryService, _logger, _fileSystem, _libraryManager))
|
||||
{
|
||||
return true;
|
||||
@@ -109,7 +109,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
IEnumerable<FileSystemMetadata> list,
|
||||
bool allowSubfolders,
|
||||
IDirectoryService directoryService,
|
||||
ILogger logger,
|
||||
ILogger<MusicAlbumResolver> logger,
|
||||
IFileSystem fileSystem,
|
||||
ILibraryManager libraryManager)
|
||||
{
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
}
|
||||
|
||||
return true;
|
||||
//var blurayExtensions = new[]
|
||||
// var blurayExtensions = new[]
|
||||
//{
|
||||
// ".mts",
|
||||
// ".m2ts",
|
||||
@@ -300,7 +300,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
// ".mpls"
|
||||
//};
|
||||
|
||||
//return directoryService.GetFiles(fullPath).Any(i => blurayExtensions.Contains(i.Extension ?? string.Empty, StringComparer.OrdinalIgnoreCase));
|
||||
// return directoryService.GetFiles(fullPath).Any(i => blurayExtensions.Contains(i.Extension ?? string.Empty, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||
|
||||
/// <summary>
|
||||
/// Sets initial values on the newly resolved item
|
||||
/// Sets initial values on the newly resolved item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Tmdb, id);
|
||||
item.SetProviderId(MetadataProvider.Tmdb, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(tmdbid))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Tmdb, tmdbid);
|
||||
item.SetProviderId(MetadataProvider.Tmdb, tmdbid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(imdbid))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Imdb, imdbid);
|
||||
item.SetProviderId(MetadataProvider.Imdb, imdbid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,12 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
return new AggregateFolder();
|
||||
}
|
||||
|
||||
if (string.Equals(args.Path, _appPaths.DefaultUserViewsPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new UserRootFolder(); //if we got here and still a root - must be user root
|
||||
return new UserRootFolder(); // if we got here and still a root - must be user root
|
||||
}
|
||||
|
||||
if (args.IsVf)
|
||||
{
|
||||
return new CollectionFolder
|
||||
@@ -73,7 +75,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
})
|
||||
.Select(i => _fileSystem.GetFileNameWithoutExtension(i))
|
||||
.FirstOrDefault();
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
episode.SeriesId = series.Id;
|
||||
episode.SeriesName = series.Name;
|
||||
}
|
||||
|
||||
if (season != null)
|
||||
{
|
||||
episode.SeasonId = season.Id;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<SeasonResolver> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
|
||||
@@ -94,7 +94,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
_localization.GetLocalizedString("NameSeasonNumber"),
|
||||
seasonNumber,
|
||||
args.GetLibraryOptions().PreferredMetadataLanguage);
|
||||
|
||||
}
|
||||
|
||||
return season;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
public class SeriesResolver : FolderResolver<Series>
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<SeriesResolver> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
/// <summary>
|
||||
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
var collectionType = args.GetCollectionType();
|
||||
if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//if (args.ContainsFileSystemEntryByName("tvshow.nfo"))
|
||||
// if (args.ContainsFileSystemEntryByName("tvshow.nfo"))
|
||||
//{
|
||||
// return new Series
|
||||
// {
|
||||
@@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
||||
IDirectoryService directoryService,
|
||||
IFileSystem fileSystem,
|
||||
ILogger logger,
|
||||
ILogger<SeriesResolver> logger,
|
||||
ILibraryManager libraryManager,
|
||||
bool isTvContentType)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Tvdb, id);
|
||||
item.SetProviderId(MetadataProvider.Tvdb, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,12 +13,14 @@ 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
|
||||
{
|
||||
public class SearchEngine : ISearchEngine
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<SearchEngine> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
@@ -191,6 +194,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
searchQuery.AncestorIds = new[] { searchQuery.ParentId };
|
||||
}
|
||||
|
||||
searchQuery.ParentId = Guid.Empty;
|
||||
searchQuery.IncludeItemsByName = true;
|
||||
searchQuery.IncludeItemTypes = Array.Empty<string>();
|
||||
@@ -204,7 +208,6 @@ namespace Emby.Server.Implementations.Library
|
||||
return mediaItems.Select(i => new SearchHintInfo
|
||||
{
|
||||
Item = i
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -13,6 +14,7 @@ using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Book = MediaBrowser.Controller.Entities.Book;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
@@ -26,7 +28,7 @@ namespace Emby.Server.Implementations.Library
|
||||
private readonly ConcurrentDictionary<string, UserItemData> _userData =
|
||||
new ConcurrentDictionary<string, UserItemData>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<UserDataManager> _logger;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataRepository _repository;
|
||||
@@ -101,7 +103,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all user data for the given user
|
||||
/// Retrieve all user data for the given user.
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
@@ -186,7 +188,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a UserItemData to a DTOUserItemData
|
||||
/// Converts a UserItemData to a DTOUserItemData.
|
||||
/// </summary>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <returns>DtoUserItemData.</returns>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,8 @@ 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;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
@@ -17,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
|
||||
{
|
||||
@@ -125,12 +129,12 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (!query.IncludeHidden)
|
||||
{
|
||||
list = list.Where(i => !user.Configuration.MyMediaExcludes.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture))).ToList();
|
||||
list = list.Where(i => !user.GetPreference(PreferenceKind.MyMediaExcludes).Contains(i.Id.ToString("N", CultureInfo.InvariantCulture))).ToList();
|
||||
}
|
||||
|
||||
var sorted = _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
|
||||
var orders = user.Configuration.OrderedViews.ToList();
|
||||
var orders = user.GetPreference(PreferenceKind.OrderedViews).ToList();
|
||||
|
||||
return list
|
||||
.OrderBy(i =>
|
||||
@@ -165,7 +169,13 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetUserSubViewWithName(name, parentId, type, sortName);
|
||||
}
|
||||
|
||||
private Folder GetUserView(List<ICollectionFolder> parents, string viewType, string localizationKey, string sortName, User user, string[] presetViews)
|
||||
private Folder GetUserView(
|
||||
List<ICollectionFolder> parents,
|
||||
string viewType,
|
||||
string localizationKey,
|
||||
string sortName,
|
||||
Jellyfin.Data.Entities.User user,
|
||||
string[] presetViews)
|
||||
{
|
||||
if (parents.Count == 1 && parents.All(i => string.Equals(i.CollectionType, viewType, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
@@ -270,7 +280,8 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
parents = _libraryManager.GetUserRootFolder().GetChildren(user, true)
|
||||
.Where(i => i is Folder)
|
||||
.Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture)))
|
||||
.Where(i => !user.GetPreference(PreferenceKind.LatestItemExcludes)
|
||||
.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture)))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -331,12 +342,11 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var excludeItemTypes = includeItemTypes.Length == 0 && mediaTypes.Count == 0 ? new[]
|
||||
{
|
||||
typeof(Person).Name,
|
||||
typeof(Studio).Name,
|
||||
typeof(Year).Name,
|
||||
typeof(MusicGenre).Name,
|
||||
typeof(Genre).Name
|
||||
|
||||
nameof(Person),
|
||||
nameof(Studio),
|
||||
nameof(Year),
|
||||
nameof(MusicGenre),
|
||||
nameof(Genre)
|
||||
} : Array.Empty<string>();
|
||||
|
||||
var query = new InternalItemsQuery(user)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// The _library manager.
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ArtistsValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public ArtistsPostScanTask(
|
||||
ILibraryManager libraryManager,
|
||||
ILogger<ArtistsPostScanTask> logger,
|
||||
ILogger<ArtistsValidator> logger,
|
||||
IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ArtistsValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public ArtistsValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
|
||||
public ArtistsValidator(ILibraryManager libraryManager, ILogger<ArtistsValidator> logger, IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
@@ -98,7 +98,6 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
_libraryManager.DeleteItem(item, new DeleteOptions
|
||||
{
|
||||
DeleteFileLocation = false
|
||||
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// The _library manager.
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<GenresValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public GenresPostScanTask(
|
||||
ILibraryManager libraryManager,
|
||||
ILogger<GenresPostScanTask> logger,
|
||||
ILogger<GenresValidator> logger,
|
||||
IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<GenresValidator> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GenresValidator"/> class.
|
||||
@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public GenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
|
||||
public GenresValidator(ILibraryManager libraryManager, ILogger<GenresValidator> logger, IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// The library manager.
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<MusicGenresValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public MusicGenresPostScanTask(
|
||||
ILibraryManager libraryManager,
|
||||
ILogger<MusicGenresPostScanTask> logger,
|
||||
ILogger<MusicGenresValidator> logger,
|
||||
IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<MusicGenresValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public MusicGenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
|
||||
public MusicGenresValidator(ILibraryManager libraryManager, ILogger<MusicGenresValidator> logger, IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<StudiosValidator> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
/// <summary>
|
||||
@@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public StudiosPostScanTask(
|
||||
ILibraryManager libraryManager,
|
||||
ILogger<StudiosPostScanTask> logger,
|
||||
ILogger<StudiosValidator> logger,
|
||||
IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<StudiosValidator> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StudiosValidator" /> class.
|
||||
@@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="itemRepo">The item repository.</param>
|
||||
public StudiosValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
|
||||
public StudiosValidator(ILibraryManager libraryManager, ILogger<StudiosValidator> logger, IItemRepository itemRepo)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
@@ -92,7 +92,6 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
_libraryManager.DeleteItem(item, new DeleteOptions
|
||||
{
|
||||
DeleteFileLocation = false
|
||||
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
private const int TunerDiscoveryDurationMs = 3000;
|
||||
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<EmbyTV> _logger;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
@@ -1547,7 +1547,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
IsFolder = false,
|
||||
Recursive = true,
|
||||
DtoOptions = new DtoOptions(true)
|
||||
|
||||
})
|
||||
.Where(i => i.IsFileProtocol && File.Exists(i.Path))
|
||||
.Skip(seriesTimer.KeepUpTo - 1)
|
||||
@@ -1893,22 +1892,22 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
writer.WriteStartDocument(true);
|
||||
writer.WriteStartElement("tvshow");
|
||||
string id;
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Tvdb.ToString(), out id))
|
||||
{
|
||||
writer.WriteElementString("id", id);
|
||||
}
|
||||
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Imdb.ToString(), out id))
|
||||
{
|
||||
writer.WriteElementString("imdb_id", id);
|
||||
}
|
||||
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tmdb.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out id))
|
||||
{
|
||||
writer.WriteElementString("tmdbid", id);
|
||||
}
|
||||
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Zap2It.ToString(), out id))
|
||||
if (timer.SeriesProviderIds.TryGetValue(MetadataProvider.Zap2It.ToString(), out id))
|
||||
{
|
||||
writer.WriteElementString("zap2itid", id);
|
||||
}
|
||||
@@ -2075,14 +2074,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
writer.WriteElementString("credits", person);
|
||||
}
|
||||
|
||||
var tmdbCollection = item.GetProviderId(MetadataProviders.TmdbCollection);
|
||||
var tmdbCollection = item.GetProviderId(MetadataProvider.TmdbCollection);
|
||||
|
||||
if (!string.IsNullOrEmpty(tmdbCollection))
|
||||
{
|
||||
writer.WriteElementString("collectionnumber", tmdbCollection);
|
||||
}
|
||||
|
||||
var imdb = item.GetProviderId(MetadataProviders.Imdb);
|
||||
var imdb = item.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(imdb))
|
||||
{
|
||||
if (!isSeriesEpisode)
|
||||
@@ -2096,7 +2095,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
lockData = false;
|
||||
}
|
||||
|
||||
var tvdb = item.GetProviderId(MetadataProviders.Tvdb);
|
||||
var tvdb = item.GetProviderId(MetadataProvider.Tvdb);
|
||||
if (!string.IsNullOrEmpty(tvdb))
|
||||
{
|
||||
writer.WriteElementString("tvdbid", tvdb);
|
||||
@@ -2105,7 +2104,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
lockData = false;
|
||||
}
|
||||
|
||||
var tmdb = item.GetProviderId(MetadataProviders.Tmdb);
|
||||
var tmdb = item.GetProviderId(MetadataProvider.Tmdb);
|
||||
if (!string.IsNullOrEmpty(tmdb))
|
||||
{
|
||||
writer.WriteElementString("tmdbid", tmdb);
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var subtitleArgs = CopySubtitles ? " -codec:s copy" : " -sn";
|
||||
|
||||
//var outputParam = string.Equals(Path.GetExtension(targetFile), ".mp4", StringComparison.OrdinalIgnoreCase) ?
|
||||
// var outputParam = string.Equals(Path.GetExtension(targetFile), ".mp4", StringComparison.OrdinalIgnoreCase) ?
|
||||
// " -f mp4 -movflags frag_keyframe+empty_moov" :
|
||||
// string.Empty;
|
||||
|
||||
@@ -206,13 +206,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
return "-codec:a:0 copy";
|
||||
|
||||
//var audioChannels = 2;
|
||||
//var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
//if (audioStream != null)
|
||||
// var audioChannels = 2;
|
||||
// var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
// if (audioStream != null)
|
||||
//{
|
||||
// audioChannels = audioStream.Channels ?? audioChannels;
|
||||
//}
|
||||
//return "-codec:a:0 aac -strict experimental -ab 320000";
|
||||
// return "-codec:a:0 aac -strict experimental -ab 320000";
|
||||
}
|
||||
|
||||
private static bool EncodeVideo(MediaSourceInfo mediaSource)
|
||||
|
||||
@@ -56,7 +56,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
name += " " + info.EpisodeTitle;
|
||||
}
|
||||
}
|
||||
|
||||
else if (info.IsMovie && info.ProductionYear != null)
|
||||
{
|
||||
name += " (" + info.ProductionYear + ")";
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
public class SchedulesDirect : IListingsProvider
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<SchedulesDirect> _logger;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly SemaphoreSlim _tokenSemaphore = new SemaphoreSlim(1, 1);
|
||||
@@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
var programsInfo = new List<ProgramInfo>();
|
||||
foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs))
|
||||
{
|
||||
//_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
|
||||
// _logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
|
||||
// " which corresponds to channel " + channelNumber + " and program id " +
|
||||
// schedule.programID + " which says it has images? " +
|
||||
// programDict[schedule.programID].hasImageArtwork);
|
||||
@@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, WideAspect);
|
||||
|
||||
//programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??
|
||||
// programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??
|
||||
// GetProgramImage(ApiUrl, data, "Banner-L1", false) ??
|
||||
// GetProgramImage(ApiUrl, data, "Banner-LO", false) ??
|
||||
// GetProgramImage(ApiUrl, data, "Banner-LOT", false);
|
||||
@@ -212,6 +212,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
channelNumber = map.channel;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(channelNumber))
|
||||
{
|
||||
channelNumber = map.atscMajor + "." + map.atscMinor;
|
||||
@@ -276,7 +277,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
CommunityRating = null,
|
||||
EpisodeTitle = episodeTitle,
|
||||
Audio = audioType,
|
||||
//IsNew = programInfo.@new ?? false,
|
||||
// IsNew = programInfo.@new ?? false,
|
||||
IsRepeat = programInfo.@new == null,
|
||||
IsSeries = string.Equals(details.entityType, "episode", StringComparison.OrdinalIgnoreCase),
|
||||
ImageUrl = details.primaryImage,
|
||||
@@ -342,7 +343,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
info.SeriesId = programId.Substring(0, 10);
|
||||
|
||||
info.SeriesProviderIds[MetadataProviders.Zap2It.ToString()] = info.SeriesId;
|
||||
info.SeriesProviderIds[MetadataProvider.Zap2It.ToString()] = info.SeriesId;
|
||||
|
||||
if (details.metadata != null)
|
||||
{
|
||||
@@ -400,6 +401,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
date = DateTime.SpecifyKind(date, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
@@ -622,6 +624,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
_lastErrorResponse = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
@@ -701,7 +704,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
CancellationToken = cancellationToken,
|
||||
LogErrorResponseBody = true
|
||||
};
|
||||
//_logger.LogInformation("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
|
||||
// _logger.LogInformation("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
|
||||
// httpOptions.RequestContent);
|
||||
|
||||
using (var response = await Post(httpOptions, false, null).ConfigureAwait(false))
|
||||
@@ -805,11 +808,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
throw new ArgumentException("Username is required");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.Password))
|
||||
{
|
||||
throw new ArgumentException("Password is required");
|
||||
}
|
||||
}
|
||||
|
||||
if (validateListings)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.ListingsId))
|
||||
@@ -932,24 +937,35 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class Token
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
public string message { get; set; }
|
||||
|
||||
public string serverID { get; set; }
|
||||
|
||||
public string token { get; set; }
|
||||
}
|
||||
|
||||
public class Lineup
|
||||
{
|
||||
public string lineup { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
|
||||
public string transport { get; set; }
|
||||
|
||||
public string location { get; set; }
|
||||
|
||||
public string uri { get; set; }
|
||||
}
|
||||
|
||||
public class Lineups
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
public string serverID { get; set; }
|
||||
|
||||
public string datetime { get; set; }
|
||||
|
||||
public List<Lineup> lineups { get; set; }
|
||||
}
|
||||
|
||||
@@ -957,8 +973,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class Headends
|
||||
{
|
||||
public string headend { get; set; }
|
||||
|
||||
public string transport { get; set; }
|
||||
|
||||
public string location { get; set; }
|
||||
|
||||
public List<Lineup> lineups { get; set; }
|
||||
}
|
||||
|
||||
@@ -967,59 +986,83 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class Map
|
||||
{
|
||||
public string stationID { get; set; }
|
||||
|
||||
public string channel { get; set; }
|
||||
|
||||
public string logicalChannelNumber { get; set; }
|
||||
|
||||
public int uhfVhf { get; set; }
|
||||
|
||||
public int atscMajor { get; set; }
|
||||
|
||||
public int atscMinor { get; set; }
|
||||
}
|
||||
|
||||
public class Broadcaster
|
||||
{
|
||||
public string city { get; set; }
|
||||
|
||||
public string state { get; set; }
|
||||
|
||||
public string postalcode { get; set; }
|
||||
|
||||
public string country { get; set; }
|
||||
}
|
||||
|
||||
public class Logo
|
||||
{
|
||||
public string URL { get; set; }
|
||||
|
||||
public int height { get; set; }
|
||||
|
||||
public int width { get; set; }
|
||||
|
||||
public string md5 { get; set; }
|
||||
}
|
||||
|
||||
public class Station
|
||||
{
|
||||
public string stationID { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
|
||||
public string callsign { get; set; }
|
||||
|
||||
public List<string> broadcastLanguage { get; set; }
|
||||
|
||||
public List<string> descriptionLanguage { get; set; }
|
||||
|
||||
public Broadcaster broadcaster { get; set; }
|
||||
|
||||
public string affiliate { get; set; }
|
||||
|
||||
public Logo logo { get; set; }
|
||||
|
||||
public bool? isCommercialFree { get; set; }
|
||||
}
|
||||
|
||||
public class Metadata
|
||||
{
|
||||
public string lineup { get; set; }
|
||||
|
||||
public string modified { get; set; }
|
||||
|
||||
public string transport { get; set; }
|
||||
}
|
||||
|
||||
public class Channel
|
||||
{
|
||||
public List<Map> map { get; set; }
|
||||
|
||||
public List<Station> stations { get; set; }
|
||||
|
||||
public Metadata metadata { get; set; }
|
||||
}
|
||||
|
||||
public class RequestScheduleForChannel
|
||||
{
|
||||
public string stationID { get; set; }
|
||||
|
||||
public List<string> date { get; set; }
|
||||
}
|
||||
|
||||
@@ -1029,29 +1072,43 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class Rating
|
||||
{
|
||||
public string body { get; set; }
|
||||
|
||||
public string code { get; set; }
|
||||
}
|
||||
|
||||
public class Multipart
|
||||
{
|
||||
public int partNumber { get; set; }
|
||||
|
||||
public int totalParts { get; set; }
|
||||
}
|
||||
|
||||
public class Program
|
||||
{
|
||||
public string programID { get; set; }
|
||||
|
||||
public string airDateTime { get; set; }
|
||||
|
||||
public int duration { get; set; }
|
||||
|
||||
public string md5 { get; set; }
|
||||
|
||||
public List<string> audioProperties { get; set; }
|
||||
|
||||
public List<string> videoProperties { get; set; }
|
||||
|
||||
public List<Rating> ratings { get; set; }
|
||||
|
||||
public bool? @new { get; set; }
|
||||
|
||||
public Multipart multipart { get; set; }
|
||||
|
||||
public string liveTapeDelay { get; set; }
|
||||
|
||||
public bool premiere { get; set; }
|
||||
|
||||
public bool repeat { get; set; }
|
||||
|
||||
public string isPremiereOrFinale { get; set; }
|
||||
}
|
||||
|
||||
@@ -1060,16 +1117,22 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class MetadataSchedule
|
||||
{
|
||||
public string modified { get; set; }
|
||||
|
||||
public string md5 { get; set; }
|
||||
|
||||
public string startDate { get; set; }
|
||||
|
||||
public string endDate { get; set; }
|
||||
|
||||
public int days { get; set; }
|
||||
}
|
||||
|
||||
public class Day
|
||||
{
|
||||
public string stationID { get; set; }
|
||||
|
||||
public List<Program> programs { get; set; }
|
||||
|
||||
public MetadataSchedule metadata { get; set; }
|
||||
|
||||
public Day()
|
||||
@@ -1092,24 +1155,28 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class Description100
|
||||
{
|
||||
public string descriptionLanguage { get; set; }
|
||||
|
||||
public string description { get; set; }
|
||||
}
|
||||
|
||||
public class Description1000
|
||||
{
|
||||
public string descriptionLanguage { get; set; }
|
||||
|
||||
public string description { get; set; }
|
||||
}
|
||||
|
||||
public class DescriptionsProgram
|
||||
{
|
||||
public List<Description100> description100 { get; set; }
|
||||
|
||||
public List<Description1000> description1000 { get; set; }
|
||||
}
|
||||
|
||||
public class Gracenote
|
||||
{
|
||||
public int season { get; set; }
|
||||
|
||||
public int episode { get; set; }
|
||||
}
|
||||
|
||||
@@ -1121,104 +1188,154 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
public class ContentRating
|
||||
{
|
||||
public string body { get; set; }
|
||||
|
||||
public string code { get; set; }
|
||||
}
|
||||
|
||||
public class Cast
|
||||
{
|
||||
public string billingOrder { get; set; }
|
||||
|
||||
public string role { get; set; }
|
||||
|
||||
public string nameId { get; set; }
|
||||
|
||||
public string personId { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
|
||||
public string characterName { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public string billingOrder { get; set; }
|
||||
|
||||
public string role { get; set; }
|
||||
|
||||
public string nameId { get; set; }
|
||||
|
||||
public string personId { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class QualityRating
|
||||
{
|
||||
public string ratingsBody { get; set; }
|
||||
|
||||
public string rating { get; set; }
|
||||
|
||||
public string minRating { get; set; }
|
||||
|
||||
public string maxRating { get; set; }
|
||||
|
||||
public string increment { get; set; }
|
||||
}
|
||||
|
||||
public class Movie
|
||||
{
|
||||
public string year { get; set; }
|
||||
|
||||
public int duration { get; set; }
|
||||
|
||||
public List<QualityRating> qualityRating { get; set; }
|
||||
}
|
||||
|
||||
public class Recommendation
|
||||
{
|
||||
public string programID { get; set; }
|
||||
|
||||
public string title120 { get; set; }
|
||||
}
|
||||
|
||||
public class ProgramDetails
|
||||
{
|
||||
public string audience { get; set; }
|
||||
|
||||
public string programID { get; set; }
|
||||
|
||||
public List<Title> titles { get; set; }
|
||||
|
||||
public EventDetails eventDetails { get; set; }
|
||||
|
||||
public DescriptionsProgram descriptions { get; set; }
|
||||
|
||||
public string originalAirDate { get; set; }
|
||||
|
||||
public List<string> genres { get; set; }
|
||||
|
||||
public string episodeTitle150 { get; set; }
|
||||
|
||||
public List<MetadataPrograms> metadata { get; set; }
|
||||
|
||||
public List<ContentRating> contentRating { get; set; }
|
||||
|
||||
public List<Cast> cast { get; set; }
|
||||
|
||||
public List<Crew> crew { get; set; }
|
||||
|
||||
public string entityType { get; set; }
|
||||
|
||||
public string showType { get; set; }
|
||||
|
||||
public bool hasImageArtwork { get; set; }
|
||||
|
||||
public string primaryImage { get; set; }
|
||||
|
||||
public string thumbImage { get; set; }
|
||||
|
||||
public string backdropImage { get; set; }
|
||||
|
||||
public string bannerImage { get; set; }
|
||||
|
||||
public string imageID { get; set; }
|
||||
|
||||
public string md5 { get; set; }
|
||||
|
||||
public List<string> contentAdvisory { get; set; }
|
||||
|
||||
public Movie movie { get; set; }
|
||||
|
||||
public List<Recommendation> recommendations { get; set; }
|
||||
}
|
||||
|
||||
public class Caption
|
||||
{
|
||||
public string content { get; set; }
|
||||
|
||||
public string lang { get; set; }
|
||||
}
|
||||
|
||||
public class ImageData
|
||||
{
|
||||
public string width { get; set; }
|
||||
|
||||
public string height { get; set; }
|
||||
|
||||
public string uri { get; set; }
|
||||
|
||||
public string size { get; set; }
|
||||
|
||||
public string aspect { get; set; }
|
||||
|
||||
public string category { get; set; }
|
||||
|
||||
public string text { get; set; }
|
||||
|
||||
public string primary { get; set; }
|
||||
|
||||
public string tier { get; set; }
|
||||
|
||||
public Caption caption { get; set; }
|
||||
}
|
||||
|
||||
public class ShowImages
|
||||
{
|
||||
public string programID { get; set; }
|
||||
|
||||
public List<ImageData> data { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<XmlTvListingsProvider> _logger;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IZipClient _zipClient;
|
||||
|
||||
@@ -224,6 +224,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
uniqueString = "-" + programInfo.SeasonNumber.Value.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (programInfo.EpisodeNumber.HasValue)
|
||||
{
|
||||
uniqueString = "-" + programInfo.EpisodeNumber.Value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
private const string ServiceName = "Emby";
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LiveTvDtoService> _logger;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IApplicationHost _appHost;
|
||||
|
||||
@@ -7,6 +7,8 @@ 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;
|
||||
using MediaBrowser.Common.Progress;
|
||||
@@ -14,8 +16,6 @@ using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
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;
|
||||
@@ -31,6 +31,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
|
||||
{
|
||||
@@ -44,7 +46,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
private const string EtagKey = "ProgramEtag";
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LiveTvManager> _logger;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
@@ -404,8 +406,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
if (!(service is EmbyTV.EmbyTV))
|
||||
{
|
||||
// We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says
|
||||
//mediaSource.SupportsDirectPlay = false;
|
||||
//mediaSource.SupportsDirectStream = false;
|
||||
// mediaSource.SupportsDirectPlay = false;
|
||||
// mediaSource.SupportsDirectStream = false;
|
||||
mediaSource.SupportsTranscoding = true;
|
||||
foreach (var stream in mediaSource.MediaStreams)
|
||||
{
|
||||
@@ -554,9 +556,10 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
item.ParentId = channel.Id;
|
||||
|
||||
//item.ChannelType = channelType;
|
||||
// item.ChannelType = channelType;
|
||||
|
||||
item.Audio = info.Audio;
|
||||
item.ChannelId = channel.Id;
|
||||
@@ -573,6 +576,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
item.ExternalSeriesId = seriesId;
|
||||
|
||||
var isSeries = info.IsSeries || !string.IsNullOrEmpty(info.EpisodeTitle);
|
||||
@@ -587,30 +591,37 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
tags.Add("Live");
|
||||
}
|
||||
|
||||
if (info.IsPremiere)
|
||||
{
|
||||
tags.Add("Premiere");
|
||||
}
|
||||
|
||||
if (info.IsNews)
|
||||
{
|
||||
tags.Add("News");
|
||||
}
|
||||
|
||||
if (info.IsSports)
|
||||
{
|
||||
tags.Add("Sports");
|
||||
}
|
||||
|
||||
if (info.IsKids)
|
||||
{
|
||||
tags.Add("Kids");
|
||||
}
|
||||
|
||||
if (info.IsRepeat)
|
||||
{
|
||||
tags.Add("Repeat");
|
||||
}
|
||||
|
||||
if (info.IsMovie)
|
||||
{
|
||||
tags.Add("Movie");
|
||||
}
|
||||
|
||||
if (isSeries)
|
||||
{
|
||||
tags.Add("Series");
|
||||
@@ -633,6 +644,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
item.IsSeries = isSeries;
|
||||
|
||||
item.Name = info.Name;
|
||||
@@ -650,12 +662,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
item.StartDate = info.StartDate;
|
||||
|
||||
if (item.EndDate != info.EndDate)
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
|
||||
item.EndDate = info.EndDate;
|
||||
|
||||
item.ProductionYear = info.ProductionYear;
|
||||
@@ -696,7 +710,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
Path = info.ThumbImageUrl,
|
||||
Type = ImageType.Thumb
|
||||
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
@@ -709,7 +722,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
Path = info.LogoImageUrl,
|
||||
Type = ImageType.Logo
|
||||
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
@@ -722,7 +734,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
Path = info.BackdropImageUrl,
|
||||
Type = ImageType.Backdrop
|
||||
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
@@ -760,7 +771,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
||||
|
||||
var list = new List<Tuple<BaseItemDto, string, string>>() {
|
||||
var list = new List<Tuple<BaseItemDto, string, string>>
|
||||
{
|
||||
new Tuple<BaseItemDto, string, string>(dto, program.ExternalId, program.ExternalSeriesId)
|
||||
};
|
||||
|
||||
@@ -1168,7 +1180,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
|
||||
ChannelIds = new Guid[] { currentChannel.Id },
|
||||
DtoOptions = new DtoOptions(true)
|
||||
|
||||
}).Cast<LiveTvProgram>().ToDictionary(i => i.Id);
|
||||
|
||||
var newPrograms = new List<LiveTvProgram>();
|
||||
@@ -1368,10 +1379,10 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
// limit = (query.Limit ?? 10) * 2;
|
||||
limit = null;
|
||||
|
||||
//var allActivePaths = EmbyTV.EmbyTV.Current.GetAllActiveRecordings().Select(i => i.Path).ToArray();
|
||||
//var items = allActivePaths.Select(i => _libraryManager.FindByPath(i, false)).Where(i => i != null).ToArray();
|
||||
// var allActivePaths = EmbyTV.EmbyTV.Current.GetAllActiveRecordings().Select(i => i.Path).ToArray();
|
||||
// var items = allActivePaths.Select(i => _libraryManager.FindByPath(i, false)).Where(i => i != null).ToArray();
|
||||
|
||||
//return new QueryResult<BaseItem>
|
||||
// return new QueryResult<BaseItem>
|
||||
//{
|
||||
// Items = items,
|
||||
// TotalRecordCount = items.Length
|
||||
@@ -1738,7 +1749,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var results = await GetTimers(new TimerQuery
|
||||
{
|
||||
Id = id
|
||||
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||
@@ -1790,7 +1800,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
.Select(i =>
|
||||
{
|
||||
return i.Item1;
|
||||
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
@@ -1845,7 +1854,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
|
||||
return _tvDtoService.GetSeriesTimerInfoDto(i.Item1, i.Item2, channelName);
|
||||
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
@@ -1878,7 +1886,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) },
|
||||
TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Id },
|
||||
DtoOptions = options
|
||||
|
||||
}) : new List<BaseItem>();
|
||||
|
||||
RemoveFields(options);
|
||||
@@ -1956,7 +1963,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
OriginalAirDate = program.PremiereDate,
|
||||
Overview = program.Overview,
|
||||
StartDate = program.StartDate,
|
||||
//ImagePath = program.ExternalImagePath,
|
||||
// ImagePath = program.ExternalImagePath,
|
||||
Name = program.Name,
|
||||
OfficialRating = program.OfficialRating
|
||||
};
|
||||
@@ -2167,20 +2174,19 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var info = new LiveTvInfo
|
||||
{
|
||||
Services = services,
|
||||
IsEnabled = services.Length > 0
|
||||
IsEnabled = services.Length > 0,
|
||||
EnabledUsers = _userManager.Users
|
||||
.Where(IsLiveTvEnabled)
|
||||
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
|
||||
.ToArray()
|
||||
};
|
||||
|
||||
info.EnabledUsers = _userManager.Users
|
||||
.Where(IsLiveTvEnabled)
|
||||
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
|
||||
.ToArray();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private bool IsLiveTvEnabled(User user)
|
||||
{
|
||||
return user.Policy.EnableLiveTvAccess && (Services.Count > 1 || GetConfiguration().TunerHosts.Length > 0);
|
||||
return user.HasPermission(PermissionKind.EnableLiveTvAccess) && (Services.Count > 1 || GetConfiguration().TunerHosts.Length > 0);
|
||||
}
|
||||
|
||||
public IEnumerable<User> GetEnabledUsers()
|
||||
@@ -2457,7 +2463,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
UserId = user.Id,
|
||||
IsRecordingsFolder = true,
|
||||
RefreshLatestChannelItems = refreshChannels
|
||||
|
||||
}).Items);
|
||||
|
||||
return folders.Cast<BaseItem>().ToList();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
private const string StreamIdDelimeterString = "_";
|
||||
|
||||
private readonly ILiveTvManager _liveTvManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LiveTvMediaSourceProvider> _logger;
|
||||
private readonly IMediaSourceManager _mediaSourceManager;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the triggers that define when the task will run
|
||||
/// Creates the triggers that define when the task will run.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
|
||||
@@ -22,14 +22,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
public abstract class BaseTunerHost
|
||||
{
|
||||
protected readonly IServerConfigurationManager Config;
|
||||
protected readonly ILogger Logger;
|
||||
protected readonly ILogger<BaseTunerHost> Logger;
|
||||
protected IJsonSerializer JsonSerializer;
|
||||
protected readonly IFileSystem FileSystem;
|
||||
|
||||
private readonly ConcurrentDictionary<string, ChannelCache> _channelCache =
|
||||
new ConcurrentDictionary<string, ChannelCache>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
protected BaseTunerHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem)
|
||||
protected BaseTunerHost(IServerConfigurationManager config, ILogger<BaseTunerHost> logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem)
|
||||
{
|
||||
Config = config;
|
||||
Logger = logger;
|
||||
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
var result = await GetChannelsInternal(tuner, cancellationToken).ConfigureAwait(false);
|
||||
var list = result.ToList();
|
||||
//logger.LogInformation("Channels from {0}: {1}", tuner.Url, JsonSerializer.SerializeToString(list));
|
||||
// logger.LogInformation("Channels from {0}: {1}", tuner.Url, JsonSerializer.SerializeToString(list));
|
||||
|
||||
if (!string.IsNullOrEmpty(key) && list.Count > 0)
|
||||
{
|
||||
@@ -99,7 +99,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +115,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
ChannelType = ChannelType.TV,
|
||||
IsLegacyTuner = (i.URL ?? string.Empty).StartsWith("hdhomerun", StringComparison.OrdinalIgnoreCase),
|
||||
Path = i.URL
|
||||
|
||||
}).Cast<ChannelInfo>().ToList();
|
||||
}
|
||||
|
||||
@@ -171,6 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
_modelCache[cacheKey] = response;
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var name = line.Substring(0, index - 1);
|
||||
var currentChannel = line.Substring(index + 7);
|
||||
if (currentChannel != "none") { status = LiveTvTunerStatus.LiveTv; } else { status = LiveTvTunerStatus.Available; }
|
||||
|
||||
tuners.Add(new LiveTvTunerInfo
|
||||
{
|
||||
Name = name,
|
||||
@@ -230,11 +231,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
inside = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (let == '>')
|
||||
{
|
||||
inside = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!inside)
|
||||
{
|
||||
buffer[bufferIndex] = let;
|
||||
@@ -332,12 +335,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
private class Channels
|
||||
{
|
||||
public string GuideNumber { get; set; }
|
||||
|
||||
public string GuideName { get; set; }
|
||||
|
||||
public string VideoCodec { get; set; }
|
||||
|
||||
public string AudioCodec { get; set; }
|
||||
|
||||
public string URL { get; set; }
|
||||
|
||||
public bool Favorite { get; set; }
|
||||
|
||||
public bool DRM { get; set; }
|
||||
|
||||
public int HD { get; set; }
|
||||
}
|
||||
|
||||
@@ -481,7 +491,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
Height = height,
|
||||
BitRate = videoBitrate,
|
||||
NalLengthSize = nal
|
||||
|
||||
},
|
||||
new MediaStream
|
||||
{
|
||||
@@ -502,8 +511,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
SupportsTranscoding = true,
|
||||
IsInfiniteStream = true,
|
||||
IgnoreDts = true,
|
||||
//IgnoreIndex = true,
|
||||
//ReadAtNativeFramerate = true
|
||||
// IgnoreIndex = true,
|
||||
// ReadAtNativeFramerate = true
|
||||
};
|
||||
|
||||
mediaSource.InferTotalBitrate();
|
||||
@@ -659,13 +668,21 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
public class DiscoverResponse
|
||||
{
|
||||
public string FriendlyName { get; set; }
|
||||
|
||||
public string ModelNumber { get; set; }
|
||||
|
||||
public string FirmwareName { get; set; }
|
||||
|
||||
public string FirmwareVersion { get; set; }
|
||||
|
||||
public string DeviceID { get; set; }
|
||||
|
||||
public string DeviceAuth { get; set; }
|
||||
|
||||
public string BaseURL { get; set; }
|
||||
|
||||
public string LineupURL { get; set; }
|
||||
|
||||
public int TunerCount { get; set; }
|
||||
|
||||
public bool SupportsTranscoding
|
||||
@@ -722,7 +739,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
||||
@@ -117,17 +117,17 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
taskCompletionSource,
|
||||
LiveStreamCancellationTokenSource.Token).ConfigureAwait(false);
|
||||
|
||||
//OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
//OpenedMediaSource.Path = tempFile;
|
||||
//OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
// OpenedMediaSource.Path = tempFile;
|
||||
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||
|
||||
MediaSource.Path = _appHost.GetLoopbackHttpApiUrl() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
||||
MediaSource.Protocol = MediaProtocol.Http;
|
||||
//OpenedMediaSource.SupportsDirectPlay = false;
|
||||
//OpenedMediaSource.SupportsDirectStream = true;
|
||||
//OpenedMediaSource.SupportsTranscoding = true;
|
||||
// OpenedMediaSource.SupportsDirectPlay = false;
|
||||
// OpenedMediaSource.SupportsDirectStream = true;
|
||||
// OpenedMediaSource.SupportsTranscoding = true;
|
||||
|
||||
//await Task.Delay(5000).ConfigureAwait(false);
|
||||
// await Task.Delay(5000).ConfigureAwait(false);
|
||||
await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,15 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
protected virtual int EmptyReadLimit => 1000;
|
||||
|
||||
public MediaSourceInfo OriginalMediaSource { get; set; }
|
||||
|
||||
public MediaSourceInfo MediaSource { get; set; }
|
||||
|
||||
public int ConsumerCount { get; set; }
|
||||
|
||||
public string OriginalStreamId { get; set; }
|
||||
|
||||
public bool EnableStreamSharing { get; set; }
|
||||
|
||||
public string UniqueId { get; }
|
||||
|
||||
public string TunerHostId { get; }
|
||||
@@ -220,11 +223,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
using (var stream = await new M3uParser(Logger, _httpClient, _appHost).GetListingsStream(info.Url, CancellationToken.None).ConfigureAwait(false))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!IsValidChannelNumber(numberString))
|
||||
@@ -284,7 +283,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
|
||||
{
|
||||
//channel.Number = number.ToString();
|
||||
// channel.Number = number.ToString();
|
||||
nameInExtInf = nameInExtInf.Substring(numberIndex + 1).Trim(new[] { ' ', '-' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,21 +103,21 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
_ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
|
||||
|
||||
//OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
//OpenedMediaSource.Path = tempFile;
|
||||
//OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
// OpenedMediaSource.Path = tempFile;
|
||||
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||
|
||||
MediaSource.Path = _appHost.GetLoopbackHttpApiUrl() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
||||
MediaSource.Protocol = MediaProtocol.Http;
|
||||
|
||||
//OpenedMediaSource.Path = TempFilePath;
|
||||
//OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
// OpenedMediaSource.Path = TempFilePath;
|
||||
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
|
||||
//OpenedMediaSource.Path = _tempFilePath;
|
||||
//OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
//OpenedMediaSource.SupportsDirectPlay = false;
|
||||
//OpenedMediaSource.SupportsDirectStream = true;
|
||||
//OpenedMediaSource.SupportsTranscoding = true;
|
||||
// OpenedMediaSource.Path = _tempFilePath;
|
||||
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
// OpenedMediaSource.SupportsDirectPlay = false;
|
||||
// OpenedMediaSource.SupportsDirectStream = true;
|
||||
// OpenedMediaSource.SupportsTranscoding = true;
|
||||
await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
if (taskCompletionSource.Task.Exception != null)
|
||||
{
|
||||
|
||||
@@ -62,13 +62,13 @@
|
||||
"NotificationOptionPluginInstalled": "প্লাগিন ইন্সটল করা হয়েছে",
|
||||
"NotificationOptionPluginError": "প্লাগিন ব্যর্থ",
|
||||
"NotificationOptionNewLibraryContent": "নতুন কন্টেন্ট যোগ করা হয়েছে",
|
||||
"NotificationOptionInstallationFailed": "ইন্সটল ব্যর্থ",
|
||||
"NotificationOptionInstallationFailed": "ইন্সটল ব্যর্থ হয়েছে",
|
||||
"NotificationOptionCameraImageUploaded": "ক্যামেরার ছবি আপলোড হয়েছে",
|
||||
"NotificationOptionAudioPlaybackStopped": "গান বাজা বন্ধ হয়েছে",
|
||||
"NotificationOptionAudioPlayback": "গান বাজা শুরু হয়েছে",
|
||||
"NotificationOptionApplicationUpdateInstalled": "এপ্লিকেশনের আপডেট ইনস্টল করা হয়েছে",
|
||||
"NotificationOptionApplicationUpdateAvailable": "এপ্লিকেশনের আপডেট রয়েছে",
|
||||
"NewVersionIsAvailable": "জেলিফিন সার্ভারের একটি নতুন ভার্শন ডাউনলোডের জন্য তৈরী",
|
||||
"NewVersionIsAvailable": "জেলিফিন সার্ভারের একটি নতুন ভার্শন ডাউনলোডের জন্য তৈরী।",
|
||||
"NameSeasonUnknown": "সিজন অজানা",
|
||||
"NameSeasonNumber": "সিজন {0}",
|
||||
"NameInstallFailed": "{0} ইন্সটল ব্যর্থ",
|
||||
@@ -100,5 +100,18 @@
|
||||
"TaskCleanCacheDescription": "সিস্টেমে আর প্রয়োজন নেই ক্যাশ, ফাইলগুলি মুছে ফেলুন।",
|
||||
"TaskCleanCache": "ক্লিন ক্যাশ ডিরেক্টরি",
|
||||
"TasksChannelsCategory": "ইন্টারনেট চ্যানেল",
|
||||
"TasksApplicationCategory": "আবেদন"
|
||||
"TasksApplicationCategory": "আবেদন",
|
||||
"TaskDownloadMissingSubtitlesDescription": "মেটাডেটা কনফিগারেশনের উপর ভিত্তি করে অনুপস্থিত সাবটাইটেলগুলির জন্য ইন্টারনেট অনুসন্ধান করে।",
|
||||
"TaskDownloadMissingSubtitles": "অনুপস্থিত সাবটাইটেলগুলি ডাউনলোড করুন",
|
||||
"TaskRefreshChannelsDescription": "ইন্টারনেট চ্যানেল তথ্য রিফ্রেশ করুন।",
|
||||
"TaskRefreshChannels": "চ্যানেল রিফ্রেশ করুন",
|
||||
"TaskCleanTranscodeDescription": "এক দিনেরও বেশি পুরানো ট্রান্সকোড ফাইলগুলি মুছে ফেলুন।",
|
||||
"TaskCleanTranscode": "ট্রান্সকোড ডিরেক্টরি ক্লিন করুন",
|
||||
"TaskUpdatePluginsDescription": "স্বয়ংক্রিয়ভাবে আপডেট কনফিগার করা প্লাগইনগুলির জন্য আপডেট ডাউনলোড এবং ইনস্টল করুন।",
|
||||
"TaskUpdatePlugins": "প্লাগইন আপডেট করুন",
|
||||
"TaskRefreshPeopleDescription": "আপনার মিডিয়া লাইব্রেরিতে অভিনেতা এবং পরিচালকদের জন্য মেটাডাটা আপডেট করুন।",
|
||||
"TaskRefreshPeople": "পিপল রিফ্রেশ করুন",
|
||||
"TaskCleanLogsDescription": "{0} দিনের বেশী পুরানো লগ ফাইলগুলি মুছে ফেলুন।",
|
||||
"TaskCleanLogs": "লগ ডিরেক্টরি ক্লিন করুন",
|
||||
"TaskRefreshLibraryDescription": "নতুন ফাইলের জন্য মিডিয়া লাইব্রেরি স্ক্যান এবং মেটাডাটা রিফ্রেশ করুন।"
|
||||
}
|
||||
|
||||
@@ -109,9 +109,10 @@
|
||||
"TaskCleanLogs": "Nettoyer le répertoire des journaux",
|
||||
"TaskRefreshLibraryDescription": "Analyse votre bibliothèque média pour trouver de nouveaux fichiers et rafraîchit les métadonnées.",
|
||||
"TaskRefreshChapterImages": "Extraire les images de chapitre",
|
||||
"TaskRefreshChapterImagesDescription": "Créer des vignettes pour les vidéos qui ont des chapitres",
|
||||
"TaskRefreshChapterImagesDescription": "Créer des vignettes pour les vidéos qui ont des chapitres.",
|
||||
"TaskRefreshLibrary": "Analyser la bibliothèque de médias",
|
||||
"TaskCleanCache": "Nettoyer le répertoire des fichiers temporaires",
|
||||
"TasksApplicationCategory": "Application",
|
||||
"TaskCleanCacheDescription": "Supprime les fichiers temporaires qui ne sont plus nécessaire pour le système."
|
||||
"TaskCleanCacheDescription": "Supprime les fichiers temporaires qui ne sont plus nécessaire pour le système.",
|
||||
"TasksChannelsCategory": "Canaux Internet"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"Albums": "專輯",
|
||||
"AppDeviceValues": "軟件: {0}, 設備: {1}",
|
||||
"AppDeviceValues": "程式: {0}, 設備: {1}",
|
||||
"Application": "應用程式",
|
||||
"Artists": "藝人",
|
||||
"AuthenticationSucceededWithUserName": "{0} 授權成功",
|
||||
@@ -113,5 +113,6 @@
|
||||
"TaskCleanCacheDescription": "刪除系統不再需要的緩存文件。",
|
||||
"TaskCleanCache": "清理緩存目錄",
|
||||
"TasksChannelsCategory": "互聯網頻道",
|
||||
"TasksLibraryCategory": "庫"
|
||||
"TasksLibraryCategory": "庫",
|
||||
"TaskRefreshPeople": "刷新人物"
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Emby.Server.Implementations.Localization
|
||||
|
||||
private readonly IServerConfigurationManager _configurationManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<LocalizationManager> _logger;
|
||||
|
||||
private readonly Dictionary<string, Dictionary<string, ParentalRating>> _allParentalRatings =
|
||||
new Dictionary<string, Dictionary<string, ParentalRating>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||
{
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<EncodingManager> _logger;
|
||||
private readonly IMediaEncoder _encoder;
|
||||
private readonly IChapterManager _chapterManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
@@ -98,7 +98,6 @@ namespace Emby.Server.Implementations.Net
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
@@ -109,12 +108,11 @@ namespace Emby.Server.Implementations.Net
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
||||
// retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
||||
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, multicastTimeToLive);
|
||||
|
||||
var localIp = IPAddress.Any;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
{
|
||||
public class NetworkManager : INetworkManager
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<NetworkManager> _logger;
|
||||
|
||||
private IPAddress[] _localIpAddresses;
|
||||
private readonly object _localIpAddressSyncLock = new object();
|
||||
@@ -167,7 +167,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
|
||||
foreach (var subnet_Match in subnets)
|
||||
{
|
||||
//logger.LogDebug("subnet_Match:" + subnet_Match);
|
||||
// logger.LogDebug("subnet_Match:" + subnet_Match);
|
||||
|
||||
if (endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -411,7 +411,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random port number that is currently available
|
||||
/// Gets a random port number that is currently available.
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int GetRandomUnusedTcpPort()
|
||||
|
||||
@@ -3,6 +3,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;
|
||||
@@ -44,7 +45,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
}
|
||||
|
||||
query.Recursive = true;
|
||||
query.IncludeItemTypes = new string[] { "Playlist" };
|
||||
query.IncludeItemTypes = new[] { "Playlist" };
|
||||
query.Parent = null;
|
||||
return LibraryManager.GetItemsResult(query);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,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;
|
||||
@@ -21,6 +22,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
|
||||
{
|
||||
@@ -29,7 +32,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILibraryMonitor _iLibraryMonitor;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<PlaylistManager> _logger;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly IConfiguration _appConfig;
|
||||
@@ -398,6 +401,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
{
|
||||
entry.Duration = TimeSpan.FromTicks(child.RunTimeTicks.Value);
|
||||
}
|
||||
|
||||
playlist.PlaylistEntries.Add(entry);
|
||||
}
|
||||
|
||||
@@ -463,7 +467,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
playlist.PlaylistEntries.Add(entry);
|
||||
}
|
||||
|
||||
string text = new M3u8Content().ToText(playlist);
|
||||
string text = new M3uContent().ToText(playlist);
|
||||
File.WriteAllText(playlistPath, text);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations
|
||||
public class ResourceFileManager : IResourceFileManager
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ResourceFileManager> _logger;
|
||||
|
||||
public ResourceFileManager(ILogger<ResourceFileManager> logger, IFileSystem fileSystem)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ using Microsoft.Extensions.Logging;
|
||||
namespace Emby.Server.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ScheduledTaskWorker
|
||||
/// Class ScheduledTaskWorker.
|
||||
/// </summary>
|
||||
public class ScheduledTaskWorker : IScheduledTaskWorker
|
||||
{
|
||||
@@ -111,11 +111,11 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
|
||||
private bool _readFromFile = false;
|
||||
/// <summary>
|
||||
/// The _last execution result
|
||||
/// The _last execution result.
|
||||
/// </summary>
|
||||
private TaskResult _lastExecutionResult;
|
||||
/// <summary>
|
||||
/// The _last execution result sync lock
|
||||
/// The _last execution result sync lock.
|
||||
/// </summary>
|
||||
private readonly object _lastExecutionResultSyncLock = new object();
|
||||
/// <summary>
|
||||
@@ -143,12 +143,14 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
Logger.LogError(ex, "Error deserializing {File}", path);
|
||||
}
|
||||
}
|
||||
|
||||
_readFromFile = true;
|
||||
}
|
||||
}
|
||||
|
||||
return _lastExecutionResult;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
_lastExecutionResult = value;
|
||||
@@ -182,7 +184,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
public string Category => ScheduledTask.Category;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current cancellation token
|
||||
/// Gets the current cancellation token.
|
||||
/// </summary>
|
||||
/// <value>The current cancellation token source.</value>
|
||||
private CancellationTokenSource CurrentCancellationTokenSource { get; set; }
|
||||
@@ -261,6 +263,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
var triggers = InternalTriggers;
|
||||
return triggers.Select(i => i.Item1).ToArray();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
@@ -278,7 +281,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _id
|
||||
/// The _id.
|
||||
/// </summary>
|
||||
private string _id;
|
||||
|
||||
@@ -358,7 +361,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
private Task _currentTask;
|
||||
|
||||
/// <summary>
|
||||
/// Executes the task
|
||||
/// Executes the task.
|
||||
/// </summary>
|
||||
/// <param name="options">Task options.</param>
|
||||
/// <returns>Task.</returns>
|
||||
@@ -453,7 +456,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the task if it is currently executing
|
||||
/// Stops the task if it is currently executing.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
||||
public void Cancel()
|
||||
@@ -640,6 +643,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
Logger.LogError(ex, "Error calling CancellationToken.Cancel();");
|
||||
}
|
||||
}
|
||||
|
||||
var task = _currentTask;
|
||||
if (task != null)
|
||||
{
|
||||
@@ -675,6 +679,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
Logger.LogError(ex, "Error calling CancellationToken.Dispose();");
|
||||
}
|
||||
}
|
||||
|
||||
if (wassRunning)
|
||||
{
|
||||
OnTaskCompleted(startTime, DateTime.UtcNow, TaskCompletionStatus.Aborted, null);
|
||||
@@ -683,7 +688,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
|
||||
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger.
|
||||
/// </summary>
|
||||
/// <param name="info">The info.</param>
|
||||
/// <returns>BaseTaskTrigger.</returns>
|
||||
@@ -753,7 +758,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes each trigger
|
||||
/// Disposes each trigger.
|
||||
/// </summary>
|
||||
private void DisposeTriggers()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Logging;
|
||||
namespace Emby.Server.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TaskManager
|
||||
/// Class TaskManager.
|
||||
/// </summary>
|
||||
public class TaskManager : ITaskManager
|
||||
{
|
||||
@@ -23,20 +23,20 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
public event EventHandler<TaskCompletionEventArgs> TaskCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of Scheduled Tasks
|
||||
/// Gets the list of Scheduled Tasks.
|
||||
/// </summary>
|
||||
/// <value>The scheduled tasks.</value>
|
||||
public IScheduledTaskWorker[] ScheduledTasks { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The _task queue
|
||||
/// The _task queue.
|
||||
/// </summary>
|
||||
private readonly ConcurrentQueue<Tuple<Type, TaskOptions>> _taskQueue =
|
||||
new ConcurrentQueue<Tuple<Type, TaskOptions>>();
|
||||
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IApplicationPaths _applicationPaths;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<TaskManager> _logger;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancels if running
|
||||
/// Cancels if running.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public void CancelIfRunning<T>()
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// <summary>
|
||||
/// The _logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ChapterImagesTask> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The _library manager.
|
||||
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
IFileSystem fileSystem,
|
||||
ILocalizationManager localization)
|
||||
{
|
||||
_logger = loggerFactory.CreateLogger(GetType().Name);
|
||||
_logger = loggerFactory.CreateLogger<ChapterImagesTask>();
|
||||
_libraryManager = libraryManager;
|
||||
_itemRepo = itemRepo;
|
||||
_appPaths = appPaths;
|
||||
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
//TODO Investigate and properly fix.
|
||||
// TODO Investigate and properly fix.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user