sync updates

This commit is contained in:
Luke Pulverenti 2015-02-04 14:13:00 -05:00
parent 6c3209e3f9
commit f2c3e014b7
14 changed files with 61 additions and 23 deletions

View File

@ -1,5 +1,4 @@
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
@ -15,6 +14,7 @@ namespace MediaBrowser.Controller.Sync
{ {
event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated; event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled; event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
event EventHandler<GenericEventArgs<SyncJob>> SyncJobUpdated;
/// <summary> /// <summary>
/// Creates the job. /// Creates the job.

View File

@ -515,7 +515,7 @@ namespace MediaBrowser.Dlna
public void Run() public void Run()
{ {
DumpProfiles(); //DumpProfiles();
} }
private void DumpProfiles() private void DumpProfiles()

View File

@ -135,5 +135,9 @@ namespace MediaBrowser.Model.ApiClient
/// Occurs when [synchronize job created]. /// Occurs when [synchronize job created].
/// </summary> /// </summary>
event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated; event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
/// <summary>
/// Occurs when [synchronize job cancelled].
/// </summary>
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
} }
} }

View File

@ -4,8 +4,11 @@ namespace MediaBrowser.Model.Sync
public enum SyncJobStatus public enum SyncJobStatus
{ {
Queued = 0, Queued = 0,
InProgress = 1, Converting = 1,
Completed = 2, Transferring = 2,
CompletedWithError = 3 Completed = 3,
CompletedWithError = 4,
Failed = 5,
Cancelled = 6
} }
} }

View File

@ -38,6 +38,12 @@ namespace MediaBrowser.Model.System
/// <value><c>true</c> if this instance has pending restart; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance has pending restart; otherwise, <c>false</c>.</value>
public bool HasPendingRestart { get; set; } public bool HasPendingRestart { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports synchronize].
/// </summary>
/// <value><c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
public bool SupportsSync { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance is network deployed. /// Gets or sets a value indicating whether this instance is network deployed.
/// </summary> /// </summary>

View File

@ -75,6 +75,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_taskManager.TaskCompleted += _taskManager_TaskCompleted; _taskManager.TaskCompleted += _taskManager_TaskCompleted;
_syncManager.SyncJobCreated += _syncManager_SyncJobCreated; _syncManager.SyncJobCreated += _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled += _syncManager_SyncJobCancelled;
}
void _syncManager_SyncJobCancelled(object sender, GenericEventArgs<SyncJob> e)
{
_sessionManager.SendMessageToUserDeviceSessions(e.Argument.TargetId, "SyncJobCancelled", e.Argument, CancellationToken.None);
} }
void _syncManager_SyncJobCreated(object sender, GenericEventArgs<SyncJobCreationResult> e) void _syncManager_SyncJobCreated(object sender, GenericEventArgs<SyncJobCreationResult> e)
@ -189,6 +195,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_appHost.HasPendingRestartChanged -= kernel_HasPendingRestartChanged; _appHost.HasPendingRestartChanged -= kernel_HasPendingRestartChanged;
_syncManager.SyncJobCreated -= _syncManager_SyncJobCreated; _syncManager.SyncJobCreated -= _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled -= _syncManager_SyncJobCancelled;
} }
} }
} }

View File

@ -49,8 +49,11 @@
"ButtonHelp": "Help", "ButtonHelp": "Help",
"ButtonSave": "Save", "ButtonSave": "Save",
"SyncJobStatusQueued": "Queued", "SyncJobStatusQueued": "Queued",
"SyncJobStatusInProgress": "In-Progress", "SyncJobStatusConverting": "Converting",
"SyncJobStatusFailed": "Failed",
"SyncJobStatusCancelled": "Cancelled",
"SyncJobStatusCompleted": "Synced", "SyncJobStatusCompleted": "Synced",
"SyncJobStatusTransferring": "Transferring",
"SyncJobStatusCompletedWithError": "Synced with errors", "SyncJobStatusCompletedWithError": "Synced with errors",
"LabelCollection": "Collection", "LabelCollection": "Collection",
"HeaderAddToCollection": "Add to Collection", "HeaderAddToCollection": "Add to Collection",
@ -91,6 +94,7 @@
"HeaderSelectSubtitles": "Select Subtitles", "HeaderSelectSubtitles": "Select Subtitles",
"ButtonMarkForRemoval": "Remove from device", "ButtonMarkForRemoval": "Remove from device",
"ButtonUnmarkForRemoval": "Cancel removal from device", "ButtonUnmarkForRemoval": "Cancel removal from device",
"LabelSyncQualityHelp": "Use high quality for the maximum supported quality by the device. Medium and Low reduce the allowed bitrate.",
"LabelDefaultStream": "(Default)", "LabelDefaultStream": "(Default)",
"LabelForcedStream": "(Forced)", "LabelForcedStream": "(Forced)",
"LabelDefaultForcedStream": "(Default/Forced)", "LabelDefaultForcedStream": "(Default/Forced)",

View File

@ -172,7 +172,23 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Progress = null; job.Progress = null;
} }
if (pct >= 100) if (jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Failed))
{
job.Status = SyncJobStatus.Failed;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Cancelled))
{
job.Status = SyncJobStatus.Cancelled;
}
else if (jobItems.Any(i => i.Status == SyncJobItemStatus.Converting))
{
job.Status = SyncJobStatus.Converting;
}
else if (pct >= 100)
{ {
if (jobItems.Any(i => i.Status == SyncJobItemStatus.Failed)) if (jobItems.Any(i => i.Status == SyncJobItemStatus.Failed))
{ {
@ -183,13 +199,9 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Status = SyncJobStatus.Completed; job.Status = SyncJobStatus.Completed;
} }
} }
else if (pct.Equals(0) && jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else else
{ {
job.Status = SyncJobStatus.InProgress; job.Status = SyncJobStatus.Transferring;
} }
return _syncRepo.Update(job); return _syncRepo.Update(job);

View File

@ -51,6 +51,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated; public event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled; public event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobUpdated;
public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config) public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config)
{ {

View File

@ -1023,7 +1023,8 @@ namespace MediaBrowser.Server.Startup.Common
IsRunningAsService = IsRunningAsService, IsRunningAsService = IsRunningAsService,
SupportsRunningAsService = SupportsRunningAsService, SupportsRunningAsService = SupportsRunningAsService,
ServerName = FriendlyName, ServerName = FriendlyName,
LocalAddress = LocalApiUrl LocalAddress = LocalApiUrl,
SupportsSync = true
}; };
} }

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.554</version> <version>3.0.556</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.554" /> <dependency id="MediaBrowser.Common" version="3.0.556" />
<dependency id="NLog" version="3.1.0.0" /> <dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.6.1" /> <dependency id="SimpleInjector" version="2.6.1" />
</dependencies> </dependencies>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.554</version> <version>3.0.556</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Model.Signed</id> <id>MediaBrowser.Model.Signed</id>
<version>3.0.554</version> <version>3.0.556</version>
<title>MediaBrowser.Model - Signed Edition</title> <title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.554</version> <version>3.0.556</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.554" /> <dependency id="MediaBrowser.Common" version="3.0.556" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>