Merge pull request #2941 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-10-04 14:52:50 -04:00 committed by GitHub
commit 185fa7f5e7
46 changed files with 281 additions and 359 deletions

View File

@ -26,9 +26,11 @@ namespace Emby.Dlna.Eventing
_logger = logger; _logger = logger;
} }
public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string requestedTimeoutString) public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl)
{ {
var subscription = GetSubscription(subscriptionId, true); var subscription = GetSubscription(subscriptionId, false);
int timeoutSeconds;
// Remove logging for now because some devices are sending this very frequently // Remove logging for now because some devices are sending this very frequently
// TODO re-enable with dlna debug logging setting // TODO re-enable with dlna debug logging setting
@ -37,10 +39,18 @@ namespace Emby.Dlna.Eventing
// timeout, // timeout,
// subscription.CallbackUrl); // subscription.CallbackUrl);
subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300; if (subscription != null)
subscription.SubscriptionTime = DateTime.UtcNow; {
subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
timeoutSeconds = subscription.TimeoutSeconds;
subscription.SubscriptionTime = DateTime.UtcNow;
}
else
{
timeoutSeconds = 300;
}
return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, subscription.TimeoutSeconds); return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds);
} }
public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl) public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)

View File

@ -24,9 +24,9 @@ namespace Emby.Dlna.Service
return EventManager.CancelEventSubscription(subscriptionId); return EventManager.CancelEventSubscription(subscriptionId);
} }
public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string timeoutString) public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string timeoutString, string callbackUrl)
{ {
return EventManager.RenewEventSubscription(subscriptionId, timeoutString); return EventManager.RenewEventSubscription(subscriptionId, notificationType, timeoutString, callbackUrl);
} }
public EventSubscriptionResponse CreateEventSubscription(string notificationType, string timeoutString, string callbackUrl) public EventSubscriptionResponse CreateEventSubscription(string notificationType, string timeoutString, string callbackUrl)

View File

@ -373,7 +373,7 @@ namespace Emby.Server.Implementations.Channels
private async Task<Channel> GetChannel(IChannel channelInfo, CancellationToken cancellationToken) private async Task<Channel> GetChannel(IChannel channelInfo, CancellationToken cancellationToken)
{ {
var parentFolder = await GetInternalChannelFolder(cancellationToken).ConfigureAwait(false); var parentFolder = GetInternalChannelFolder(cancellationToken);
var parentFolderId = parentFolder.Id; var parentFolderId = parentFolder.Id;
var id = GetInternalChannelId(channelInfo.Name); var id = GetInternalChannelId(channelInfo.Name);
@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.Channels
} }
else if (forceUpdate) else if (forceUpdate)
{ {
await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.None, cancellationToken);
} }
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem), cancellationToken); await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem), cancellationToken);
@ -655,14 +655,12 @@ namespace Emby.Server.Implementations.Channels
// Avoid implicitly captured closure // Avoid implicitly captured closure
var token = cancellationToken; var token = cancellationToken;
var itemTasks = items.Select(i => var internalItems = items.Select(i =>
{ {
var channelProvider = i.Item1; var channelProvider = i.Item1;
var internalChannelId = GetInternalChannelId(channelProvider.Name); var internalChannelId = GetInternalChannelId(channelProvider.Name);
return GetChannelItemEntity(i.Item2, channelProvider, internalChannelId, token); return GetChannelItemEntity(i.Item2, channelProvider, internalChannelId, token);
}); }).ToArray();
var internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
internalItems = ApplyFilters(internalItems, query.Filters, user).ToArray(); internalItems = ApplyFilters(internalItems, query.Filters, user).ToArray();
RefreshIfNeeded(internalItems); RefreshIfNeeded(internalItems);
@ -802,14 +800,12 @@ namespace Emby.Server.Implementations.Channels
// Avoid implicitly captured closure // Avoid implicitly captured closure
var token = cancellationToken; var token = cancellationToken;
var itemTasks = items.Select(i => var internalItems = items.Select(i =>
{ {
var channelProvider = i.Item1; var channelProvider = i.Item1;
var internalChannelId = GetInternalChannelId(channelProvider.Name); var internalChannelId = GetInternalChannelId(channelProvider.Name);
return GetChannelItemEntity(i.Item2, channelProvider, internalChannelId, token); return GetChannelItemEntity(i.Item2, channelProvider, internalChannelId, token);
}); }).ToArray();
var internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
return new QueryResult<BaseItem> return new QueryResult<BaseItem>
{ {
@ -955,9 +951,7 @@ namespace Emby.Server.Implementations.Channels
var providerTotalRecordCount = providerLimit.HasValue ? itemsResult.TotalRecordCount : null; var providerTotalRecordCount = providerLimit.HasValue ? itemsResult.TotalRecordCount : null;
var tasks = itemsResult.Items.Select(i => GetChannelItemEntity(i, channelProvider, channel.Id, cancellationToken)); var internalItems = itemsResult.Items.Select(i => GetChannelItemEntity(i, channelProvider, channel.Id, cancellationToken)).ToArray();
var internalItems = await Task.WhenAll(tasks).ConfigureAwait(false);
if (user != null) if (user != null)
{ {
@ -1234,7 +1228,7 @@ namespace Emby.Server.Implementations.Channels
return item; return item;
} }
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Guid internalChannelId, CancellationToken cancellationToken) private BaseItem GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Guid internalChannelId, CancellationToken cancellationToken)
{ {
BaseItem item; BaseItem item;
bool isNew; bool isNew;
@ -1399,7 +1393,7 @@ namespace Emby.Server.Implementations.Channels
} }
else if (forceUpdate) else if (forceUpdate)
{ {
await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.None, cancellationToken);
} }
SaveMediaSources(item, info.MediaSources); SaveMediaSources(item, info.MediaSources);
@ -1542,20 +1536,20 @@ namespace Emby.Server.Implementations.Channels
return items; return items;
} }
public async Task<BaseItemDto> GetChannelFolder(string userId, CancellationToken cancellationToken) public BaseItemDto GetChannelFolder(string userId, CancellationToken cancellationToken)
{ {
var user = string.IsNullOrEmpty(userId) ? null : _userManager.GetUserById(userId); var user = string.IsNullOrEmpty(userId) ? null : _userManager.GetUserById(userId);
var folder = await GetInternalChannelFolder(cancellationToken).ConfigureAwait(false); var folder = GetInternalChannelFolder(cancellationToken);
return _dtoService.GetBaseItemDto(folder, new DtoOptions(), user); return _dtoService.GetBaseItemDto(folder, new DtoOptions(), user);
} }
public async Task<Folder> GetInternalChannelFolder(CancellationToken cancellationToken) public Folder GetInternalChannelFolder(CancellationToken cancellationToken)
{ {
var name = _localization.GetLocalizedString("ViewTypeChannels"); var name = _localization.GetLocalizedString("ViewTypeChannels");
return await _libraryManager.GetNamedView(name, "channels", "zz_" + name, cancellationToken).ConfigureAwait(false); return _libraryManager.GetNamedView(name, "channels", "zz_" + name, cancellationToken);
} }
} }

View File

@ -203,7 +203,7 @@ namespace Emby.Server.Implementations.Collections
collection.UpdateRatingToContent(); collection.UpdateRatingToContent();
await collection.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); collection.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
_providerManager.QueueRefresh(collection.Id, refreshOptions, RefreshPriority.High); _providerManager.QueueRefresh(collection.Id, refreshOptions, RefreshPriority.High);
@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.Collections
collection.UpdateRatingToContent(); collection.UpdateRatingToContent();
await collection.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); collection.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
_providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.High); _providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.High);
EventHelper.FireEventIfNotNull(ItemsRemovedFromCollection, this, new CollectionModifiedEventArgs EventHelper.FireEventIfNotNull(ItemsRemovedFromCollection, this, new CollectionModifiedEventArgs

View File

@ -154,20 +154,13 @@ namespace Emby.Server.Implementations.IO
.DistinctBy(i => i.Id) .DistinctBy(i => i.Id)
.ToList(); .ToList();
//foreach (var p in paths)
//{
// Logger.Info(p + " reports change.");
//}
// If the root folder changed, run the library task so the user can see it
if (itemsToRefresh.Any(i => i is AggregateFolder))
{
LibraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
return;
}
foreach (var item in itemsToRefresh) foreach (var item in itemsToRefresh)
{ {
if (item is AggregateFolder)
{
continue;
}
Logger.Info(item.Name + " (" + item.Path + ") will be refreshed."); Logger.Info(item.Name + " (" + item.Path + ") will be refreshed.");
try try

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -24,12 +25,14 @@ namespace Emby.Server.Implementations.IO
private string _tempPath; private string _tempPath;
private SharpCifsFileSystem _sharpCifsFileSystem; private SharpCifsFileSystem _sharpCifsFileSystem;
private IEnvironmentInfo _environmentInfo;
public ManagedFileSystem(ILogger logger, IEnvironmentInfo environmentInfo, string tempPath) public ManagedFileSystem(ILogger logger, IEnvironmentInfo environmentInfo, string tempPath)
{ {
Logger = logger; Logger = logger;
_supportsAsyncFileStreams = true; _supportsAsyncFileStreams = true;
_tempPath = tempPath; _tempPath = tempPath;
_environmentInfo = environmentInfo;
// On Linux, this needs to be true or symbolic links are ignored // On Linux, this needs to be true or symbolic links are ignored
EnableFileSystemRequestConcat = environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows && EnableFileSystemRequestConcat = environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
@ -1051,7 +1054,25 @@ namespace Emby.Server.Implementations.IO
public virtual void SetExecutable(string path) public virtual void SetExecutable(string path)
{ {
if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
{
RunProcess("chmod", "+x \"" + path + "\"", GetDirectoryName(path));
}
}
private void RunProcess(string path, string args, string workingDirectory)
{
using (var process = Process.Start(new ProcessStartInfo
{
Arguments = args,
FileName = path,
CreateNoWindow = true,
WorkingDirectory = workingDirectory,
WindowStyle = ProcessWindowStyle.Normal
}))
{
process.WaitForExit();
}
} }
} }
} }

View File

@ -738,8 +738,7 @@ namespace Emby.Server.Implementations.Library
if (folder.ParentId != rootFolder.Id) if (folder.ParentId != rootFolder.Id)
{ {
folder.ParentId = rootFolder.Id; folder.ParentId = rootFolder.Id;
var task = folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None); folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
Task.WaitAll(task);
} }
rootFolder.AddVirtualChild(folder); rootFolder.AddVirtualChild(folder);
@ -1834,12 +1833,12 @@ namespace Emby.Server.Implementations.Library
/// <param name="updateReason">The update reason.</param> /// <param name="updateReason">The update reason.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public async Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken) public void UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
{ {
var locationType = item.LocationType; var locationType = item.LocationType;
if (locationType != LocationType.Remote && locationType != LocationType.Virtual) if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{ {
await _providerManagerFactory().SaveMetadata(item, updateReason).ConfigureAwait(false); _providerManagerFactory().SaveMetadata(item, updateReason);
} }
item.DateLastSaved = DateTime.UtcNow; item.DateLastSaved = DateTime.UtcNow;
@ -2053,7 +2052,7 @@ namespace Emby.Server.Implementations.Library
return GetNamedView(user, name, null, viewType, sortName, cancellationToken); return GetNamedView(user, name, null, viewType, sortName, cancellationToken);
} }
public async Task<UserView> GetNamedView(string name, public UserView GetNamedView(string name,
string viewType, string viewType,
string sortName, string sortName,
CancellationToken cancellationToken) CancellationToken cancellationToken)
@ -2100,7 +2099,7 @@ namespace Emby.Server.Implementations.Library
if (refresh) if (refresh)
{ {
await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) _providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
{ {
// Not sure why this is necessary but need to figure it out // Not sure why this is necessary but need to figure it out
@ -2241,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
return item; return item;
} }
public async Task<UserView> GetNamedView(string name, public UserView GetNamedView(string name,
string parentId, string parentId,
string viewType, string viewType,
string sortName, string sortName,
@ -2294,7 +2293,7 @@ namespace Emby.Server.Implementations.Library
if (!string.Equals(viewType, item.ViewType, StringComparison.OrdinalIgnoreCase)) if (!string.Equals(viewType, item.ViewType, StringComparison.OrdinalIgnoreCase))
{ {
item.ViewType = viewType; item.ViewType = viewType;
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken);
} }
var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval; var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;
@ -2822,7 +2821,7 @@ namespace Emby.Server.Implementations.Library
await _providerManagerFactory().SaveImage(item, url, image.Type, imageIndex, CancellationToken.None).ConfigureAwait(false); await _providerManagerFactory().SaveImage(item, url, image.Type, imageIndex, CancellationToken.None).ConfigureAwait(false);
await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
return item.GetImageInfo(image.Type, imageIndex); return item.GetImageInfo(image.Type, imageIndex);
} }
@ -2838,7 +2837,7 @@ namespace Emby.Server.Implementations.Library
// Remove this image to prevent it from retrying over and over // Remove this image to prevent it from retrying over and over
item.RemoveImage(image); item.RemoveImage(image);
await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
throw new InvalidOperationException(); throw new InvalidOperationException();
} }

View File

@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
await AssignTrailers(item, trailers).ConfigureAwait(false); AssignTrailers(item, trailers);
numComplete++; numComplete++;
double percent = numComplete; double percent = numComplete;
@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Library
progress.Report(100); progress.Report(100);
} }
private async Task AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers) private void AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers)
{ {
if (item is Game) if (item is Game)
{ {
@ -98,8 +98,7 @@ namespace Emby.Server.Implementations.Library
item.RemoteTrailerIds = trailerIds; item.RemoteTrailerIds = trailerIds;
var baseItem = (BaseItem)item; var baseItem = (BaseItem)item;
await baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None) baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
.ConfigureAwait(false);
} }
} }
} }

View File

@ -147,7 +147,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Items = videos Items = videos
}; };
var isInMixedFolder = resolverResult.Count > 1; var isInMixedFolder = resolverResult.Count > 1 || (parent != null && parent.IsTopParent);
foreach (var video in resolverResult) foreach (var video in resolverResult)
{ {

View File

@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Library
if (_config.Configuration.EnableFolderView) if (_config.Configuration.EnableFolderView)
{ {
var name = _localizationManager.GetLocalizedString("ViewType" + CollectionType.Folders); var name = _localizationManager.GetLocalizedString("ViewType" + CollectionType.Folders);
list.Add(await _libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken).ConfigureAwait(false)); list.Add(_libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken));
} }
if (query.IncludeExternalContent) if (query.IncludeExternalContent)
@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.Library
if (_config.Configuration.EnableChannelView && channels.Length > 0) if (_config.Configuration.EnableChannelView && channels.Length > 0)
{ {
list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false)); list.Add(_channelManager.GetInternalChannelFolder(cancellationToken));
} }
else else
{ {
@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId)) if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
{ {
list.Add(await _liveTvManager.GetInternalLiveTvFolder(CancellationToken.None).ConfigureAwait(false)); list.Add(_liveTvManager.GetInternalLiveTvFolder(CancellationToken.None));
} }
} }
@ -158,14 +158,14 @@ namespace Emby.Server.Implementations.Library
.ToArray(); .ToArray();
} }
public Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken) public UserView GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
{ {
var uniqueId = parentId + "subview" + type; var uniqueId = parentId + "subview" + type;
return _libraryManager.GetNamedView(name, parentId, type, sortName, uniqueId, cancellationToken); return _libraryManager.GetNamedView(name, parentId, type, sortName, uniqueId, cancellationToken);
} }
public Task<UserView> GetUserSubView(string parentId, string type, string sortName, CancellationToken cancellationToken) public UserView GetUserSubView(string parentId, string type, string sortName, CancellationToken cancellationToken)
{ {
var name = _localizationManager.GetLocalizedString("ViewType" + type); var name = _localizationManager.GetLocalizedString("ViewType" + type);

View File

@ -173,11 +173,11 @@ namespace Emby.Server.Implementations.LiveTv
} }
} }
public async Task<QueryResult<BaseItem>> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken) public QueryResult<BaseItem> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken)
{ {
var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId); var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId);
var topFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var topFolder = GetInternalLiveTvFolder(cancellationToken);
var internalQuery = new InternalItemsQuery(user) var internalQuery = new InternalItemsQuery(user)
{ {
@ -565,7 +565,7 @@ namespace Emby.Server.Implementations.LiveTv
} }
else if (forceUpdate) else if (forceUpdate)
{ {
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken);
} }
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
@ -760,7 +760,7 @@ namespace Emby.Server.Implementations.LiveTv
return new Tuple<LiveTvProgram, bool, bool>(item, isNew, isUpdated); return new Tuple<LiveTvProgram, bool, bool>(item, isNew, isUpdated);
} }
private async Task<Guid> CreateRecordingRecord(RecordingInfo info, string serviceName, Guid parentFolderId, CancellationToken cancellationToken) private Guid CreateRecordingRecord(RecordingInfo info, string serviceName, Guid parentFolderId, CancellationToken cancellationToken)
{ {
var isNew = false; var isNew = false;
@ -892,7 +892,7 @@ namespace Emby.Server.Implementations.LiveTv
else if (dataChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged) else if (dataChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged)
{ {
metadataRefreshMode = MetadataRefreshMode.FullRefresh; metadataRefreshMode = MetadataRefreshMode.FullRefresh;
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken);
} }
if (info.Status != RecordingStatus.InProgress) if (info.Status != RecordingStatus.InProgress)
@ -928,7 +928,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId); var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId);
var topFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var topFolder = GetInternalLiveTvFolder(cancellationToken);
if (query.OrderBy.Length == 0) if (query.OrderBy.Length == 0)
{ {
@ -1007,11 +1007,11 @@ namespace Emby.Server.Implementations.LiveTv
return result; return result;
} }
public async Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken) public QueryResult<BaseItem> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
{ {
var user = _userManager.GetUserById(query.UserId); var user = _userManager.GetUserById(query.UserId);
var topFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var topFolder = GetInternalLiveTvFolder(cancellationToken);
var internalQuery = new InternalItemsQuery(user) var internalQuery = new InternalItemsQuery(user)
{ {
@ -1072,11 +1072,11 @@ namespace Emby.Server.Implementations.LiveTv
return result; return result;
} }
public async Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken) public QueryResult<BaseItemDto> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
{ {
RemoveFields(options); RemoveFields(options);
var internalResult = await GetRecommendedProgramsInternal(query, options, cancellationToken).ConfigureAwait(false); var internalResult = GetRecommendedProgramsInternal(query, options, cancellationToken);
var user = _userManager.GetUserById(query.UserId); var user = _userManager.GetUserById(query.UserId);
@ -1302,7 +1302,7 @@ namespace Emby.Server.Implementations.LiveTv
var list = new List<LiveTvChannel>(); var list = new List<LiveTvChannel>();
var numComplete = 0; var numComplete = 0;
var parentFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var parentFolder = GetInternalLiveTvFolder(cancellationToken);
var parentFolderId = parentFolder.Id; var parentFolderId = parentFolder.Id;
foreach (var channelInfo in allChannelsList) foreach (var channelInfo in allChannelsList)
@ -1425,7 +1425,7 @@ namespace Emby.Server.Implementations.LiveTv
// TODO: Do this in bulk // TODO: Do this in bulk
foreach (var program in updatedPrograms) foreach (var program in updatedPrograms)
{ {
await _libraryManager.UpdateItem(program, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); _libraryManager.UpdateItem(program, ItemUpdateType.MetadataImport, cancellationToken);
} }
currentChannel.IsMovie = isMovie; currentChannel.IsMovie = isMovie;
@ -1434,7 +1434,7 @@ namespace Emby.Server.Implementations.LiveTv
currentChannel.IsKids = isKids; currentChannel.IsKids = isKids;
currentChannel.IsSeries = iSSeries; currentChannel.IsSeries = iSSeries;
await currentChannel.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); currentChannel.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
} }
catch (OperationCanceledException) catch (OperationCanceledException)
{ {
@ -1549,9 +1549,8 @@ namespace Emby.Server.Implementations.LiveTv
var results = await Task.WhenAll(tasks).ConfigureAwait(false); var results = await Task.WhenAll(tasks).ConfigureAwait(false);
var recordingTasks = results.SelectMany(i => i.ToList()).Select(i => CreateRecordingRecord(i.Item1, i.Item2.Name, internalLiveTvFolderId, cancellationToken)); var idList = results.SelectMany(i => i.ToList()).Select(i => CreateRecordingRecord(i.Item1, i.Item2.Name, internalLiveTvFolderId, cancellationToken))
.ToArray();
var idList = await Task.WhenAll(recordingTasks).ConfigureAwait(false);
await CleanDatabaseInternal(idList, new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false); await CleanDatabaseInternal(idList, new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
@ -1726,7 +1725,7 @@ namespace Emby.Server.Implementations.LiveTv
return new QueryResult<BaseItem>(); return new QueryResult<BaseItem>();
} }
var folder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var folder = GetInternalLiveTvFolder(cancellationToken);
// TODO: Figure out how to merge emby recordings + service recordings // TODO: Figure out how to merge emby recordings + service recordings
if (_services.Length == 1) if (_services.Length == 1)
@ -2143,18 +2142,6 @@ namespace Emby.Server.Implementations.LiveTv
}; };
} }
public Task OnRecordingFileDeleted(BaseItem recording)
{
var service = GetService(recording);
if (service is EmbyTV.EmbyTV)
{
return service.DeleteRecordingAsync(GetItemExternalId(recording), CancellationToken.None);
}
return Task.FromResult(true);
}
public async Task DeleteRecording(string recordingId) public async Task DeleteRecording(string recordingId)
{ {
var recording = await GetInternalRecording(recordingId, CancellationToken.None).ConfigureAwait(false); var recording = await GetInternalRecording(recordingId, CancellationToken.None).ConfigureAwait(false);
@ -2171,13 +2158,17 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var service = GetService(recording.ServiceName); var service = GetService(recording.ServiceName);
try if (service != null)
{
await service.DeleteRecordingAsync(GetItemExternalId(recording), CancellationToken.None).ConfigureAwait(false);
}
catch (ResourceNotFoundException)
{ {
// handle the service being uninstalled and the item hanging around in the database
try
{
await service.DeleteRecordingAsync(GetItemExternalId(recording), CancellationToken.None).ConfigureAwait(false);
}
catch (ResourceNotFoundException)
{
}
} }
_lastRecordingRefreshTime = DateTime.MinValue; _lastRecordingRefreshTime = DateTime.MinValue;
@ -2387,7 +2378,7 @@ namespace Emby.Server.Implementations.LiveTv
MinEndDate = now, MinEndDate = now,
Limit = channelIds.Length, Limit = channelIds.Length,
OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.StartDate, SortOrder.Ascending) }, OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.StartDate, SortOrder.Ascending) },
TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Result.Id.ToString("N") }, TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Id.ToString("N") },
DtoOptions = options DtoOptions = options
}) : new List<BaseItem>(); }) : new List<BaseItem>();
@ -2910,11 +2901,11 @@ namespace Emby.Server.Implementations.LiveTv
return service.ResetTuner(parts[1], cancellationToken); return service.ResetTuner(parts[1], cancellationToken);
} }
public async Task<BaseItemDto> GetLiveTvFolder(string userId, CancellationToken cancellationToken) public BaseItemDto GetLiveTvFolder(string userId, CancellationToken cancellationToken)
{ {
var user = string.IsNullOrEmpty(userId) ? null : _userManager.GetUserById(userId); var user = string.IsNullOrEmpty(userId) ? null : _userManager.GetUserById(userId);
var folder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); var folder = GetInternalLiveTvFolder(cancellationToken);
return _dtoService.GetBaseItemDto(folder, new DtoOptions(), user); return _dtoService.GetBaseItemDto(folder, new DtoOptions(), user);
} }
@ -2930,10 +2921,10 @@ namespace Emby.Server.Implementations.LiveTv
options.Fields = fields.ToArray(fields.Count); options.Fields = fields.ToArray(fields.Count);
} }
public async Task<Folder> GetInternalLiveTvFolder(CancellationToken cancellationToken) public Folder GetInternalLiveTvFolder(CancellationToken cancellationToken)
{ {
var name = _localization.GetLocalizedString("ViewTypeLiveTV"); var name = _localization.GetLocalizedString("ViewTypeLiveTV");
return await _libraryManager.GetNamedView(name, CollectionType.LiveTv, name, cancellationToken).ConfigureAwait(false); return _libraryManager.GetNamedView(name, CollectionType.LiveTv, name, cancellationToken);
} }
public async Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true) public async Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true)

View File

@ -209,7 +209,7 @@ namespace Emby.Server.Implementations.Playlists
newList.AddRange(list); newList.AddRange(list);
playlist.LinkedChildren = newList.ToArray(newList.Count); playlist.LinkedChildren = newList.ToArray(newList.Count);
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem) _providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem)
{ {
@ -237,7 +237,7 @@ namespace Emby.Server.Implementations.Playlists
.Select(i => i.Item1) .Select(i => i.Item1)
.ToArray(); .ToArray();
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem) _providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem)
{ {
@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Playlists
playlist.LinkedChildren = newList.ToArray(newList.Count); playlist.LinkedChildren = newList.ToArray(newList.Count);
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
} }
public Folder GetPlaylistsFolder(string userId) public Folder GetPlaylistsFolder(string userId)

View File

@ -442,11 +442,6 @@ namespace Emby.Server.Implementations.Updates
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns> /// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken) public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken)
{ {
if (!_config.CommonConfiguration.EnableAutoUpdate)
{
return new PackageVersionInfo[] { };
}
var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
var systemUpdateLevel = GetSystemUpdateLevel(); var systemUpdateLevel = GetSystemUpdateLevel();

View File

@ -101,7 +101,7 @@ namespace MediaBrowser.Api
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; } public string Fields { get; set; }
/// <summary> /// <summary>
/// Gets the filters. /// Gets the filters.
/// </summary> /// </summary>
@ -160,7 +160,7 @@ namespace MediaBrowser.Api
[ApiMember(Name = "ChannelIds", Description = "Optional. Specify one or more channel id's, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] [ApiMember(Name = "ChannelIds", Description = "Optional. Specify one or more channel id's, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string ChannelIds { get; set; } public string ChannelIds { get; set; }
/// <summary> /// <summary>
/// Gets the filters. /// Gets the filters.
/// </summary> /// </summary>
@ -177,7 +177,7 @@ namespace MediaBrowser.Api
return val.Split(',').Select(v => (ItemFilter)Enum.Parse(typeof(ItemFilter), v, true)); return val.Split(',').Select(v => (ItemFilter)Enum.Parse(typeof(ItemFilter), v, true));
} }
} }
[Route("/Channels/Folder", "GET", Summary = "Gets the users channel folder, along with configured images")] [Route("/Channels/Folder", "GET", Summary = "Gets the users channel folder, along with configured images")]
public class GetChannelFolder : IReturn<BaseItemDto> public class GetChannelFolder : IReturn<BaseItemDto>
{ {
@ -209,9 +209,9 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public async Task<object> Get(GetChannelFolder request) public object Get(GetChannelFolder request)
{ {
return ToOptimizedResult(await _channelManager.GetChannelFolder(request.UserId, CancellationToken.None).ConfigureAwait(false)); return ToOptimizedResult(_channelManager.GetChannelFolder(request.UserId, CancellationToken.None));
} }
public async Task<object> Get(GetChannels request) public async Task<object> Get(GetChannels request)

View File

@ -246,7 +246,7 @@ namespace MediaBrowser.Api.Dlna
if (string.IsNullOrEmpty(notificationType)) if (string.IsNullOrEmpty(notificationType))
{ {
return GetSubscriptionResponse(eventManager.RenewEventSubscription(subscriptionId, timeoutString)); return GetSubscriptionResponse(eventManager.RenewEventSubscription(subscriptionId, notificationType, timeoutString, callback));
} }
return GetSubscriptionResponse(eventManager.CreateEventSubscription(notificationType, timeoutString, callback)); return GetSubscriptionResponse(eventManager.CreateEventSubscription(notificationType, timeoutString, callback));

View File

@ -471,9 +471,7 @@ namespace MediaBrowser.Api.Images
var item = _userManager.GetUserById(userId); var item = _userManager.GetUserById(userId);
var task = item.DeleteImage(request.Type, request.Index ?? 0); item.DeleteImage(request.Type, request.Index ?? 0);
Task.WaitAll(task);
} }
/// <summary> /// <summary>
@ -484,9 +482,7 @@ namespace MediaBrowser.Api.Images
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
var task = item.DeleteImage(request.Type, request.Index ?? 0); item.DeleteImage(request.Type, request.Index ?? 0);
Task.WaitAll(task);
} }
/// <summary> /// <summary>
@ -497,9 +493,7 @@ namespace MediaBrowser.Api.Images
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
var task = UpdateItemIndex(item, request.Type, request.Index, request.NewIndex); UpdateItemIndex(item, request.Type, request.Index, request.NewIndex);
Task.WaitAll(task);
} }
/// <summary> /// <summary>
@ -510,9 +504,9 @@ namespace MediaBrowser.Api.Images
/// <param name="currentIndex">Index of the current.</param> /// <param name="currentIndex">Index of the current.</param>
/// <param name="newIndex">The new index.</param> /// <param name="newIndex">The new index.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
private Task UpdateItemIndex(IHasMetadata item, ImageType type, int currentIndex, int newIndex) private void UpdateItemIndex(IHasMetadata item, ImageType type, int currentIndex, int newIndex)
{ {
return item.SwapImages(type, currentIndex, newIndex); item.SwapImages(type, currentIndex, newIndex);
} }
/// <summary> /// <summary>
@ -558,7 +552,7 @@ namespace MediaBrowser.Api.Images
var supportedImageEnhancers = request.EnableImageEnhancers ? _imageProcessor.GetSupportedEnhancers(item, request.Type) : new List<IImageEnhancer>(); var supportedImageEnhancers = request.EnableImageEnhancers ? _imageProcessor.GetSupportedEnhancers(item, request.Type) : new List<IImageEnhancer>();
var cropwhitespace = request.Type == ImageType.Logo || var cropwhitespace = request.Type == ImageType.Logo ||
request.Type == ImageType.Art request.Type == ImageType.Art
|| (request.Type == ImageType.Primary && item is LiveTvChannel); || (request.Type == ImageType.Primary && item is LiveTvChannel);
@ -733,7 +727,7 @@ namespace MediaBrowser.Api.Images
await _providerManager.SaveImage(entity, memoryStream, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false); await _providerManager.SaveImage(entity, memoryStream, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false);
await entity.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); entity.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
} }
} }
} }

View File

@ -84,7 +84,7 @@ namespace MediaBrowser.Api.Images
} }
[Route("/Items/{Id}/RemoteImages/Download", "POST", Summary = "Downloads a remote image for an item")] [Route("/Items/{Id}/RemoteImages/Download", "POST", Summary = "Downloads a remote image for an item")]
[Authenticated(Roles="Admin")] [Authenticated(Roles = "Admin")]
public class DownloadRemoteImage : BaseDownloadRemoteImage public class DownloadRemoteImage : BaseDownloadRemoteImage
{ {
/// <summary> /// <summary>
@ -207,7 +207,7 @@ namespace MediaBrowser.Api.Images
{ {
await _providerManager.SaveImage(item, request.ImageUrl, request.Type, null, CancellationToken.None).ConfigureAwait(false); await _providerManager.SaveImage(item, request.ImageUrl, request.Type, null, CancellationToken.None).ConfigureAwait(false);
await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
} }
/// <summary> /// <summary>
@ -232,9 +232,9 @@ namespace MediaBrowser.Api.Images
contentPath = _fileSystem.ReadAllText(pointerCachePath); contentPath = _fileSystem.ReadAllText(pointerCachePath);
if (_fileSystem.FileExists(contentPath)) if (_fileSystem.FileExists(contentPath))
{ {
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false); return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
} }
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
@ -273,7 +273,7 @@ namespace MediaBrowser.Api.Images
var fullCachePath = GetFullCachePath(urlHash + "." + ext); var fullCachePath = GetFullCachePath(urlHash + "." + ext);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath)); _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath));
using (var stream = result.Content) using (var stream = result.Content)
{ {
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
@ -282,7 +282,7 @@ namespace MediaBrowser.Api.Images
} }
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath)); _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath));
_fileSystem.WriteAllText(pointerCachePath, fullCachePath); _fileSystem.WriteAllText(pointerCachePath, fullCachePath);
} }

View File

@ -193,13 +193,6 @@ namespace MediaBrowser.Api
} }
public void Post(UpdateItem request) public void Post(UpdateItem request)
{
var task = UpdateItem(request);
Task.WaitAll(task);
}
private async Task UpdateItem(UpdateItem request)
{ {
var item = _libraryManager.GetItemById(request.ItemId); var item = _libraryManager.GetItemById(request.ItemId);
@ -216,7 +209,7 @@ namespace MediaBrowser.Api
item.OnMetadataChanged(); item.OnMetadataChanged();
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
if (isLockedChanged && item.IsFolder) if (isLockedChanged && item.IsFolder)
{ {
@ -225,7 +218,7 @@ namespace MediaBrowser.Api
foreach (var child in folder.GetRecursiveChildren()) foreach (var child in folder.GetRecursiveChildren())
{ {
child.IsLocked = newLockData; child.IsLocked = newLockData;
await child.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); child.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
} }
} }
} }

View File

@ -892,11 +892,11 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedSerializedResultUsingCache(info); return ToOptimizedSerializedResultUsingCache(info);
} }
public async Task<object> Get(GetChannels request) public object Get(GetChannels request)
{ {
var options = GetDtoOptions(_authContext, request); var options = GetDtoOptions(_authContext, request);
var channelResult = await _liveTvManager.GetInternalChannels(new LiveTvChannelQuery var channelResult = _liveTvManager.GetInternalChannels(new LiveTvChannelQuery
{ {
ChannelType = request.Type, ChannelType = request.Type,
UserId = request.UserId, UserId = request.UserId,
@ -915,7 +915,7 @@ namespace MediaBrowser.Api.LiveTv
SortOrder = request.SortOrder ?? SortOrder.Ascending, SortOrder = request.SortOrder ?? SortOrder.Ascending,
AddCurrentProgram = request.AddCurrentProgram AddCurrentProgram = request.AddCurrentProgram
}, options, CancellationToken.None).ConfigureAwait(false); }, options, CancellationToken.None);
var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(request.UserId); var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(request.UserId);
@ -958,9 +958,9 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
public async Task<object> Get(GetLiveTvFolder request) public object Get(GetLiveTvFolder request)
{ {
return ToOptimizedResult(await _liveTvManager.GetLiveTvFolder(request.UserId, CancellationToken.None).ConfigureAwait(false)); return ToOptimizedResult(_liveTvManager.GetLiveTvFolder(request.UserId, CancellationToken.None));
} }
public async Task<object> Get(GetPrograms request) public async Task<object> Get(GetPrograms request)
@ -1020,7 +1020,7 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public async Task<object> Get(GetRecommendedPrograms request) public object Get(GetRecommendedPrograms request)
{ {
var query = new RecommendedProgramQuery var query = new RecommendedProgramQuery
{ {
@ -1036,7 +1036,7 @@ namespace MediaBrowser.Api.LiveTv
EnableTotalRecordCount = request.EnableTotalRecordCount EnableTotalRecordCount = request.EnableTotalRecordCount
}; };
var result = await _liveTvManager.GetRecommendedPrograms(query, GetDtoOptions(_authContext, request), CancellationToken.None).ConfigureAwait(false); var result = _liveTvManager.GetRecommendedPrograms(query, GetDtoOptions(_authContext, request), CancellationToken.None);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }

View File

@ -40,7 +40,6 @@
<Compile Include="..\SharedVersion.cs"> <Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link> <Link>Properties\SharedVersion.cs</Link>
</Compile> </Compile>
<Compile Include="BasePeriodicWebSocketListener.cs" />
<Compile Include="BrandingService.cs" /> <Compile Include="BrandingService.cs" />
<Compile Include="ChannelService.cs" /> <Compile Include="ChannelService.cs" />
<Compile Include="Devices\DeviceService.cs" /> <Compile Include="Devices\DeviceService.cs" />

View File

@ -4,6 +4,7 @@ using MediaBrowser.Model.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
namespace MediaBrowser.Api.ScheduledTasks namespace MediaBrowser.Api.ScheduledTasks

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
namespace MediaBrowser.Api.System namespace MediaBrowser.Api.System

View File

@ -117,7 +117,9 @@ namespace MediaBrowser.Api.UserLibrary
IsVirtualItem = false, IsVirtualItem = false,
CollapseBoxSetItems = false, CollapseBoxSetItems = false,
EnableTotalRecordCount = request.EnableTotalRecordCount, EnableTotalRecordCount = request.EnableTotalRecordCount,
AncestorIds = ancestorIds.ToArray() AncestorIds = ancestorIds.ToArray(),
IncludeItemTypes = request.GetIncludeItemTypes(),
ExcludeItemTypes = request.GetExcludeItemTypes()
}); });
var returnItems = _dtoService.GetBaseItemDtos(itemsResult.Items, options, user); var returnItems = _dtoService.GetBaseItemDtos(itemsResult.Items, options, user);

View File

@ -109,13 +109,6 @@ namespace MediaBrowser.Api
} }
public void Delete(DeleteAlternateSources request) public void Delete(DeleteAlternateSources request)
{
var task = DeleteAsync(request);
Task.WaitAll(task);
}
public async Task DeleteAsync(DeleteAlternateSources request)
{ {
var video = (Video)_libraryManager.GetItemById(request.Id); var video = (Video)_libraryManager.GetItemById(request.Id);
@ -123,21 +116,14 @@ namespace MediaBrowser.Api
{ {
link.PrimaryVersionId = null; link.PrimaryVersionId = null;
await link.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); link.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
} }
video.LinkedAlternateVersions = Video.EmptyLinkedChildArray; video.LinkedAlternateVersions = Video.EmptyLinkedChildArray;
await video.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); video.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
} }
public void Post(MergeVersions request) public void Post(MergeVersions request)
{
var task = PostAsync(request);
Task.WaitAll(task);
}
public async Task PostAsync(MergeVersions request)
{ {
var items = request.Ids.Split(',') var items = request.Ids.Split(',')
.Select(i => _libraryManager.GetItemById(i)) .Select(i => _libraryManager.GetItemById(i))
@ -162,19 +148,19 @@ namespace MediaBrowser.Api
if (primaryVersion == null) if (primaryVersion == null)
{ {
primaryVersion = items.OrderBy(i => primaryVersion = items.OrderBy(i =>
{
if (i.Video3DFormat.HasValue)
{ {
return 1; if (i.Video3DFormat.HasValue)
} {
return 1;
}
if (i.VideoType != Model.Entities.VideoType.VideoFile) if (i.VideoType != Model.Entities.VideoType.VideoFile)
{ {
return 1; return 1;
} }
return 0; return 0;
}) })
.ThenByDescending(i => .ThenByDescending(i =>
{ {
var stream = i.GetDefaultVideoStream(); var stream = i.GetDefaultVideoStream();
@ -190,7 +176,7 @@ namespace MediaBrowser.Api
{ {
item.PrimaryVersionId = primaryVersion.Id.ToString("N"); item.PrimaryVersionId = primaryVersion.Id.ToString("N");
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
list.Add(new LinkedChild list.Add(new LinkedChild
{ {
@ -201,7 +187,7 @@ namespace MediaBrowser.Api
primaryVersion.LinkedAlternateVersions = list.ToArray(); primaryVersion.LinkedAlternateVersions = list.ToArray();
await primaryVersion.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); primaryVersion.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
} }
} }
} }

View File

@ -117,14 +117,13 @@ namespace MediaBrowser.Controller.Channels
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>BaseItemDto.</returns> /// <returns>BaseItemDto.</returns>
Task<Folder> GetInternalChannelFolder(CancellationToken cancellationToken); Folder GetInternalChannelFolder(CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the channel folder. /// Gets the channel folder.
/// </summary> /// </summary>
/// <param name="userId">The user identifier.</param> /// <param name="userId">The user identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>BaseItemDto.</returns> BaseItemDto GetChannelFolder(string userId, CancellationToken cancellationToken);
Task<BaseItemDto> GetChannelFolder(string userId, CancellationToken cancellationToken);
} }
} }

View File

@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Dlna
/// <summary> /// <summary>
/// Renews the event subscription. /// Renews the event subscription.
/// </summary> /// </summary>
EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string requestedTimeoutString); EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl);
/// <summary> /// <summary>
/// Creates the event subscription. /// Creates the event subscription.

View File

@ -1281,8 +1281,8 @@ namespace MediaBrowser.Controller.Entities
{ {
var subOptions = new MetadataRefreshOptions(options); var subOptions = new MetadataRefreshOptions(options);
if (!i.ExtraType.HasValue || if (!i.ExtraType.HasValue ||
i.ExtraType.Value != Model.Entities.ExtraType.ThemeSong || i.ExtraType.Value != Model.Entities.ExtraType.ThemeSong ||
i.OwnerId != ownerId || i.OwnerId != ownerId ||
i.ParentId != Guid.Empty) i.ParentId != Guid.Empty)
{ {
@ -1356,14 +1356,20 @@ namespace MediaBrowser.Controller.Entities
internal virtual bool IsValidFromResolver(BaseItem newItem) internal virtual bool IsValidFromResolver(BaseItem newItem)
{ {
var current = this; return true;
}
if (current.IsInMixedFolder != newItem.IsInMixedFolder) internal virtual ItemUpdateType UpdateFromResolvedItem(BaseItem newItem)
{
var updateType = ItemUpdateType.None;
if (IsInMixedFolder != newItem.IsInMixedFolder)
{ {
return false; IsInMixedFolder = newItem.IsInMixedFolder;
updateType |= ItemUpdateType.MetadataImport;
} }
return true; return updateType;
} }
public void AfterMetadataRefresh() public void AfterMetadataRefresh()
@ -1966,14 +1972,14 @@ namespace MediaBrowser.Controller.Entities
/// <param name="type">The type.</param> /// <param name="type">The type.</param>
/// <param name="index">The index.</param> /// <param name="index">The index.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public Task DeleteImage(ImageType type, int index) public void DeleteImage(ImageType type, int index)
{ {
var info = GetImageInfo(type, index); var info = GetImageInfo(type, index);
if (info == null) if (info == null)
{ {
// Nothing to do // Nothing to do
return Task.FromResult(true); return;
} }
// Remove it from the item // Remove it from the item
@ -1984,7 +1990,7 @@ namespace MediaBrowser.Controller.Entities
FileSystem.DeleteFile(info.Path); FileSystem.DeleteFile(info.Path);
} }
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None); UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
} }
public void RemoveImage(ItemImageInfo image) public void RemoveImage(ItemImageInfo image)
@ -1997,9 +2003,9 @@ namespace MediaBrowser.Controller.Entities
ImageInfos = ImageInfos.Except(deletedImages).ToArray(); ImageInfos = ImageInfos.Except(deletedImages).ToArray();
} }
public virtual Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken) public virtual void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{ {
return LibraryManager.UpdateItem(this, updateReason, cancellationToken); LibraryManager.UpdateItem(this, updateReason, cancellationToken);
} }
/// <summary> /// <summary>
@ -2209,7 +2215,7 @@ namespace MediaBrowser.Controller.Entities
return type == ImageType.Backdrop || type == ImageType.Screenshot || type == ImageType.Chapter; return type == ImageType.Backdrop || type == ImageType.Screenshot || type == ImageType.Chapter;
} }
public Task SwapImages(ImageType type, int index1, int index2) public void SwapImages(ImageType type, int index1, int index2)
{ {
if (!AllowsMultipleImages(type)) if (!AllowsMultipleImages(type))
{ {
@ -2222,13 +2228,13 @@ namespace MediaBrowser.Controller.Entities
if (info1 == null || info2 == null) if (info1 == null || info2 == null)
{ {
// Nothing to do // Nothing to do
return Task.FromResult(true); return;
} }
if (!info1.IsLocalFile || !info2.IsLocalFile) if (!info1.IsLocalFile || !info2.IsLocalFile)
{ {
// TODO: Not supported yet // TODO: Not supported yet
return Task.FromResult(true); return;
} }
var path1 = info1.Path; var path1 = info1.Path;
@ -2240,7 +2246,7 @@ namespace MediaBrowser.Controller.Entities
info1.DateModified = FileSystem.GetLastWriteTimeUtc(info1.Path); info1.DateModified = FileSystem.GetLastWriteTimeUtc(info1.Path);
info2.DateModified = FileSystem.GetLastWriteTimeUtc(info2.Path); info2.DateModified = FileSystem.GetLastWriteTimeUtc(info2.Path);
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None); UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
} }
public virtual bool IsPlayed(User user) public virtual bool IsPlayed(User user)
@ -2526,15 +2532,6 @@ namespace MediaBrowser.Controller.Entities
return LibraryManager.DeleteItem(this, options); return LibraryManager.DeleteItem(this, options);
} }
public virtual Task OnFileDeleted()
{
// Remove from database
return Delete(new DeleteOptions
{
DeleteFileLocation = false
});
}
public virtual List<ExternalUrl> GetRelatedUrls() public virtual List<ExternalUrl> GetRelatedUrls()
{ {
return new List<ExternalUrl>(); return new List<ExternalUrl>();

View File

@ -328,11 +328,6 @@ namespace MediaBrowser.Controller.Entities
return dictionary; return dictionary;
} }
private bool IsValidFromResolver(BaseItem current, BaseItem newItem)
{
return current.IsValidFromResolver(newItem);
}
protected override void TriggerOnRefreshStart() protected override void TriggerOnRefreshStart()
{ {
} }
@ -421,10 +416,15 @@ namespace MediaBrowser.Controller.Entities
{ {
BaseItem currentChild; BaseItem currentChild;
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child)) if (currentChildren.TryGetValue(child.Id, out currentChild) && currentChild.IsValidFromResolver(child))
{ {
validChildren.Add(currentChild); validChildren.Add(currentChild);
if (currentChild.UpdateFromResolvedItem(child) > ItemUpdateType.None)
{
currentChild.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
}
continue; continue;
} }
@ -542,7 +542,6 @@ namespace MediaBrowser.Controller.Entities
if (validChildrenNeedGeneration) if (validChildrenNeedGeneration)
{ {
validChildren = Children.ToList(); validChildren = Children.ToList();
validChildrenNeedGeneration = false;
} }
await RefreshMetadataRecursive(validChildren, refreshOptions, recursive, innerProgress, cancellationToken); await RefreshMetadataRecursive(validChildren, refreshOptions, recursive, innerProgress, cancellationToken);

View File

@ -151,11 +151,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Swaps the images. /// Swaps the images.
/// </summary> /// </summary>
/// <param name="type">The type.</param> void SwapImages(ImageType type, int index1, int index2);
/// <param name="index1">The index1.</param>
/// <param name="index2">The index2.</param>
/// <returns>Task.</returns>
Task SwapImages(ImageType type, int index1, int index2);
/// <summary> /// <summary>
/// Gets or sets the primary image path. /// Gets or sets the primary image path.
@ -249,10 +245,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Updates to repository. /// Updates to repository.
/// </summary> /// </summary>
/// <param name="updateReason">The update reason.</param> void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken);
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Sets the image. /// Sets the image.

View File

@ -235,10 +235,9 @@ namespace MediaBrowser.Controller.Entities
}, CancellationToken.None); }, CancellationToken.None);
} }
public override Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken) public override void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{ {
UserManager.UpdateUser(this); UserManager.UpdateUser(this);
return Task.FromResult(true);
} }
/// <summary> /// <summary>

View File

@ -78,26 +78,26 @@ namespace MediaBrowser.Controller.Entities
case SpecialFolder.LiveTvChannels: case SpecialFolder.LiveTvChannels:
{ {
var result = await _liveTvManager.GetInternalChannels(new LiveTvChannelQuery var result = _liveTvManager.GetInternalChannels(new LiveTvChannelQuery
{ {
UserId = query.User.Id.ToString("N"), UserId = query.User.Id.ToString("N"),
Limit = query.Limit, Limit = query.Limit,
StartIndex = query.StartIndex StartIndex = query.StartIndex
}, new DtoOptions(), CancellationToken.None).ConfigureAwait(false); }, new DtoOptions(), CancellationToken.None);
return GetResult(result); return GetResult(result);
} }
case SpecialFolder.LiveTvNowPlaying: case SpecialFolder.LiveTvNowPlaying:
{ {
var result = await _liveTvManager.GetRecommendedProgramsInternal(new RecommendedProgramQuery var result = _liveTvManager.GetRecommendedProgramsInternal(new RecommendedProgramQuery
{ {
UserId = query.User.Id.ToString("N"), UserId = query.User.Id.ToString("N"),
Limit = query.Limit, Limit = query.Limit,
IsAiring = true IsAiring = true
}, new Dto.DtoOptions(), CancellationToken.None).ConfigureAwait(false); }, new Dto.DtoOptions(), CancellationToken.None);
return GetResult(result); return GetResult(result);
} }
@ -142,22 +142,22 @@ namespace MediaBrowser.Controller.Entities
return GetResult(user.RootFolder.GetChildren(user, true), queryParent, query); return GetResult(user.RootFolder.GetChildren(user, true), queryParent, query);
case CollectionType.Playlists: case CollectionType.Playlists:
return GetPlaylistsView(queryParent, user, query); return GetPlaylistsView(queryParent, user, query);
case CollectionType.BoxSets: case CollectionType.BoxSets:
return GetBoxsetView(queryParent, user, query); return GetBoxsetView(queryParent, user, query);
case CollectionType.TvShows: case CollectionType.TvShows:
return await GetTvView(queryParent, user, query).ConfigureAwait(false); return GetTvView(queryParent, user, query);
case CollectionType.Movies: case CollectionType.Movies:
return await GetMovieFolders(queryParent, user, query).ConfigureAwait(false); return GetMovieFolders(queryParent, user, query);
case SpecialFolder.TvShowSeries: case SpecialFolder.TvShowSeries:
return GetTvSeries(queryParent, user, query); return GetTvSeries(queryParent, user, query);
case SpecialFolder.TvGenres: case SpecialFolder.TvGenres:
return await GetTvGenres(queryParent, user, query).ConfigureAwait(false); return GetTvGenres(queryParent, user, query);
case SpecialFolder.TvGenre: case SpecialFolder.TvGenre:
return GetTvGenreItems(queryParent, displayParent, user, query); return GetTvGenreItems(queryParent, displayParent, user, query);
@ -178,10 +178,10 @@ namespace MediaBrowser.Controller.Entities
return GetMovieLatest(queryParent, user, query); return GetMovieLatest(queryParent, user, query);
case SpecialFolder.MovieGenres: case SpecialFolder.MovieGenres:
return await GetMovieGenres(queryParent, user, query).ConfigureAwait(false); return GetMovieGenres(queryParent, user, query);
case SpecialFolder.MovieGenre: case SpecialFolder.MovieGenre:
return GetMovieGenreItems(queryParent, displayParent, user, query); return GetMovieGenreItems(queryParent, displayParent, user, query);
case SpecialFolder.MovieResume: case SpecialFolder.MovieResume:
return GetMovieResume(queryParent, user, query); return GetMovieResume(queryParent, user, query);
@ -199,7 +199,7 @@ namespace MediaBrowser.Controller.Entities
return GetFavoriteSeries(queryParent, user, query); return GetFavoriteSeries(queryParent, user, query);
case CollectionType.Music: case CollectionType.Music:
return await GetMusicFolders(queryParent, user, query).ConfigureAwait(false); return GetMusicFolders(queryParent, user, query);
case SpecialFolder.MusicGenres: case SpecialFolder.MusicGenres:
return GetMusicGenres(queryParent, user, query); return GetMusicGenres(queryParent, user, query);
@ -223,7 +223,7 @@ namespace MediaBrowser.Controller.Entities
return GetMusicSongs(queryParent, user, query); return GetMusicSongs(queryParent, user, query);
case SpecialFolder.MusicFavorites: case SpecialFolder.MusicFavorites:
return await GetMusicFavorites(queryParent, user, query).ConfigureAwait(false); return GetMusicFavorites(queryParent, user, query);
case SpecialFolder.MusicFavoriteAlbums: case SpecialFolder.MusicFavoriteAlbums:
return GetFavoriteAlbums(queryParent, user, query); return GetFavoriteAlbums(queryParent, user, query);
@ -245,7 +245,7 @@ namespace MediaBrowser.Controller.Entities
} }
} }
private async Task<QueryResult<BaseItem>> GetMusicFolders(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMusicFolders(Folder parent, User user, InternalItemsQuery query)
{ {
if (query.Recursive) if (query.Recursive)
{ {
@ -262,25 +262,25 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>(); var list = new List<BaseItem>();
list.Add(await GetUserView(SpecialFolder.MusicLatest, "0", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicLatest, "0", parent));
list.Add(await GetUserView(SpecialFolder.MusicPlaylists, "1", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicPlaylists, "1", parent));
list.Add(await GetUserView(SpecialFolder.MusicAlbums, "2", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicAlbums, "2", parent));
list.Add(await GetUserView(SpecialFolder.MusicAlbumArtists, "3", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicAlbumArtists, "3", parent));
list.Add(await GetUserView(SpecialFolder.MusicArtists, "4", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicArtists, "4", parent));
list.Add(await GetUserView(SpecialFolder.MusicSongs, "5", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicSongs, "5", parent));
list.Add(await GetUserView(SpecialFolder.MusicGenres, "6", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicGenres, "6", parent));
list.Add(await GetUserView(SpecialFolder.MusicFavorites, "7", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicFavorites, "7", parent));
return GetResult(list, parent, query); return GetResult(list, parent, query);
} }
private async Task<QueryResult<BaseItem>> GetMusicFavorites(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMusicFavorites(Folder parent, User user, InternalItemsQuery query)
{ {
var list = new List<BaseItem>(); var list = new List<BaseItem>();
list.Add(await GetUserView(SpecialFolder.MusicFavoriteAlbums, "0", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicFavoriteAlbums, "0", parent));
list.Add(await GetUserView(SpecialFolder.MusicFavoriteArtists, "1", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicFavoriteArtists, "1", parent));
list.Add(await GetUserView(SpecialFolder.MusicFavoriteSongs, "2", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MusicFavoriteSongs, "2", parent));
return GetResult(list, parent, query); return GetResult(list, parent, query);
} }
@ -426,7 +426,7 @@ namespace MediaBrowser.Controller.Entities
return 50; return 50;
} }
private async Task<QueryResult<BaseItem>> GetMovieFolders(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMovieFolders(Folder parent, User user, InternalItemsQuery query)
{ {
if (query.Recursive) if (query.Recursive)
{ {
@ -443,12 +443,12 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>(); var list = new List<BaseItem>();
list.Add(await GetUserView(SpecialFolder.MovieResume, "0", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieResume, "0", parent));
list.Add(await GetUserView(SpecialFolder.MovieLatest, "1", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieLatest, "1", parent));
list.Add(await GetUserView(SpecialFolder.MovieMovies, "2", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieMovies, "2", parent));
list.Add(await GetUserView(SpecialFolder.MovieCollections, "3", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieCollections, "3", parent));
list.Add(await GetUserView(SpecialFolder.MovieFavorites, "4", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieFavorites, "4", parent));
list.Add(await GetUserView(SpecialFolder.MovieGenres, "5", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.MovieGenres, "5", parent));
return GetResult(list, parent, query); return GetResult(list, parent, query);
} }
@ -538,9 +538,9 @@ namespace MediaBrowser.Controller.Entities
}; };
} }
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
{ {
var tasks = parent.QueryRecursive(new InternalItemsQuery(user) var genres = parent.QueryRecursive(new InternalItemsQuery(user)
{ {
IncludeItemTypes = new[] { typeof(Movie).Name }, IncludeItemTypes = new[] { typeof(Movie).Name },
Recursive = true, Recursive = true,
@ -566,8 +566,6 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i != null) .Where(i => i != null)
.Select(i => GetUserView(i.Name, SpecialFolder.MovieGenre, i.SortName, parent)); .Select(i => GetUserView(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
return GetResult(genres, parent, query); return GetResult(genres, parent, query);
} }
@ -598,7 +596,7 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query); return _libraryManager.GetItemsResult(query);
} }
private async Task<QueryResult<BaseItem>> GetTvView(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetTvView(Folder parent, User user, InternalItemsQuery query)
{ {
if (query.Recursive) if (query.Recursive)
{ {
@ -615,13 +613,13 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>(); var list = new List<BaseItem>();
list.Add(await GetUserView(SpecialFolder.TvResume, "0", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvResume, "0", parent));
list.Add(await GetUserView(SpecialFolder.TvNextUp, "1", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvNextUp, "1", parent));
list.Add(await GetUserView(SpecialFolder.TvLatest, "2", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvLatest, "2", parent));
list.Add(await GetUserView(SpecialFolder.TvShowSeries, "3", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvShowSeries, "3", parent));
list.Add(await GetUserView(SpecialFolder.TvFavoriteSeries, "4", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvFavoriteSeries, "4", parent));
list.Add(await GetUserView(SpecialFolder.TvFavoriteEpisodes, "5", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvFavoriteEpisodes, "5", parent));
list.Add(await GetUserView(SpecialFolder.TvGenres, "6", parent).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.TvGenres, "6", parent));
return GetResult(list, parent, query); return GetResult(list, parent, query);
} }
@ -679,9 +677,9 @@ namespace MediaBrowser.Controller.Entities
return _libraryManager.GetItemsResult(query); return _libraryManager.GetItemsResult(query);
} }
private async Task<QueryResult<BaseItem>> GetTvGenres(Folder parent, User user, InternalItemsQuery query) private QueryResult<BaseItem> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
{ {
var tasks = parent.QueryRecursive(new InternalItemsQuery(user) var genres = parent.QueryRecursive(new InternalItemsQuery(user)
{ {
IncludeItemTypes = new[] { typeof(Series).Name }, IncludeItemTypes = new[] { typeof(Series).Name },
Recursive = true, Recursive = true,
@ -707,8 +705,6 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i != null) .Where(i => i != null)
.Select(i => GetUserView(i.Name, SpecialFolder.TvGenre, i.SortName, parent)); .Select(i => GetUserView(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
var genres = await Task.WhenAll(tasks).ConfigureAwait(false);
return GetResult(genres, parent, query); return GetResult(genres, parent, query);
} }
@ -1740,18 +1736,18 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>(); var list = new List<BaseItem>();
//list.Add(await GetUserSubView(SpecialFolder.LiveTvNowPlaying, user, "0", parent).ConfigureAwait(false)); //list.Add(await GetUserSubView(SpecialFolder.LiveTvNowPlaying, user, "0", parent).ConfigureAwait(false));
list.Add(await GetUserView(SpecialFolder.LiveTvChannels, string.Empty, user.RootFolder).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.LiveTvChannels, string.Empty, user.RootFolder));
list.Add(await GetUserView(SpecialFolder.LiveTvRecordingGroups, string.Empty, user.RootFolder).ConfigureAwait(false)); list.Add(GetUserView(SpecialFolder.LiveTvRecordingGroups, string.Empty, user.RootFolder));
return GetResult(list, queryParent, query); return GetResult(list, queryParent, query);
} }
private Task<UserView> GetUserView(string name, string type, string sortName, BaseItem parent) private UserView GetUserView(string name, string type, string sortName, BaseItem parent)
{ {
return _userViewManager.GetUserSubView(name, parent.Id.ToString("N"), type, sortName, CancellationToken.None); return _userViewManager.GetUserSubView(name, parent.Id.ToString("N"), type, sortName, CancellationToken.None);
} }
private Task<UserView> GetUserView(string type, string sortName, BaseItem parent) private UserView GetUserView(string type, string sortName, BaseItem parent)
{ {
return _userViewManager.GetUserSubView(parent.Id.ToString("N"), type, sortName, CancellationToken.None); return _userViewManager.GetUserSubView(parent.Id.ToString("N"), type, sortName, CancellationToken.None);
} }

View File

@ -406,30 +406,31 @@ namespace MediaBrowser.Controller.Entities
} }
} }
internal override bool IsValidFromResolver(BaseItem newItem) internal override ItemUpdateType UpdateFromResolvedItem(BaseItem newItem)
{ {
var current = this; var updateType = base.UpdateFromResolvedItem(newItem);
var newAsVideo = newItem as Video; var newVideo = newItem as Video;
if (newVideo != null)
if (newAsVideo != null)
{ {
if (!current.AdditionalParts.SequenceEqual(newAsVideo.AdditionalParts, StringComparer.OrdinalIgnoreCase)) if (!AdditionalParts.SequenceEqual(newVideo.AdditionalParts, StringComparer.Ordinal))
{ {
return false; AdditionalParts = newVideo.AdditionalParts;
updateType |= ItemUpdateType.MetadataImport;
} }
if (!current.LocalAlternateVersions.SequenceEqual(newAsVideo.LocalAlternateVersions, StringComparer.OrdinalIgnoreCase)) if (!LocalAlternateVersions.SequenceEqual(newVideo.LocalAlternateVersions, StringComparer.Ordinal))
{ {
return false; LocalAlternateVersions = newVideo.LocalAlternateVersions;
updateType |= ItemUpdateType.MetadataImport;
} }
if (VideoType != newVideo.VideoType)
if (newAsVideo.VideoType != VideoType)
{ {
return false; VideoType = newVideo.VideoType;
updateType |= ItemUpdateType.MetadataImport;
} }
} }
return base.IsValidFromResolver(newItem); return updateType;
} }
public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType) public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType)
@ -521,9 +522,9 @@ namespace MediaBrowser.Controller.Entities
} }
} }
public override async Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken) public override void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{ {
await base.UpdateToRepository(updateReason, cancellationToken).ConfigureAwait(false); base.UpdateToRepository(updateReason, cancellationToken);
var localAlternates = GetLocalAlternateVersionIds() var localAlternates = GetLocalAlternateVersionIds()
.Select(i => LibraryManager.GetItemById(i)) .Select(i => LibraryManager.GetItemById(i))
@ -540,7 +541,7 @@ namespace MediaBrowser.Controller.Entities
item.Genres = Genres; item.Genres = Genres;
item.ProviderIds = ProviderIds; item.ProviderIds = ProviderIds;
await item.UpdateToRepository(ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false); item.UpdateToRepository(ItemUpdateType.MetadataDownload, cancellationToken);
} }
} }

View File

@ -207,11 +207,7 @@ namespace MediaBrowser.Controller.Library
/// <summary> /// <summary>
/// Updates the item. /// Updates the item.
/// </summary> /// </summary>
/// <param name="item">The item.</param> void UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
/// <param name="updateReason">The update reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Retrieves the item. /// Retrieves the item.
@ -330,8 +326,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="viewType">Type of the view.</param> /// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param> /// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns> UserView GetNamedView(string name,
Task<UserView> GetNamedView(string name,
string viewType, string viewType,
string sortName, string sortName,
CancellationToken cancellationToken); CancellationToken cancellationToken);
@ -345,8 +340,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="sortName">Name of the sort.</param> /// <param name="sortName">Name of the sort.</param>
/// <param name="uniqueId">The unique identifier.</param> /// <param name="uniqueId">The unique identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns> UserView GetNamedView(string name,
Task<UserView> GetNamedView(string name,
string parentId, string parentId,
string viewType, string viewType,
string sortName, string sortName,

View File

@ -13,9 +13,9 @@ namespace MediaBrowser.Controller.Library
{ {
Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken); Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);
Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken); UserView GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken);
Task<UserView> GetUserSubView(string category, string type, string sortName, CancellationToken cancellationToken); UserView GetUserSubView(string category, string type, string sortName, CancellationToken cancellationToken);
List<Tuple<BaseItem, List<BaseItem>>> GetLatestItems(LatestItemsQuery request, DtoOptions options); List<Tuple<BaseItem, List<BaseItem>>> GetLatestItems(LatestItemsQuery request, DtoOptions options);
} }

View File

@ -236,14 +236,12 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{ProgramInfoDto}}.</returns> QueryResult<BaseItemDto> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the recommended programs internal. /// Gets the recommended programs internal.
/// </summary> /// </summary>
/// <returns>Task&lt;QueryResult&lt;LiveTvProgram&gt;&gt;.</returns> QueryResult<BaseItem> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the live tv information. /// Gets the live tv information.
@ -264,8 +262,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the live tv folder. /// Gets the live tv folder.
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>BaseItemDto.</returns> Folder GetInternalLiveTvFolder(CancellationToken cancellationToken);
Task<Folder> GetInternalLiveTvFolder(CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the live tv folder. /// Gets the live tv folder.
@ -273,7 +270,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="userId">The user identifier.</param> /// <param name="userId">The user identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>BaseItemDto.</returns> /// <returns>BaseItemDto.</returns>
Task<BaseItemDto> GetLiveTvFolder(string userId, CancellationToken cancellationToken); BaseItemDto GetLiveTvFolder(string userId, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the enabled users. /// Gets the enabled users.
@ -284,7 +281,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary> /// <summary>
/// Gets the internal channels. /// Gets the internal channels.
/// </summary> /// </summary>
Task<QueryResult<BaseItem>> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken); QueryResult<BaseItem> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the internal recordings. /// Gets the internal recordings.
@ -362,13 +359,6 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
void AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> items, DtoOptions options, User user); void AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> items, DtoOptions options, User user);
/// <summary>
/// Called when [recording file deleted].
/// </summary>
/// <param name="recording">The recording.</param>
/// <returns>Task.</returns>
Task OnRecordingFileDeleted(BaseItem recording);
Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken); Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken); Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken);

View File

@ -161,10 +161,5 @@ namespace MediaBrowser.Controller.LiveTv
{ {
return LiveTvManager.DeleteRecording(this); return LiveTvManager.DeleteRecording(this);
} }
public override Task OnFileDeleted()
{
return LiveTvManager.OnRecordingFileDeleted(this);
}
} }
} }

View File

@ -160,10 +160,5 @@ namespace MediaBrowser.Controller.LiveTv
{ {
return LiveTvManager.DeleteRecording(this); return LiveTvManager.DeleteRecording(this);
} }
public override Task OnFileDeleted()
{
return LiveTvManager.OnRecordingFileDeleted(this);
}
} }
} }

View File

@ -176,6 +176,7 @@
<Compile Include="MediaEncoding\MediaStreamSelector.cs" /> <Compile Include="MediaEncoding\MediaStreamSelector.cs" />
<Compile Include="Net\AuthenticatedAttribute.cs" /> <Compile Include="Net\AuthenticatedAttribute.cs" />
<Compile Include="Net\AuthorizationInfo.cs" /> <Compile Include="Net\AuthorizationInfo.cs" />
<Compile Include="Net\BasePeriodicWebSocketListener.cs" />
<Compile Include="Net\IAuthorizationContext.cs" /> <Compile Include="Net\IAuthorizationContext.cs" />
<Compile Include="Net\IAuthService.cs" /> <Compile Include="Net\IAuthService.cs" />
<Compile Include="Net\IHasResultFactory.cs" /> <Compile Include="Net\IHasResultFactory.cs" />

View File

@ -4,12 +4,11 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
namespace MediaBrowser.Api namespace MediaBrowser.Controller.Net
{ {
/// <summary> /// <summary>
/// Starts sending data over a web socket periodically when a message is received, and then stops when a corresponding stop message is received /// Starts sending data over a web socket periodically when a message is received, and then stops when a corresponding stop message is received
@ -93,7 +92,7 @@ namespace MediaBrowser.Api
{ {
get get
{ {
return true; return false;
} }
} }

View File

@ -119,16 +119,12 @@ namespace MediaBrowser.Controller.Providers
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <param name="updateType">Type of the update.</param> /// <param name="updateType">Type of the update.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType); void SaveMetadata(IHasMetadata item, ItemUpdateType updateType);
/// <summary> /// <summary>
/// Saves the metadata. /// Saves the metadata.
/// </summary> /// </summary>
/// <param name="item">The item.</param> void SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable<string> savers);
/// <param name="updateType">Type of the update.</param>
/// <param name="savers">The savers.</param>
/// <returns>Task.</returns>
Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable<string> savers);
/// <summary> /// <summary>
/// Gets the metadata options. /// Gets the metadata options.

View File

@ -204,7 +204,7 @@ namespace MediaBrowser.Providers.Manager
LibraryManager.UpdatePeople(baseItem, result.People); LibraryManager.UpdatePeople(baseItem, result.People);
await SavePeopleMetadata(result.People, libraryOptions, cancellationToken).ConfigureAwait(false); await SavePeopleMetadata(result.People, libraryOptions, cancellationToken).ConfigureAwait(false);
} }
await result.Item.UpdateToRepository(reason, cancellationToken).ConfigureAwait(false); result.Item.UpdateToRepository(reason, cancellationToken);
} }
private async Task SavePeopleMetadata(List<PersonInfo> people, LibraryOptions libraryOptions, CancellationToken cancellationToken) private async Task SavePeopleMetadata(List<PersonInfo> people, LibraryOptions libraryOptions, CancellationToken cancellationToken)
@ -238,7 +238,7 @@ namespace MediaBrowser.Providers.Manager
if (saveEntity) if (saveEntity)
{ {
await personEntity.UpdateToRepository(updateType, cancellationToken).ConfigureAwait(false); personEntity.UpdateToRepository(updateType, cancellationToken);
} }
} }
} }

View File

@ -560,30 +560,20 @@ namespace MediaBrowser.Providers.Manager
new MetadataOptions(); new MetadataOptions();
} }
private Task _completedTask = Task.FromResult(true);
/// <summary> /// <summary>
/// Saves the metadata. /// Saves the metadata.
/// </summary> /// </summary>
/// <param name="item">The item.</param> public void SaveMetadata(IHasMetadata item, ItemUpdateType updateType)
/// <param name="updateType">Type of the update.</param>
/// <returns>Task.</returns>
public Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType)
{ {
SaveMetadata(item, updateType, _savers); SaveMetadata(item, updateType, _savers);
return _completedTask;
} }
/// <summary> /// <summary>
/// Saves the metadata. /// Saves the metadata.
/// </summary> /// </summary>
/// <param name="item">The item.</param> public void SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable<string> savers)
/// <param name="updateType">Type of the update.</param>
/// <param name="savers">The savers.</param>
/// <returns>Task.</returns>
public Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable<string> savers)
{ {
SaveMetadata(item, updateType, _savers.Where(i => savers.Contains(i.Name, StringComparer.OrdinalIgnoreCase))); SaveMetadata(item, updateType, _savers.Where(i => savers.Contains(i.Name, StringComparer.OrdinalIgnoreCase)));
return _completedTask;
} }
/// <summary> /// <summary>

View File

@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.TV
else if (existingSeason.IsVirtualItem) else if (existingSeason.IsVirtualItem)
{ {
existingSeason.IsVirtualItem = false; existingSeason.IsVirtualItem = false;
await existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken);
} }
} }
@ -97,7 +97,7 @@ namespace MediaBrowser.Providers.TV
else if (existingSeason.IsVirtualItem) else if (existingSeason.IsVirtualItem)
{ {
existingSeason.IsVirtualItem = false; existingSeason.IsVirtualItem = false;
await existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false); existingSeason.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken);
} }
} }

View File

@ -265,7 +265,7 @@ namespace MediaBrowser.WebDashboard.Api
builder.AppendFormat("window.appMode='{0}';", mode); builder.AppendFormat("window.appMode='{0}';", mode);
} }
if (string.IsNullOrWhiteSpace(mode)) else
{ {
builder.AppendFormat("window.dashboardVersion='{0}';", version); builder.AppendFormat("window.dashboardVersion='{0}';", version);
} }

View File

@ -52,7 +52,7 @@ namespace MediaBrowser.XbmcMetadata
var items = _libraryManager.GetItemList(new InternalItemsQuery var items = _libraryManager.GetItemList(new InternalItemsQuery
{ {
PersonIds = new [] { person.Id.ToString("N") }, PersonIds = new[] { person.Id.ToString("N") },
DtoOptions = new DtoOptions(true) DtoOptions = new DtoOptions(true)
}); });
@ -84,7 +84,7 @@ namespace MediaBrowser.XbmcMetadata
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
private async void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason) private void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason)
{ {
var locationType = item.LocationType; var locationType = item.LocationType;
if (locationType == LocationType.Remote || if (locationType == LocationType.Remote ||
@ -105,7 +105,7 @@ namespace MediaBrowser.XbmcMetadata
try try
{ {
await _providerManager.SaveMetadata(item, updateReason, new[] { BaseNfoSaver.SaverName }).ConfigureAwait(false); _providerManager.SaveMetadata(item, updateReason, new[] { BaseNfoSaver.SaverName });
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.33.1")] [assembly: AssemblyVersion("3.2.33.2")]