mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
fix web project
This commit is contained in:
parent
75771927d6
commit
19f422fdd0
@ -499,10 +499,17 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
{
|
||||
var job = _repo.GetJob(jobItem.JobId);
|
||||
|
||||
if (job == null)
|
||||
{
|
||||
_logger.Error("GetJobItemInfo job id {0} no longer exists", jobItem.JobId);
|
||||
return null;
|
||||
}
|
||||
|
||||
var libraryItem = _libraryManager.GetItemById(jobItem.ItemId);
|
||||
|
||||
if (libraryItem == null)
|
||||
{
|
||||
_logger.Error("GetJobItemInfo library item with id {0} no longer exists", jobItem.ItemId);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
private readonly IServerApplicationPaths _appPaths;
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
private IDbCommand _insertJobCommand;
|
||||
private IDbCommand _updateJobCommand;
|
||||
private IDbCommand _deleteJobCommand;
|
||||
|
||||
private IDbCommand _deleteJobItemsCommand;
|
||||
private IDbCommand _saveJobCommand;
|
||||
private IDbCommand _saveJobItemCommand;
|
||||
|
||||
private readonly IJsonSerializer _json;
|
||||
@ -66,34 +68,59 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
|
||||
private void PrepareStatements()
|
||||
{
|
||||
// _deleteJobCommand
|
||||
_deleteJobCommand = _connection.CreateCommand();
|
||||
_deleteJobCommand.CommandText = "delete from SyncJobs where Id=@Id";
|
||||
_deleteJobCommand.Parameters.Add(_deleteJobCommand, "@Id");
|
||||
|
||||
// _deleteJobItemsCommand
|
||||
_deleteJobItemsCommand = _connection.CreateCommand();
|
||||
_deleteJobItemsCommand.CommandText = "delete from SyncJobItems where JobId=@JobId";
|
||||
_deleteJobItemsCommand.Parameters.Add(_deleteJobItemsCommand, "@JobId");
|
||||
|
||||
_saveJobCommand = _connection.CreateCommand();
|
||||
_saveJobCommand.CommandText = "replace into SyncJobs (Id, TargetId, Name, Quality, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (@Id, @TargetId, @Name, @Quality, @Status, @Progress, @UserId, @ItemIds, @Category, @ParentId, @UnwatchedOnly, @ItemLimit, @SyncNewContent, @DateCreated, @DateLastModified, @ItemCount)";
|
||||
// _insertJobCommand
|
||||
_insertJobCommand = _connection.CreateCommand();
|
||||
_insertJobCommand.CommandText = "insert into SyncJobs (Id, TargetId, Name, Quality, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (@Id, @TargetId, @Name, @Quality, @Status, @Progress, @UserId, @ItemIds, @Category, @ParentId, @UnwatchedOnly, @ItemLimit, @SyncNewContent, @DateCreated, @DateLastModified, @ItemCount)";
|
||||
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Id");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@TargetId");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Name");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Quality");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Status");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Progress");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@UserId");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ItemIds");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@Category");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ParentId");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@UnwatchedOnly");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ItemLimit");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@SyncNewContent");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@DateCreated");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@DateLastModified");
|
||||
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ItemCount");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Id");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@TargetId");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Name");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Quality");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Status");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Progress");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@UserId");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@ItemIds");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@Category");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@ParentId");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@UnwatchedOnly");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@ItemLimit");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@SyncNewContent");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@DateCreated");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@DateLastModified");
|
||||
_insertJobCommand.Parameters.Add(_insertJobCommand, "@ItemCount");
|
||||
|
||||
// _updateJobCommand
|
||||
_updateJobCommand = _connection.CreateCommand();
|
||||
_updateJobCommand.CommandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Quality=@Quality,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");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Name");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Quality");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Status");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Progress");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@UserId");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@ItemIds");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@Category");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@ParentId");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@UnwatchedOnly");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@ItemLimit");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@SyncNewContent");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@DateCreated");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@DateLastModified");
|
||||
_updateJobCommand.Parameters.Add(_updateJobCommand, "@ItemCount");
|
||||
|
||||
// _saveJobItemCommand
|
||||
_saveJobItemCommand = _connection.CreateCommand();
|
||||
_saveJobItemCommand.CommandText = "replace into SyncJobItems (Id, ItemId, ItemName, MediaSourceId, JobId, TemporaryPath, OutputPath, Status, TargetId, DateCreated, Progress, AdditionalFiles, MediaSource, IsMarkedForRemoval, JobItemIndex) values (@Id, @ItemId, @ItemName, @MediaSourceId, @JobId, @TemporaryPath, @OutputPath, @Status, @TargetId, @DateCreated, @Progress, @AdditionalFiles, @MediaSource, @IsMarkedForRemoval, @JobItemIndex)";
|
||||
|
||||
@ -214,10 +241,15 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
|
||||
public Task Create(SyncJob job)
|
||||
{
|
||||
return Update(job);
|
||||
return InsertOrUpdate(job, _insertJobCommand);
|
||||
}
|
||||
|
||||
public async Task Update(SyncJob job)
|
||||
public Task Update(SyncJob job)
|
||||
{
|
||||
return InsertOrUpdate(job, _updateJobCommand);
|
||||
}
|
||||
|
||||
private async Task InsertOrUpdate(SyncJob job, IDbCommand cmd)
|
||||
{
|
||||
if (job == null)
|
||||
{
|
||||
@ -234,26 +266,26 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
|
||||
var index = 0;
|
||||
|
||||
_saveJobCommand.GetParameter(index++).Value = new Guid(job.Id);
|
||||
_saveJobCommand.GetParameter(index++).Value = job.TargetId;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.Name;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.Quality;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.Status.ToString();
|
||||
_saveJobCommand.GetParameter(index++).Value = job.Progress;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.UserId;
|
||||
_saveJobCommand.GetParameter(index++).Value = string.Join(",", job.RequestedItemIds.ToArray());
|
||||
_saveJobCommand.GetParameter(index++).Value = job.Category;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.ParentId;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.UnwatchedOnly;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.ItemLimit;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.SyncNewContent;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.DateCreated;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.DateLastModified;
|
||||
_saveJobCommand.GetParameter(index++).Value = job.ItemCount;
|
||||
cmd.GetParameter(index++).Value = new Guid(job.Id);
|
||||
cmd.GetParameter(index++).Value = job.TargetId;
|
||||
cmd.GetParameter(index++).Value = job.Name;
|
||||
cmd.GetParameter(index++).Value = job.Quality;
|
||||
cmd.GetParameter(index++).Value = job.Status.ToString();
|
||||
cmd.GetParameter(index++).Value = job.Progress;
|
||||
cmd.GetParameter(index++).Value = job.UserId;
|
||||
cmd.GetParameter(index++).Value = string.Join(",", job.RequestedItemIds.ToArray());
|
||||
cmd.GetParameter(index++).Value = job.Category;
|
||||
cmd.GetParameter(index++).Value = job.ParentId;
|
||||
cmd.GetParameter(index++).Value = job.UnwatchedOnly;
|
||||
cmd.GetParameter(index++).Value = job.ItemLimit;
|
||||
cmd.GetParameter(index++).Value = job.SyncNewContent;
|
||||
cmd.GetParameter(index++).Value = job.DateCreated;
|
||||
cmd.GetParameter(index++).Value = job.DateLastModified;
|
||||
cmd.GetParameter(index++).Value = job.ItemCount;
|
||||
|
||||
_saveJobCommand.Transaction = transaction;
|
||||
cmd.Transaction = transaction;
|
||||
|
||||
_saveJobCommand.ExecuteNonQuery();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
|
@ -252,9 +252,6 @@
|
||||
<Content Include="dashboard-ui\css\images\icons\remote.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\home.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\icons\audiocd.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -300,36 +297,6 @@
|
||||
<Content Include="dashboard-ui\css\images\items\detail\tv.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\books.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\channels.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\folder.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\games.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\homevideos.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\movies.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\music.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\musicvideos.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\photos.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\folders\tv.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\list\remotesearch.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
Loading…
Reference in New Issue
Block a user