Merge pull request #1650 from MediaBrowser/dev

Dev
pull/702/head
Luke 9 years ago
commit 8d6fc3a4a2

@ -1358,11 +1358,6 @@ namespace MediaBrowser.Controller.Entities
list.AddRange(parent.Tags);
}
foreach (var parent in LibraryManager.GetCollectionFolders(this))
{
list.AddRange(parent.Tags);
}
return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
}

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Providers.Manager;
namespace MediaBrowser.Providers.Folders
{
public class CollectionFolderMetadataService : MetadataService<CollectionFolder, ItemLookupInfo>
{
public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager)
: base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
{
}
protected override void MergeData(MetadataResult<CollectionFolder> source, MetadataResult<CollectionFolder> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
{
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
}
}
}

@ -21,17 +21,4 @@ namespace MediaBrowser.Providers.Folders
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
}
}
public class CollectionFolderMetadataService : MetadataService<CollectionFolder, ItemLookupInfo>
{
public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager)
: base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
{
}
protected override void MergeData(MetadataResult<CollectionFolder> source, MetadataResult<CollectionFolder> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
{
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
}
}
}

@ -143,8 +143,8 @@ namespace MediaBrowser.Providers.Manager
Item = itemOfType
};
bool hasRefreshedMetadata = false;
bool hasRefreshedImages = false;
bool hasRefreshedMetadata = true;
bool hasRefreshedImages = true;
// Next run metadata providers
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
@ -186,6 +186,7 @@ namespace MediaBrowser.Providers.Manager
}
else
{
hasRefreshedMetadata = false;
refreshResult.SetDateLastMetadataRefresh(null);
}
}
@ -208,6 +209,7 @@ namespace MediaBrowser.Providers.Manager
}
else
{
hasRefreshedImages = false;
refreshResult.SetDateLastImagesRefresh(null);
}
}
@ -303,6 +305,11 @@ namespace MediaBrowser.Providers.Manager
return true;
}
if (item is ICollectionFolder)
{
return true;
}
return false;
}

@ -88,6 +88,7 @@
<Compile Include="BoxSets\MovieDbBoxSetProvider.cs" />
<Compile Include="Channels\ChannelMetadataService.cs" />
<Compile Include="Chapters\ChapterManager.cs" />
<Compile Include="Folders\CollectionFolderMetadataService.cs" />
<Compile Include="Folders\DefaultImageProvider.cs" />
<Compile Include="Folders\FolderMetadataService.cs" />
<Compile Include="Folders\UserViewMetadataService.cs" />

@ -80,7 +80,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _updateInheritedRatingCommand;
private IDbCommand _updateInheritedTagsCommand;
private const int LatestSchemaVersion = 61;
private const int LatestSchemaVersion = 62;
/// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.

@ -149,16 +149,6 @@ namespace MediaBrowser.Server.Implementations.Sync
{
var job = _syncRepo.GetJob(id);
return UpdateJobStatus(job);
}
private Task UpdateJobStatus(SyncJob job)
{
if (job == null)
{
throw new ArgumentNullException("job");
}
var result = _syncManager.GetJobItems(new SyncJobItemQuery
{
JobId = job.Id,
@ -476,14 +466,12 @@ namespace MediaBrowser.Server.Implementations.Sync
if (jobItem != null)
{
var job = _syncRepo.GetJob(jobItem.JobId);
if (jobItem.Status != SyncJobItemStatus.Cancelled)
{
await ProcessJobItem(job, jobItem, enableConversion, innerProgress, cancellationToken).ConfigureAwait(false);
await ProcessJobItem(jobItem, enableConversion, innerProgress, cancellationToken).ConfigureAwait(false);
}
job = _syncRepo.GetJob(jobItem.JobId);
await UpdateJobStatus(job).ConfigureAwait(false);
await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
}
numComplete++;
@ -493,7 +481,7 @@ namespace MediaBrowser.Server.Implementations.Sync
}
}
private async Task ProcessJobItem(SyncJob job, SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
private async Task ProcessJobItem(SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{
var item = _libraryManager.GetItemById(jobItem.ItemId);
if (item == null)
@ -507,6 +495,7 @@ namespace MediaBrowser.Server.Implementations.Sync
jobItem.Progress = 0;
var syncOptions = _config.GetSyncOptions();
var job = _syncManager.GetJob(jobItem.JobId);
var user = _userManager.GetUserById(job.UserId);
if (user == null)
{
@ -521,7 +510,7 @@ namespace MediaBrowser.Server.Implementations.Sync
{
AddMetadata = false,
ItemId = jobItem.ItemId,
TargetId = job.TargetId,
TargetId = jobItem.TargetId,
Statuses = new[] { SyncJobItemStatus.Converting, SyncJobItemStatus.Queued, SyncJobItemStatus.ReadyToTransfer, SyncJobItemStatus.Synced, SyncJobItemStatus.Transferring }
});
@ -531,7 +520,7 @@ namespace MediaBrowser.Server.Implementations.Sync
if (duplicateJobItems.Count > 0)
{
var syncProvider = _syncManager.GetSyncProvider(jobItem, job) as IHasDuplicateCheck;
var syncProvider = _syncManager.GetSyncProvider(jobItem) as IHasDuplicateCheck;
if (!duplicateJobItems.Any(i => AllowDuplicateJobItem(syncProvider, i, jobItem)))
{
@ -545,12 +534,12 @@ namespace MediaBrowser.Server.Implementations.Sync
var video = item as Video;
if (video != null)
{
await Sync(jobItem, job, video, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false);
await Sync(jobItem, video, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false);
}
else if (item is Audio)
{
await Sync(jobItem, job, (Audio)item, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false);
await Sync(jobItem, (Audio)item, user, enableConversion, syncOptions, progress, cancellationToken).ConfigureAwait(false);
}
else if (item is Photo)
@ -574,8 +563,9 @@ namespace MediaBrowser.Server.Implementations.Sync
return true;
}
private async Task Sync(SyncJobItem jobItem, SyncJob job, Video item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken)
private async Task Sync(SyncJobItem jobItem, Video item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken)
{
var job = _syncManager.GetJob(jobItem.JobId);
var jobOptions = _syncManager.GetVideoOptions(jobItem, job);
var conversionOptions = new VideoOptions
{
@ -616,7 +606,7 @@ namespace MediaBrowser.Server.Implementations.Sync
{
// Save the job item now since conversion could take a while
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
await UpdateJobStatus(job).ConfigureAwait(false);
await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
try
{
@ -630,7 +620,7 @@ namespace MediaBrowser.Server.Implementations.Sync
{
jobItem.Progress = pct / 2;
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
await UpdateJobStatus(job).ConfigureAwait(false);
await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
}
});
@ -642,7 +632,7 @@ namespace MediaBrowser.Server.Implementations.Sync
}, innerProgress, cancellationToken);
_syncManager.OnConversionComplete(jobItem, job);
_syncManager.OnConversionComplete(jobItem);
}
catch (OperationCanceledException)
{
@ -775,8 +765,9 @@ namespace MediaBrowser.Server.Implementations.Sync
private const int DatabaseProgressUpdateIntervalSeconds = 2;
private async Task Sync(SyncJobItem jobItem, SyncJob job, Audio item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken)
private async Task Sync(SyncJobItem jobItem, Audio item, User user, bool enableConversion, SyncOptions syncOptions, IProgress<double> progress, CancellationToken cancellationToken)
{
var job = _syncManager.GetJob(jobItem.JobId);
var jobOptions = _syncManager.GetAudioOptions(jobItem, job);
var conversionOptions = new AudioOptions
{
@ -803,7 +794,7 @@ namespace MediaBrowser.Server.Implementations.Sync
jobItem.Status = SyncJobItemStatus.Converting;
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
await UpdateJobStatus(job).ConfigureAwait(false);
await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
try
{
@ -817,7 +808,7 @@ namespace MediaBrowser.Server.Implementations.Sync
{
jobItem.Progress = pct / 2;
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
await UpdateJobStatus(job).ConfigureAwait(false);
await UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
}
});
@ -828,7 +819,7 @@ namespace MediaBrowser.Server.Implementations.Sync
}, innerProgress, cancellationToken);
_syncManager.OnConversionComplete(jobItem, job);
_syncManager.OnConversionComplete(jobItem);
}
catch (OperationCanceledException)
{

@ -1117,7 +1117,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public SyncJobOptions GetAudioOptions(SyncJobItem jobItem, SyncJob job)
{
var options = GetSyncJobOptions(jobItem.TargetId, null, null);
if (job.Bitrate.HasValue)
{
options.DeviceProfile.MaxStaticBitrate = job.Bitrate.Value;
@ -1126,7 +1126,7 @@ namespace MediaBrowser.Server.Implementations.Sync
return options;
}
public ISyncProvider GetSyncProvider(SyncJobItem jobItem, SyncJob job)
public ISyncProvider GetSyncProvider(SyncJobItem jobItem)
{
foreach (var provider in _providers)
{
@ -1323,9 +1323,9 @@ namespace MediaBrowser.Server.Implementations.Sync
return list;
}
protected internal void OnConversionComplete(SyncJobItem item, SyncJob job)
protected internal void OnConversionComplete(SyncJobItem item)
{
var syncProvider = GetSyncProvider(item, job);
var syncProvider = GetSyncProvider(item);
if (syncProvider is AppSyncProvider)
{
return;

@ -104,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Sync
// _updateJobCommand
_updateJobCommand = _connection.CreateCommand();
_updateJobCommand.CommandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@ID";
_updateJobCommand.CommandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@Id";
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Id");
_updateJobCommand.Parameters.Add(_updateJobCommand, "@TargetId");

@ -796,9 +796,6 @@
<Content Include="dashboard-ui\css\images\editor\missingprimaryimage.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\editor\missingtrailer.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\metadataeditor.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save