mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 22:08:27 +01:00
remove async when there's nothing to await
This commit is contained in:
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
// Don't report theme song or local trailer playback
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Users.Count == 0)
|
||||
{
|
||||
@@ -160,8 +160,8 @@ namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
// Don't report theme song or local trailer playback
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (e.Users.Count == 0)
|
||||
{
|
||||
return;
|
||||
@@ -416,7 +416,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var time = result.EndTimeUtc - result.StartTimeUtc;
|
||||
var runningTime = string.Format(_localization.GetLocalizedString("LabelRunningTimeValue"), ToUserFriendlyString(time));
|
||||
|
||||
@@ -444,11 +444,11 @@ namespace Emby.Server.Implementations.Activity
|
||||
}
|
||||
}
|
||||
|
||||
private async void CreateLogEntry(ActivityLogEntry entry)
|
||||
private void CreateLogEntry(ActivityLogEntry entry)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _activityManager.Create(entry).ConfigureAwait(false);
|
||||
_activityManager.Create(entry);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
public class ActivityManager : IActivityManager
|
||||
{
|
||||
public event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
|
||||
|
||||
|
||||
private readonly IActivityRepository _repo;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserManager _userManager;
|
||||
@@ -25,12 +25,12 @@ namespace Emby.Server.Implementations.Activity
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
public async Task Create(ActivityLogEntry entry)
|
||||
public void Create(ActivityLogEntry entry)
|
||||
{
|
||||
entry.Id = Guid.NewGuid().ToString("N");
|
||||
entry.Date = DateTime.UtcNow;
|
||||
|
||||
await _repo.Create(entry).ConfigureAwait(false);
|
||||
_repo.Create(entry);
|
||||
|
||||
EventHelper.FireEventIfNotNull(EntryCreated, this, new GenericEventArgs<ActivityLogEntry>(entry), _logger);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Activity;
|
||||
@@ -41,12 +40,12 @@ namespace Emby.Server.Implementations.Activity
|
||||
|
||||
private const string BaseActivitySelectText = "select Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity from ActivityLogEntries";
|
||||
|
||||
public Task Create(ActivityLogEntry entry)
|
||||
public void Create(ActivityLogEntry entry)
|
||||
{
|
||||
return Update(entry);
|
||||
Update(entry);
|
||||
}
|
||||
|
||||
public async Task Update(ActivityLogEntry entry)
|
||||
public void Update(ActivityLogEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
|
||||
@@ -1048,7 +1048,7 @@ namespace Emby.Server.Implementations
|
||||
|
||||
SetStaticProperties();
|
||||
|
||||
await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
|
||||
((UserManager)UserManager).Initialize();
|
||||
}
|
||||
|
||||
protected virtual string PackageRuntime
|
||||
|
||||
@@ -429,7 +429,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.CreateItem(item, cancellationToken);
|
||||
}
|
||||
else if (forceUpdate)
|
||||
{
|
||||
@@ -1388,11 +1388,11 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.CreateItem(item, cancellationToken);
|
||||
|
||||
if (info.People != null && info.People.Count > 0)
|
||||
{
|
||||
await _libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>()).ConfigureAwait(false);
|
||||
_libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>());
|
||||
}
|
||||
}
|
||||
else if (forceUpdate)
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
await parentFolder.AddChild(collection, CancellationToken.None).ConfigureAwait(false);
|
||||
parentFolder.AddChild(collection, CancellationToken.None);
|
||||
|
||||
if (options.ItemIdList.Length > 0)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
@@ -75,7 +74,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public async Task SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken)
|
||||
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken)
|
||||
{
|
||||
if (displayPreferences == null)
|
||||
{
|
||||
@@ -123,7 +122,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public async Task SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId, CancellationToken cancellationToken)
|
||||
public void SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId, CancellationToken cancellationToken)
|
||||
{
|
||||
if (displayPreferences == null)
|
||||
{
|
||||
@@ -226,9 +225,9 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
}
|
||||
|
||||
public Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
|
||||
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
|
||||
{
|
||||
return SaveDisplayPreferences(displayPreferences, new Guid(userId), client, cancellationToken);
|
||||
SaveDisplayPreferences(displayPreferences, new Guid(userId), client, cancellationToken);
|
||||
}
|
||||
|
||||
public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client)
|
||||
|
||||
@@ -132,8 +132,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task Initialize(SqliteUserDataRepository userDataRepo)
|
||||
public void Initialize(SqliteUserDataRepository userDataRepo)
|
||||
{
|
||||
using (var connection = CreateConnection())
|
||||
{
|
||||
@@ -600,16 +599,15 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public Task SaveItem(BaseItem item, CancellationToken cancellationToken)
|
||||
public void SaveItem(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
return SaveItems(new List<BaseItem> { item }, cancellationToken);
|
||||
SaveItems(new List<BaseItem> { item }, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -617,13 +615,12 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// items
|
||||
/// or
|
||||
/// cancellationToken
|
||||
/// </exception>
|
||||
public async Task SaveItems(List<BaseItem> items, CancellationToken cancellationToken)
|
||||
public void SaveItems(List<BaseItem> items, CancellationToken cancellationToken)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
@@ -1959,22 +1956,18 @@ namespace Emby.Server.Implementations.Data
|
||||
/// Gets the critic reviews.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id.</param>
|
||||
/// <returns>Task{IEnumerable{ItemReview}}.</returns>
|
||||
public List<ItemReview> GetCriticReviews(Guid itemId)
|
||||
{
|
||||
return new List<ItemReview>();
|
||||
}
|
||||
|
||||
private readonly Task _cachedTask = Task.FromResult(true);
|
||||
/// <summary>
|
||||
/// Saves the critic reviews.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id.</param>
|
||||
/// <param name="criticReviews">The critic reviews.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public Task SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews)
|
||||
public void SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews)
|
||||
{
|
||||
return _cachedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2079,7 +2072,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <summary>
|
||||
/// Saves the chapters.
|
||||
/// </summary>
|
||||
public async Task SaveChapters(Guid id, List<ChapterInfo> chapters)
|
||||
public void SaveChapters(Guid id, List<ChapterInfo> chapters)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
@@ -4654,12 +4647,12 @@ namespace Emby.Server.Implementations.Data
|
||||
typeof(AggregateFolder)
|
||||
};
|
||||
|
||||
public async Task UpdateInheritedValues(CancellationToken cancellationToken)
|
||||
public void UpdateInheritedValues(CancellationToken cancellationToken)
|
||||
{
|
||||
await UpdateInheritedTags(cancellationToken).ConfigureAwait(false);
|
||||
UpdateInheritedTags(cancellationToken);
|
||||
}
|
||||
|
||||
private async Task UpdateInheritedTags(CancellationToken cancellationToken)
|
||||
private void UpdateInheritedTags(CancellationToken cancellationToken)
|
||||
{
|
||||
var newValues = new List<Tuple<Guid, string[]>>();
|
||||
|
||||
@@ -4754,7 +4747,7 @@ limit 100";
|
||||
return new[] { value }.Where(IsValidType);
|
||||
}
|
||||
|
||||
public async Task DeleteItem(Guid id, CancellationToken cancellationToken)
|
||||
public void DeleteItem(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
if (id == Guid.Empty)
|
||||
{
|
||||
@@ -5485,7 +5478,7 @@ limit 100";
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdatePeople(Guid itemId, List<PersonInfo> people)
|
||||
public void UpdatePeople(Guid itemId, List<PersonInfo> people)
|
||||
{
|
||||
if (itemId == Guid.Empty)
|
||||
{
|
||||
@@ -5615,7 +5608,7 @@ limit 100";
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken)
|
||||
public void SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
@@ -153,7 +152,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// userId
|
||||
/// or
|
||||
/// userDataId</exception>
|
||||
public Task SaveUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken)
|
||||
public void SaveUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken)
|
||||
{
|
||||
if (userData == null)
|
||||
{
|
||||
@@ -168,10 +167,10 @@ namespace Emby.Server.Implementations.Data
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
|
||||
return PersistUserData(userId, key, userData, cancellationToken);
|
||||
PersistUserData(userId, key, userData, cancellationToken);
|
||||
}
|
||||
|
||||
public Task SaveAllUserData(Guid userId, IEnumerable<UserItemData> userData, CancellationToken cancellationToken)
|
||||
public void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken)
|
||||
{
|
||||
if (userData == null)
|
||||
{
|
||||
@@ -182,7 +181,7 @@ namespace Emby.Server.Implementations.Data
|
||||
throw new ArgumentNullException("userId");
|
||||
}
|
||||
|
||||
return PersistAllUserData(userId, userData.ToList(), cancellationToken);
|
||||
PersistAllUserData(userId, userData, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -193,7 +192,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="userData">The user data.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task PersistUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken)
|
||||
public void PersistUserData(Guid userId, string key, UserItemData userData, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
@@ -264,7 +263,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <summary>
|
||||
/// Persist all user data for the specified user
|
||||
/// </summary>
|
||||
private async Task PersistAllUserData(Guid userId, List<UserItemData> userDataList, CancellationToken cancellationToken)
|
||||
private void PersistAllUserData(Guid userId, UserItemData[] userDataList, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
@@ -349,7 +348,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<UserItemData> GetAllUserData(Guid userId)
|
||||
public List<UserItemData> GetAllUserData(Guid userId)
|
||||
{
|
||||
if (userId == Guid.Empty)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
@@ -72,7 +71,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
public async Task SaveUser(User user, CancellationToken cancellationToken)
|
||||
public void SaveUser(User user, CancellationToken cancellationToken)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -139,7 +138,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
public async Task DeleteUser(User user, CancellationToken cancellationToken)
|
||||
public void DeleteUser(User user, CancellationToken cancellationToken)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
|
||||
@@ -461,10 +461,10 @@ namespace Emby.Server.Implementations.Library
|
||||
parent.RemoveChild(item);
|
||||
}
|
||||
|
||||
await ItemRepository.DeleteItem(item.Id, CancellationToken.None).ConfigureAwait(false);
|
||||
ItemRepository.DeleteItem(item.Id, CancellationToken.None);
|
||||
foreach (var child in children)
|
||||
{
|
||||
await ItemRepository.DeleteItem(child.Id, CancellationToken.None).ConfigureAwait(false);
|
||||
ItemRepository.DeleteItem(child.Id, CancellationToken.None);
|
||||
}
|
||||
|
||||
BaseItem removed;
|
||||
@@ -997,8 +997,7 @@ namespace Emby.Server.Implementations.Library
|
||||
Path = path
|
||||
};
|
||||
|
||||
var task = CreateItem(item, CancellationToken.None);
|
||||
Task.WaitAll(task);
|
||||
CreateItem(item, CancellationToken.None);
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -1170,7 +1169,7 @@ namespace Emby.Server.Implementations.Library
|
||||
progress.Report(percent * 100);
|
||||
}
|
||||
|
||||
await ItemRepository.UpdateInheritedValues(cancellationToken).ConfigureAwait(false);
|
||||
ItemRepository.UpdateInheritedValues(cancellationToken);
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
@@ -1812,9 +1811,9 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public Task CreateItem(BaseItem item, CancellationToken cancellationToken)
|
||||
public void CreateItem(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
return CreateItems(new[] { item }, cancellationToken);
|
||||
CreateItems(new[] { item }, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1823,11 +1822,11 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken)
|
||||
public void CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken)
|
||||
{
|
||||
var list = items.ToList();
|
||||
|
||||
await ItemRepository.SaveItems(list, cancellationToken).ConfigureAwait(false);
|
||||
ItemRepository.SaveItems(list, cancellationToken);
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
@@ -1870,7 +1869,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var logName = item.LocationType == LocationType.Remote ? item.Name ?? item.Path : item.Path ?? item.Name;
|
||||
_logger.Debug("Saving {0} to database.", logName);
|
||||
|
||||
await ItemRepository.SaveItem(item, cancellationToken).ConfigureAwait(false);
|
||||
ItemRepository.SaveItem(item, cancellationToken);
|
||||
|
||||
RegisterItem(item);
|
||||
|
||||
@@ -2067,7 +2066,7 @@ namespace Emby.Server.Implementations.Library
|
||||
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
|
||||
//private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromMinutes(1);
|
||||
|
||||
public Task<UserView> GetNamedView(User user,
|
||||
public UserView GetNamedView(User user,
|
||||
string name,
|
||||
string viewType,
|
||||
string sortName,
|
||||
@@ -2105,7 +2104,7 @@ namespace Emby.Server.Implementations.Library
|
||||
ForcedSortName = sortName
|
||||
};
|
||||
|
||||
await CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
CreateItem(item, cancellationToken);
|
||||
|
||||
refresh = true;
|
||||
}
|
||||
@@ -2136,7 +2135,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<UserView> GetNamedView(User user,
|
||||
public UserView GetNamedView(User user,
|
||||
string name,
|
||||
string parentId,
|
||||
string viewType,
|
||||
@@ -2173,7 +2172,7 @@ namespace Emby.Server.Implementations.Library
|
||||
item.DisplayParentId = new Guid(parentId);
|
||||
}
|
||||
|
||||
await CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
CreateItem(item, cancellationToken);
|
||||
|
||||
isNew = true;
|
||||
}
|
||||
@@ -2199,7 +2198,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<UserView> GetShadowView(BaseItem parent,
|
||||
public UserView GetShadowView(BaseItem parent,
|
||||
string viewType,
|
||||
string sortName,
|
||||
CancellationToken cancellationToken)
|
||||
@@ -2238,7 +2237,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
item.DisplayParentId = parentId;
|
||||
|
||||
await CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
CreateItem(item, cancellationToken);
|
||||
|
||||
isNew = true;
|
||||
}
|
||||
@@ -2309,7 +2308,7 @@ namespace Emby.Server.Implementations.Library
|
||||
item.DisplayParentId = new Guid(parentId);
|
||||
}
|
||||
|
||||
await CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
CreateItem(item, cancellationToken);
|
||||
|
||||
isNew = true;
|
||||
}
|
||||
@@ -2823,14 +2822,14 @@ namespace Emby.Server.Implementations.Library
|
||||
return ItemRepository.GetPeopleNames(query);
|
||||
}
|
||||
|
||||
public Task UpdatePeople(BaseItem item, List<PersonInfo> people)
|
||||
public void UpdatePeople(BaseItem item, List<PersonInfo> people)
|
||||
{
|
||||
if (!item.SupportsPeople)
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
return;
|
||||
}
|
||||
|
||||
return ItemRepository.UpdatePeople(item.Id, people);
|
||||
ItemRepository.UpdatePeople(item.Id, people);
|
||||
}
|
||||
|
||||
public async Task<ItemImageInfo> ConvertImageToLocal(IHasMetadata item, ItemImageInfo image, int imageIndex)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <value>The repository.</value>
|
||||
public IUserDataRepository Repository { get; set; }
|
||||
|
||||
public async Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
|
||||
public void SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
|
||||
{
|
||||
if (userData == null)
|
||||
{
|
||||
@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
foreach (var key in keys)
|
||||
{
|
||||
await Repository.SaveUserData(userId, key, userData, cancellationToken).ConfigureAwait(false);
|
||||
Repository.SaveUserData(userId, key, userData, cancellationToken);
|
||||
}
|
||||
|
||||
var cacheKey = GetCacheKey(userId, item.Id);
|
||||
@@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="userData"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveAllUserData(Guid userId, IEnumerable<UserItemData> userData, CancellationToken cancellationToken)
|
||||
public void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken)
|
||||
{
|
||||
if (userData == null)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
await Repository.SaveAllUserData(userId, userData, cancellationToken).ConfigureAwait(false);
|
||||
Repository.SaveAllUserData(userId, userData, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,7 +107,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<UserItemData> GetAllUserData(Guid userId)
|
||||
public List<UserItemData> GetAllUserData(Guid userId)
|
||||
{
|
||||
if (userId == Guid.Empty)
|
||||
{
|
||||
@@ -187,7 +187,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var userData = GetUserData(user.Id, item);
|
||||
var dto = GetUserItemDataDto(userData);
|
||||
|
||||
item.FillUserDataDtoValues(dto, userData, null, user, new ItemFields[]{});
|
||||
item.FillUserDataDtoValues(dto, userData, null, user, new ItemFields[] { });
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@ namespace Emby.Server.Implementations.Library
|
||||
return Users.FirstOrDefault(u => string.Equals(u.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public async Task Initialize()
|
||||
public void Initialize()
|
||||
{
|
||||
Users = await LoadUsers().ConfigureAwait(false);
|
||||
Users = LoadUsers();
|
||||
|
||||
var users = Users.ToList();
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.Library
|
||||
if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value == UserLinkType.LinkedUser)
|
||||
{
|
||||
user.Policy.IsAdministrator = true;
|
||||
await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);
|
||||
UpdateUserPolicy(user, user.Policy, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,12 +294,12 @@ namespace Emby.Server.Implementations.Library
|
||||
if (success)
|
||||
{
|
||||
user.LastActivityDate = user.LastLoginDate = DateTime.UtcNow;
|
||||
await UpdateUser(user).ConfigureAwait(false);
|
||||
await UpdateInvalidLoginAttemptCount(user, 0).ConfigureAwait(false);
|
||||
UpdateUser(user);
|
||||
UpdateInvalidLoginAttemptCount(user, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
await UpdateInvalidLoginAttemptCount(user, user.Policy.InvalidLoginAttemptCount + 1).ConfigureAwait(false);
|
||||
UpdateInvalidLoginAttemptCount(user, user.Policy.InvalidLoginAttemptCount + 1);
|
||||
}
|
||||
|
||||
_logger.Info("Authentication request for {0} {1}.", user.Name, success ? "has succeeded" : "has been denied");
|
||||
@@ -307,7 +307,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return success ? user : null;
|
||||
}
|
||||
|
||||
private async Task UpdateInvalidLoginAttemptCount(User user, int newValue)
|
||||
private void UpdateInvalidLoginAttemptCount(User user, int newValue)
|
||||
{
|
||||
if (user.Policy.InvalidLoginAttemptCount != newValue || newValue > 0)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ namespace Emby.Server.Implementations.Library
|
||||
//fireLockout = true;
|
||||
}
|
||||
|
||||
await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);
|
||||
UpdateUserPolicy(user, user.Policy, false);
|
||||
|
||||
if (fireLockout)
|
||||
{
|
||||
@@ -372,7 +372,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Loads the users from the repository
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{User}.</returns>
|
||||
private async Task<IEnumerable<User>> LoadUsers()
|
||||
private List<User> LoadUsers()
|
||||
{
|
||||
var users = UserRepository.RetrieveAllUsers().ToList();
|
||||
|
||||
@@ -385,14 +385,14 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
user.DateLastSaved = DateTime.UtcNow;
|
||||
|
||||
await UserRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||
UserRepository.SaveUser(user, CancellationToken.None);
|
||||
|
||||
users.Add(user);
|
||||
|
||||
user.Policy.IsAdministrator = true;
|
||||
user.Policy.EnableContentDeletion = true;
|
||||
user.Policy.EnableRemoteControlOfOtherUsers = true;
|
||||
await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);
|
||||
UpdateUserPolicy(user, user.Policy, false);
|
||||
}
|
||||
|
||||
return users;
|
||||
@@ -539,7 +539,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="user">The user.</param>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
public async Task UpdateUser(User user)
|
||||
public void UpdateUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -554,7 +554,7 @@ namespace Emby.Server.Implementations.Library
|
||||
user.DateModified = DateTime.UtcNow;
|
||||
user.DateLastSaved = DateTime.UtcNow;
|
||||
|
||||
await UserRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||
UserRepository.SaveUser(user, CancellationToken.None);
|
||||
|
||||
OnUserUpdated(user);
|
||||
}
|
||||
@@ -599,7 +599,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
user.DateLastSaved = DateTime.UtcNow;
|
||||
|
||||
await UserRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||
UserRepository.SaveUser(user, CancellationToken.None);
|
||||
|
||||
EventHelper.QueueEventIfNotNull(UserCreated, this, new GenericEventArgs<User> { Argument = user }, _logger);
|
||||
|
||||
@@ -653,7 +653,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var configPath = GetConfigurationFilePath(user);
|
||||
|
||||
await UserRepository.DeleteUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||
UserRepository.DeleteUser(user, CancellationToken.None);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -667,7 +667,7 @@ namespace Emby.Server.Implementations.Library
|
||||
DeleteUserPolicy(user);
|
||||
|
||||
// Force this to be lazy loaded again
|
||||
Users = await LoadUsers().ConfigureAwait(false);
|
||||
Users = LoadUsers();
|
||||
|
||||
OnUserDeleted(user);
|
||||
}
|
||||
@@ -681,17 +681,17 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Resets the password by clearing it.
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
public Task ResetPassword(User user)
|
||||
public void ResetPassword(User user)
|
||||
{
|
||||
return ChangePassword(user, GetSha1String(string.Empty));
|
||||
ChangePassword(user, GetSha1String(string.Empty));
|
||||
}
|
||||
|
||||
public Task ResetEasyPassword(User user)
|
||||
public void ResetEasyPassword(User user)
|
||||
{
|
||||
return ChangeEasyPassword(user, GetSha1String(string.Empty));
|
||||
ChangeEasyPassword(user, GetSha1String(string.Empty));
|
||||
}
|
||||
|
||||
public async Task ChangePassword(User user, string newPasswordSha1)
|
||||
public void ChangePassword(User user, string newPasswordSha1)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -709,12 +709,12 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
user.Password = newPasswordSha1;
|
||||
|
||||
await UpdateUser(user).ConfigureAwait(false);
|
||||
UpdateUser(user);
|
||||
|
||||
EventHelper.FireEventIfNotNull(UserPasswordChanged, this, new GenericEventArgs<User>(user), _logger);
|
||||
}
|
||||
|
||||
public async Task ChangeEasyPassword(User user, string newPasswordSha1)
|
||||
public void ChangeEasyPassword(User user, string newPasswordSha1)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
@@ -727,7 +727,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
user.EasyPassword = newPasswordSha1;
|
||||
|
||||
await UpdateUser(user).ConfigureAwait(false);
|
||||
UpdateUser(user);
|
||||
|
||||
EventHelper.FireEventIfNotNull(UserPasswordChanged, this, new GenericEventArgs<User>(user), _logger);
|
||||
}
|
||||
@@ -842,7 +842,7 @@ namespace Emby.Server.Implementations.Library
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PinRedeemResult> RedeemPasswordResetPin(string pin)
|
||||
public PinRedeemResult RedeemPasswordResetPin(string pin)
|
||||
{
|
||||
DeletePinFile();
|
||||
|
||||
@@ -863,12 +863,12 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
foreach (var user in users)
|
||||
{
|
||||
await ResetPassword(user).ConfigureAwait(false);
|
||||
ResetPassword(user);
|
||||
|
||||
if (user.Policy.IsDisabled)
|
||||
{
|
||||
user.Policy.IsDisabled = false;
|
||||
await UpdateUserPolicy(user, user.Policy, true).ConfigureAwait(false);
|
||||
UpdateUserPolicy(user, user.Policy, true);
|
||||
}
|
||||
usersReset.Add(user.Name);
|
||||
}
|
||||
@@ -945,13 +945,13 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
private readonly object _policySyncLock = new object();
|
||||
public Task UpdateUserPolicy(string userId, UserPolicy userPolicy)
|
||||
public void UpdateUserPolicy(string userId, UserPolicy userPolicy)
|
||||
{
|
||||
var user = GetUserById(userId);
|
||||
return UpdateUserPolicy(user, userPolicy, true);
|
||||
UpdateUserPolicy(user, userPolicy, true);
|
||||
}
|
||||
|
||||
private async Task UpdateUserPolicy(User user, UserPolicy userPolicy, bool fireEvent)
|
||||
private void UpdateUserPolicy(User user, UserPolicy userPolicy, bool fireEvent)
|
||||
{
|
||||
// The xml serializer will output differently if the type is not exact
|
||||
if (userPolicy.GetType() != typeof(UserPolicy))
|
||||
@@ -970,7 +970,7 @@ namespace Emby.Server.Implementations.Library
|
||||
user.Policy = userPolicy;
|
||||
}
|
||||
|
||||
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
|
||||
UpdateConfiguration(user, user.Configuration, true);
|
||||
}
|
||||
|
||||
private void DeleteUserPolicy(User user)
|
||||
@@ -1032,13 +1032,13 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
private readonly object _configSyncLock = new object();
|
||||
public Task UpdateConfiguration(string userId, UserConfiguration config)
|
||||
public void UpdateConfiguration(string userId, UserConfiguration config)
|
||||
{
|
||||
var user = GetUserById(userId);
|
||||
return UpdateConfiguration(user, config, true);
|
||||
UpdateConfiguration(user, config, true);
|
||||
}
|
||||
|
||||
private async Task UpdateConfiguration(User user, UserConfiguration config, bool fireEvent)
|
||||
private void UpdateConfiguration(User user, UserConfiguration config, bool fireEvent)
|
||||
{
|
||||
var path = GetConfigurationFilePath(user);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (UserView.IsUserSpecific(folder))
|
||||
{
|
||||
list.Add(await _libraryManager.GetNamedView(user, folder.Name, folder.Id.ToString("N"), folderViewType, null, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(_libraryManager.GetNamedView(user, folder.Name, folder.Id.ToString("N"), folderViewType, null, cancellationToken));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (query.PresetViews.Contains(folderViewType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(await GetUserView(folder, folderViewType, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(GetUserView(folder, folderViewType, string.Empty, cancellationToken));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (parents.Count > 0)
|
||||
{
|
||||
list.Add(await GetUserView(parents, viewType, string.Empty, user, query.PresetViews, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(GetUserView(parents, viewType, string.Empty, user, query.PresetViews, cancellationToken));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var channels = channelResult.Items;
|
||||
|
||||
|
||||
if (_config.Configuration.EnableChannelView && channels.Length > 0)
|
||||
{
|
||||
list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false));
|
||||
@@ -172,7 +172,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetUserSubView(name, parentId, type, sortName, cancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Folder> GetUserView(List<ICollectionFolder> parents, string viewType, string sortName, User user, string[] presetViews, CancellationToken cancellationToken)
|
||||
private Folder GetUserView(List<ICollectionFolder> parents, string viewType, string sortName, User user, string[] presetViews, CancellationToken cancellationToken)
|
||||
{
|
||||
if (parents.Count == 1 && parents.All(i => string.Equals(i.CollectionType, viewType, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
@@ -181,14 +181,14 @@ namespace Emby.Server.Implementations.Library
|
||||
return (Folder)parents[0];
|
||||
}
|
||||
|
||||
return await GetUserView((Folder)parents[0], viewType, string.Empty, cancellationToken).ConfigureAwait(false);
|
||||
return GetUserView((Folder)parents[0], viewType, string.Empty, cancellationToken);
|
||||
}
|
||||
|
||||
var name = _localizationManager.GetLocalizedString("ViewType" + viewType);
|
||||
return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
|
||||
return _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<UserView> GetUserView(Folder parent, string viewType, string sortName, CancellationToken cancellationToken)
|
||||
public UserView GetUserView(Folder parent, string viewType, string sortName, CancellationToken cancellationToken)
|
||||
{
|
||||
return _libraryManager.GetShadowView(parent, viewType, sortName, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.CreateItem(item, cancellationToken);
|
||||
}
|
||||
else if (forceUpdate)
|
||||
{
|
||||
@@ -875,7 +875,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.CreateItem(item, cancellationToken);
|
||||
}
|
||||
else if (dataChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged)
|
||||
{
|
||||
@@ -1410,7 +1410,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (newPrograms.Count > 0)
|
||||
{
|
||||
await _libraryManager.CreateItems(newPrograms, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.CreateItems(newPrograms, cancellationToken);
|
||||
}
|
||||
|
||||
// TODO: Do this in bulk
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||
|
||||
if (saveChapters && changesMade)
|
||||
{
|
||||
await _chapterManager.SaveChapters(video.Id.ToString(), chapters).ConfigureAwait(false);
|
||||
_chapterManager.SaveChapters(video.Id.ToString(), chapters);
|
||||
}
|
||||
|
||||
DeleteDeadImages(currentImages, chapters);
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
|
||||
playlist.SetMediaType(options.MediaType);
|
||||
|
||||
await parentFolder.AddChild(playlist, CancellationToken.None).ConfigureAwait(false);
|
||||
parentFolder.AddChild(playlist, CancellationToken.None);
|
||||
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) { ForceSave = true }, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Security;
|
||||
@@ -51,14 +50,14 @@ namespace Emby.Server.Implementations.Security
|
||||
}
|
||||
}
|
||||
|
||||
public Task Create(AuthenticationInfo info, CancellationToken cancellationToken)
|
||||
public void Create(AuthenticationInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
info.Id = Guid.NewGuid().ToString("N");
|
||||
|
||||
return Update(info, cancellationToken);
|
||||
Update(info, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task Update(AuthenticationInfo info, CancellationToken cancellationToken)
|
||||
public void Update(AuthenticationInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
|
||||
@@ -6,11 +6,8 @@ using MediaBrowser.Controller.Devices;
|
||||
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.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Security;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Devices;
|
||||
@@ -253,7 +250,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
try
|
||||
{
|
||||
await _userManager.UpdateUser(user).ConfigureAwait(false);
|
||||
_userManager.UpdateUser(user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -622,7 +619,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
foreach (var user in users)
|
||||
{
|
||||
await OnPlaybackStart(user.Id, libraryItem).ConfigureAwait(false);
|
||||
OnPlaybackStart(user.Id, libraryItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,8 +647,7 @@ namespace Emby.Server.Implementations.Session
|
||||
/// </summary>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>Task.</returns>
|
||||
private async Task OnPlaybackStart(Guid userId, IHasUserData item)
|
||||
private void OnPlaybackStart(Guid userId, IHasUserData item)
|
||||
{
|
||||
var data = _userDataManager.GetUserData(userId, item);
|
||||
|
||||
@@ -670,7 +666,7 @@ namespace Emby.Server.Implementations.Session
|
||||
data.Played = false;
|
||||
}
|
||||
|
||||
await _userDataManager.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackStart, CancellationToken.None).ConfigureAwait(false);
|
||||
_userDataManager.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackStart, CancellationToken.None);
|
||||
}
|
||||
|
||||
public Task OnPlaybackProgress(PlaybackProgressInfo info)
|
||||
@@ -702,7 +698,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
foreach (var user in users)
|
||||
{
|
||||
await OnPlaybackProgress(user, libraryItem, info).ConfigureAwait(false);
|
||||
OnPlaybackProgress(user, libraryItem, info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +726,7 @@ namespace Emby.Server.Implementations.Session
|
||||
StartIdleCheckTimer();
|
||||
}
|
||||
|
||||
private async Task OnPlaybackProgress(User user, BaseItem item, PlaybackProgressInfo info)
|
||||
private void OnPlaybackProgress(User user, BaseItem item, PlaybackProgressInfo info)
|
||||
{
|
||||
var data = _userDataManager.GetUserData(user.Id, item);
|
||||
|
||||
@@ -742,7 +738,7 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
UpdatePlaybackSettings(user, info, data);
|
||||
|
||||
await _userDataManager.SaveUserData(user.Id, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None).ConfigureAwait(false);
|
||||
_userDataManager.SaveUserData(user.Id, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -842,7 +838,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
foreach (var user in users)
|
||||
{
|
||||
playedToCompletion = await OnPlaybackStopped(user.Id, libraryItem, info.PositionTicks, info.Failed).ConfigureAwait(false);
|
||||
playedToCompletion = OnPlaybackStopped(user.Id, libraryItem, info.PositionTicks, info.Failed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,7 +871,7 @@ namespace Emby.Server.Implementations.Session
|
||||
await SendPlaybackStoppedNotification(session, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<bool> OnPlaybackStopped(Guid userId, BaseItem item, long? positionTicks, bool playbackFailed)
|
||||
private bool OnPlaybackStopped(Guid userId, BaseItem item, long? positionTicks, bool playbackFailed)
|
||||
{
|
||||
bool playedToCompletion = false;
|
||||
|
||||
@@ -896,7 +892,7 @@ namespace Emby.Server.Implementations.Session
|
||||
playedToCompletion = true;
|
||||
}
|
||||
|
||||
await _userDataManager.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None).ConfigureAwait(false);
|
||||
_userDataManager.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None);
|
||||
}
|
||||
|
||||
return playedToCompletion;
|
||||
@@ -1432,7 +1428,7 @@ namespace Emby.Server.Implementations.Session
|
||||
user = result;
|
||||
}
|
||||
|
||||
var token = await GetAuthorizationToken(user.Id.ToString("N"), request.DeviceId, request.App, request.AppVersion, request.DeviceName).ConfigureAwait(false);
|
||||
var token = GetAuthorizationToken(user.Id.ToString("N"), request.DeviceId, request.App, request.AppVersion, request.DeviceName);
|
||||
|
||||
EventHelper.FireEventIfNotNull(AuthenticationSucceeded, this, new GenericEventArgs<AuthenticationRequest>(request), _logger);
|
||||
|
||||
@@ -1454,7 +1450,7 @@ namespace Emby.Server.Implementations.Session
|
||||
}
|
||||
|
||||
|
||||
private async Task<string> GetAuthorizationToken(string userId, string deviceId, string app, string appVersion, string deviceName)
|
||||
private string GetAuthorizationToken(string userId, string deviceId, string app, string appVersion, string deviceName)
|
||||
{
|
||||
var existing = _authRepo.Get(new AuthenticationInfoQuery
|
||||
{
|
||||
@@ -1484,12 +1480,12 @@ namespace Emby.Server.Implementations.Session
|
||||
};
|
||||
|
||||
_logger.Info("Creating new access token for user {0}", userId);
|
||||
await _authRepo.Create(newToken, CancellationToken.None).ConfigureAwait(false);
|
||||
_authRepo.Create(newToken, CancellationToken.None);
|
||||
|
||||
return newToken.AccessToken;
|
||||
}
|
||||
|
||||
public async Task Logout(string accessToken)
|
||||
public void Logout(string accessToken)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(accessToken))
|
||||
{
|
||||
@@ -1509,7 +1505,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
existing.IsActive = false;
|
||||
|
||||
await _authRepo.Update(existing, CancellationToken.None).ConfigureAwait(false);
|
||||
_authRepo.Update(existing, CancellationToken.None);
|
||||
|
||||
var sessions = Sessions
|
||||
.Where(i => string.Equals(i.DeviceId, existing.DeviceId, StringComparison.OrdinalIgnoreCase))
|
||||
@@ -1529,7 +1525,7 @@ namespace Emby.Server.Implementations.Session
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RevokeUserTokens(string userId, string currentAccessToken)
|
||||
public void RevokeUserTokens(string userId, string currentAccessToken)
|
||||
{
|
||||
var existing = _authRepo.Get(new AuthenticationInfoQuery
|
||||
{
|
||||
@@ -1541,14 +1537,14 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
if (!string.Equals(currentAccessToken, info.AccessToken, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
await Logout(info.AccessToken).ConfigureAwait(false);
|
||||
Logout(info.AccessToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Task RevokeToken(string token)
|
||||
public void RevokeToken(string token)
|
||||
{
|
||||
return Logout(token);
|
||||
Logout(token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace Emby.Server.Implementations.Social
|
||||
};
|
||||
|
||||
AddShareInfo(info, externalUrl);
|
||||
|
||||
await _repository.CreateShare(info).ConfigureAwait(false);
|
||||
|
||||
_repository.CreateShare(info);
|
||||
|
||||
return info;
|
||||
}
|
||||
@@ -92,9 +92,9 @@ namespace Emby.Server.Implementations.Social
|
||||
}
|
||||
}
|
||||
|
||||
public Task DeleteShare(string id)
|
||||
public void DeleteShare(string id)
|
||||
{
|
||||
return _repository.DeleteShare(id);
|
||||
_repository.DeleteShare(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
@@ -42,7 +40,7 @@ namespace Emby.Server.Implementations.Social
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateShare(SocialShareInfo info)
|
||||
public void CreateShare(SocialShareInfo info)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
@@ -109,7 +107,7 @@ namespace Emby.Server.Implementations.Social
|
||||
return info;
|
||||
}
|
||||
|
||||
public async Task DeleteShare(string id)
|
||||
public void DeleteShare(string id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user