Merge pull request #1499 from MediaBrowser/dev
handle recordings with null paths
This commit is contained in:
commit
4871ab0e68
|
@ -300,17 +300,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
if (!string.IsNullOrWhiteSpace(remove.Path))
|
||||||
{
|
|
||||||
_fileSystem.DeleteFile(remove.Path);
|
|
||||||
}
|
|
||||||
catch (DirectoryNotFoundException)
|
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_fileSystem.DeleteFile(remove.Path);
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_recordingProvider.Delete(remove);
|
_recordingProvider.Delete(remove);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
await _liveTvManager.SaveTunerHost(new TunerHostInfo
|
await _liveTvManager.SaveTunerHost(new TunerHostInfo
|
||||||
{
|
{
|
||||||
Type = HdHomerunHost.DeviceType,
|
Type = HdHomerunHost.DeviceType,
|
||||||
Url = url
|
Url = url,
|
||||||
|
DataVersion = 1
|
||||||
|
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,6 +377,9 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
await EnsureSyncJobItems(null, cancellationToken).ConfigureAwait(false);
|
await EnsureSyncJobItems(null, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
// Look job items that are supposedly transfering, but need to be requeued because the synced files have been deleted somehow
|
||||||
|
await HandleDeletedSyncFiles(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// If it already has a converting status then is must have been aborted during conversion
|
// If it already has a converting status then is must have been aborted during conversion
|
||||||
var result = _syncManager.GetJobItems(new SyncJobItemQuery
|
var result = _syncManager.GetJobItems(new SyncJobItemQuery
|
||||||
{
|
{
|
||||||
|
@ -389,6 +392,28 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
CleanDeadSyncFiles();
|
CleanDeadSyncFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task HandleDeletedSyncFiles(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
// Look job items that are supposedly transfering, but need to be requeued because the synced files have been deleted somehow
|
||||||
|
var result = _syncManager.GetJobItems(new SyncJobItemQuery
|
||||||
|
{
|
||||||
|
Statuses = new[] { SyncJobItemStatus.ReadyToTransfer, SyncJobItemStatus.Transferring },
|
||||||
|
AddMetadata = false
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var item in result.Items)
|
||||||
|
{
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(item.OutputPath) || !_fileSystem.FileExists(item.OutputPath))
|
||||||
|
{
|
||||||
|
item.Status = SyncJobItemStatus.Queued;
|
||||||
|
await _syncManager.UpdateSyncJobItemInternal(item).ConfigureAwait(false);
|
||||||
|
await UpdateJobStatus(item.JobId).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CleanDeadSyncFiles()
|
private void CleanDeadSyncFiles()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -559,6 +559,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
jobItem.Status = SyncJobItemStatus.Synced;
|
jobItem.Status = SyncJobItemStatus.Synced;
|
||||||
jobItem.Progress = 100;
|
jobItem.Progress = 100;
|
||||||
|
|
||||||
|
await UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
||||||
|
|
||||||
|
var processor = GetSyncJobProcessor();
|
||||||
|
|
||||||
|
await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(jobItem.TemporaryPath))
|
if (!string.IsNullOrWhiteSpace(jobItem.TemporaryPath))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -573,12 +579,6 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
_logger.ErrorException("Error deleting temporary job file: {0}", ex, jobItem.OutputPath);
|
_logger.ErrorException("Error deleting temporary job file: {0}", ex, jobItem.OutputPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
|
||||||
|
|
||||||
var processor = GetSyncJobProcessor();
|
|
||||||
|
|
||||||
await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyncJobProcessor GetSyncJobProcessor()
|
private SyncJobProcessor GetSyncJobProcessor()
|
||||||
|
@ -1015,7 +1015,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
var jobItem = _repo.GetJobItem(id);
|
var jobItem = _repo.GetJobItem(id);
|
||||||
|
|
||||||
if (jobItem.Status != SyncJobItemStatus.Queued && jobItem.Status != SyncJobItemStatus.ReadyToTransfer && jobItem.Status != SyncJobItemStatus.Converting && jobItem.Status != SyncJobItemStatus.Failed && jobItem.Status != SyncJobItemStatus.Synced)
|
if (jobItem.Status != SyncJobItemStatus.Queued && jobItem.Status != SyncJobItemStatus.ReadyToTransfer && jobItem.Status != SyncJobItemStatus.Converting && jobItem.Status != SyncJobItemStatus.Failed && jobItem.Status != SyncJobItemStatus.Synced && jobItem.Status != SyncJobItemStatus.Transferring)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Operation is not valid for this job item");
|
throw new ArgumentException("Operation is not valid for this job item");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user