From: Vásáry Dániel Date: Fri, 7 Dec 2018 13:45:21 +0000 (+0000) Subject: #112 Szegmentálás és elfogadás különválasztása a folyamatban X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=64f8885cbecc5414fcab31fea2fc59e1267b062d;p=mediacube.git #112 Szegmentálás és elfogadás különválasztása a folyamatban #114 SKIPPED és REJECTED folyamat állapotok hibát eredményeznek WorkFlowAction mentéskor #113 SKIPPED állapot kezelése az akciók számosságának kijelzésénél git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31363 --- diff --git a/client/Maestro/Configuration/configuration.json b/client/Maestro/Configuration/configuration.json index d434e226..9688cf26 100644 --- a/client/Maestro/Configuration/configuration.json +++ b/client/Maestro/Configuration/configuration.json @@ -13,7 +13,7 @@ "$type": "UNCSource", "filter": "avi,wav,mxf", "local": { - "address": "file://10.10.1.105/BRAAVOS/TESZT/TC", + "address": "file://c:/_video", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 @@ -66,10 +66,10 @@ "targets": [ { "label": "Adáskész", - "processor": "FXPTargetProcessor", + "processor": "FTPTargetProcessor", "outputFormat": "%ID%", "killDateDays": 5, - "saveSegments": false, + "saveSegments": true, "tag": "Adáskész", "disableFileVersioning": true, "enableOverride": false, @@ -89,7 +89,7 @@ "outputFormat": "%ID%-%SOURCENAME%", "tag": "Betöltés", "killDateDays": 7, - "saveArchiveMetadata": false, + "saveArchiveMetadata": true, "remote": { "address": "ftp://10.10.1.105/TESZT/CHECK", "userName": "mediacube", diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index dc76d91f..e5c7a737 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -110,9 +110,12 @@ namespace Maestro { this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.lError = new System.Windows.Forms.ToolStripLabel(); this.lErrorCount = new System.Windows.Forms.ToolStripLabel(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.lRevoked = new System.Windows.Forms.ToolStripLabel(); this.lRevokedCount = new System.Windows.Forms.ToolStripLabel(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.lSkipped = new System.Windows.Forms.ToolStripLabel(); + this.lSkippedCount = new System.Windows.Forms.ToolStripLabel(); this.systemMessageBindingSource = new System.Windows.Forms.BindingSource(this.components); this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.groupSource.SuspendLayout(); @@ -972,9 +975,12 @@ namespace Maestro { this.toolStripSeparator4, this.lError, this.lErrorCount, - this.toolStripSeparator1, + this.toolStripSeparator7, this.lRevoked, - this.lRevokedCount}); + this.lRevokedCount, + this.toolStripSeparator1, + this.lSkipped, + this.lSkippedCount}); this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; this.toolStrip1.Location = new System.Drawing.Point(10, 153); this.toolStrip1.Name = "toolStrip1"; @@ -1089,10 +1095,10 @@ namespace Maestro { this.lErrorCount.Text = "0"; this.lErrorCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // toolStripSeparator1 + // toolStripSeparator7 // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + this.toolStripSeparator7.Name = "toolStripSeparator7"; + this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25); // // lRevoked // @@ -1109,6 +1115,26 @@ namespace Maestro { this.lRevokedCount.Text = "0"; this.lRevokedCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // lSkipped + // + this.lSkipped.Name = "lSkipped"; + this.lSkipped.Size = new System.Drawing.Size(58, 22); + this.lSkipped.Text = "Kihagyva:"; + this.lSkipped.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lSkippedCount + // + this.lSkippedCount.AutoSize = false; + this.lSkippedCount.Name = "lSkippedCount"; + this.lSkippedCount.Size = new System.Drawing.Size(30, 22); + this.lSkippedCount.Text = "0"; + this.lSkippedCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // systemMessageBindingSource // this.systemMessageBindingSource.DataSource = typeof(Maestro.SystemMessage); @@ -1247,8 +1273,8 @@ namespace Maestro { private ToolStripLabel lError; private ToolStripLabel lErrorCount; private ToolStripSeparator toolStripSeparator1; - private ToolStripLabel lRevoked; - private ToolStripLabel lRevokedCount; + private ToolStripLabel lSkipped; + private ToolStripLabel lSkippedCount; private DataGridViewTextBoxColumn columnInputName; private DataGridViewTextBoxColumn columnLabel; private Commons.DataGridViewProgressColumn columnProgress; @@ -1262,6 +1288,9 @@ namespace Maestro { private DataGridViewTextBoxColumn columnMessage; private ToolStripLabel lSelectionCounts; private ToolStripButton btnRedefineSegments; + private ToolStripSeparator toolStripSeparator7; + private ToolStripLabel lRevoked; + private ToolStripLabel lRevokedCount; } } diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 609120f8..51bee826 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -58,12 +58,15 @@ namespace Maestro { } private void OnTargetUpdateTrafficMessage(TargetUpdateTrafficMessage message) { - if (message.Ready == false) + if (message.Ready == false) { //Target futas elejen elmentjuk a szegmenseket + logger.Info("Saving segments for {0}", message.VariantID); trafficIDSelector.trafficAPI.SaveSegments(message.VariantID, message.MetadataType, message.Segments); - else + } else { //Target futas vegen OK + logger.Info("Approving {0}", message.VariantID); trafficIDSelector.trafficAPI.Approve(message.VariantID, true, message.MetadataType); + } } private void InitializeTrafficSelector() { @@ -450,10 +453,10 @@ namespace Maestro { } DefineSegments(new FileInfo(SelectedMetadata.RedefineSegmentsFile)); - - //save! - - + /* + trafficIDSelector.trafficAPI.SaveSegments(SelectedMetadata.VariantID, SelectedMetadata.Kind, movieSegments.ToList()); + trafficIDSelector.trafficAPI.Approve(SelectedMetadata.VariantID, true, SelectedMetadata.Kind); + */ } private static string GetMetadataTypeTooltip(MetadataType? metadataType) { diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index 160eabac..0377c08c 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -150,6 +150,7 @@ namespace Maestro { lAllCount.Text = jobs.Count.ToString(); var error = 0; var revoked = 0; + var skipped = 0; var done = 0; foreach (ITargetProcessor j in jobs) { if (TargetProcessor.REVOKED.Equals(j.Status)) { @@ -164,11 +165,15 @@ namespace Maestro { done++; continue; } + if (TargetProcessor.SKIPPED.Equals(j.Status)) { + skipped++; + continue; + } } lErrorCount.Text = error.ToString(); lRevokedCount.Text = revoked.ToString(); + lSkippedCount.Text = skipped.ToString(); lDoneCount.Text = done.ToString(); - } private void ProcessorWorker_DoWork(object sender, DoWorkEventArgs e) { @@ -185,6 +190,8 @@ namespace Maestro { }); if (TargetProcessor.REVOKED.Equals(job.Status)) continue; + if (TargetProcessor.SKIPPED.Equals(job.Status)) + continue; (this).SafeCall(() => { lRunningCount.Text = "1"; }); diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index 901e11c9..b5bf3046 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAS - CAAAAk1TRnQBSQFMAgEBAgEAAXABAgFwAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAYABAgGAAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/client/MaestroShared/Commons/StringExtensions.cs b/client/MaestroShared/Commons/StringExtensions.cs new file mode 100644 index 00000000..ce1b85ea --- /dev/null +++ b/client/MaestroShared/Commons/StringExtensions.cs @@ -0,0 +1,9 @@ +namespace MaestroShared.Commons { + public static class StringExtensions { + + public static bool IsEmpty(this string data) { + return string.IsNullOrWhiteSpace(data); + } + + } +} diff --git a/client/MaestroShared/MaestroShared.csproj b/client/MaestroShared/MaestroShared.csproj index 2ce64179..221991be 100644 --- a/client/MaestroShared/MaestroShared.csproj +++ b/client/MaestroShared/MaestroShared.csproj @@ -88,6 +88,7 @@ + diff --git a/client/MaestroShared/Targets/FTPTargetProcessor.cs b/client/MaestroShared/Targets/FTPTargetProcessor.cs index 835e2cac..a535c95d 100644 --- a/client/MaestroShared/Targets/FTPTargetProcessor.cs +++ b/client/MaestroShared/Targets/FTPTargetProcessor.cs @@ -24,6 +24,7 @@ namespace MaestroShared.Targets { if (address == null) { Message = "Nem található a 'source.local.address' beállítás."; Status = REVOKED; + workFlowAction.description = Message; return; } inputFile = null; @@ -150,13 +151,15 @@ namespace MaestroShared.Targets { } protected FtpClient CreateClient(Connection connection) { - Uri address = connection.Address; string addr = address.Host; + IPAddress.TryParse(addr, out IPAddress ipaddress); + if (ipaddress == null) { + IPHostEntry hostEntry = Dns.GetHostEntry(addr); + if (hostEntry != null && hostEntry.AddressList.Length > 0) + addr = hostEntry.AddressList[0].ToString(); + } - IPHostEntry hostEntry = Dns.GetHostEntry(addr); - if (hostEntry != null && hostEntry.AddressList.Length > 0) - addr = hostEntry.AddressList[0].ToString(); logger.Info("Remote address is {0}", addr); FtpClient result = new FtpClient() { Host = addr, diff --git a/client/MaestroShared/Targets/FXPTargetProcessor.cs b/client/MaestroShared/Targets/FXPTargetProcessor.cs index 2ad9649e..e8d68f51 100644 --- a/client/MaestroShared/Targets/FXPTargetProcessor.cs +++ b/client/MaestroShared/Targets/FXPTargetProcessor.cs @@ -35,6 +35,7 @@ namespace MaestroShared.Targets { if (address == null) { Message = "Nem található a 'source.remote.address' beállítás."; Status = REVOKED; + workFlowAction.description = Message; return; } diff --git a/client/MaestroShared/Targets/UNCTargetProcessor.cs b/client/MaestroShared/Targets/UNCTargetProcessor.cs index d3312c96..a17b4093 100644 --- a/client/MaestroShared/Targets/UNCTargetProcessor.cs +++ b/client/MaestroShared/Targets/UNCTargetProcessor.cs @@ -72,6 +72,11 @@ namespace MaestroShared.Targets { workFlowAction.started = Started; } + protected virtual void BeforeUpload() { + if (Parameters.TargetConfig.SaveSegments && Parameters.MovieSegments != null) + TrafficSaveSegments(); + } + public override bool Execute() { logger.Info(PROCESSING, InputName); bool result = false; @@ -86,18 +91,20 @@ namespace MaestroShared.Targets { Status = INPROGRESS; //DateTime started = DateTime.Now; string currentFile = GetOutputFilePath(workingDir, OutputName); + //csak akkor csinalunk barmit is, ha a feluliras logika engedi if (DeleteExisting(currentFile)) { + BeforeUpload(); UploadFile(); ValidateTransfer(); //logger.Info("Spend (s):" + (DateTime.Now - started).TotalSeconds); + if (Parameters.TargetConfig.DeleteAfterCopy) + DeleteAfterCopy(); + ExecuteCompleted(); + Status = READY; Message = SUCCESS; + workFlowAction.successful = true; } - if (Parameters.TargetConfig.DeleteAfterCopy) - DeleteAfterCopy(); - - ExecuteCompleted(); - workFlowAction.successful = true; } catch (Exception e) { Status = ERROR; Message = e.Message; @@ -136,12 +143,14 @@ namespace MaestroShared.Targets { if (Parameters.ArchiveMetadata.ok) { Message = "A célállomány már létezik és el van fogadva, felülírása nem lehetséges."; Status = SKIPPED; + workFlowAction.description = Message; return false; } else DeleteFile(currentFile); } else { Message = "A célállomány létezik, felülírása a konfiuráció alapján nem lehetséges."; Status = SKIPPED; + workFlowAction.description = Message; return false; } } @@ -158,6 +167,7 @@ namespace MaestroShared.Targets { else message = Parameters.TargetConfig.NexioFileExistsMessage; MessageBox.Show(String.Format($"Az '{OutputName}' állomány már létezik. {message}")); + workFlowAction.description = message; logger.Trace(Strings.EXIT); } @@ -192,17 +202,27 @@ namespace MaestroShared.Targets { if (Parameters.TargetConfig.SaveMorpheusMetadata && Parameters.ArchiveMetadata != null && Parameters.MovieSegments != null && Parameters.MovieSegments.Count > 0) UploadMorpheusMetadata(); if (Parameters.TargetConfig.SaveSegments && Parameters.MovieSegments != null) - UpdateTrafficInformation(); + TrafficApprove(); if (Parameters.TargetConfig.SendEmailOnSuccess && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailPattern)) SendEmail(Parameters.TargetConfig.SuccessEmailRecipient, Parameters.TargetConfig.SuccessEmailPattern); logger.Trace(Strings.EXIT); } - private void UpdateTrafficInformation() { + private void TrafficApprove() { logger.Trace(Strings.ENTRY); TargetUpdateTrafficMessage message = new TargetUpdateTrafficMessage { VariantID = Parameters.VariantID, Ready = true, + MetadataType = Parameters.MetadataKind + }; + Parameters.MessageBus.Send(message); + logger.Trace(Strings.EXIT); + } + + private void TrafficSaveSegments() { + logger.Trace(Strings.ENTRY); + TargetUpdateTrafficMessage message = new TargetUpdateTrafficMessage { + VariantID = Parameters.VariantID, MetadataType = Parameters.MetadataKind, Segments = Parameters.MovieSegments }; @@ -287,7 +307,6 @@ namespace MaestroShared.Targets { private void SendWorkFlowAction() { logger.Trace(Strings.ENTRY); try { - Parameters?.MediaCubeApi?.Create(workFlowAction); } catch (Exception e) { logger.Error(e); diff --git a/client/MediaCubeClient/MediaCubeApi.cs b/client/MediaCubeClient/MediaCubeApi.cs index 952532ed..92b005ec 100644 --- a/client/MediaCubeClient/MediaCubeApi.cs +++ b/client/MediaCubeClient/MediaCubeApi.cs @@ -1,4 +1,5 @@ using LinkDotNet.MessageHandling.Contracts; +using MaestroShared.Commons; using MaestroShared.Interfaces; using MaestroShared.MessageBus; using MaestroShared.Model; @@ -62,14 +63,17 @@ namespace MediaCubeClient { var request = new RestRequest("media", Method.GET); request.AddQueryParameter("mediaHouseId", mediaHouseId); var response = client.Execute(request); - if (response.StatusCode != HttpStatusCode.OK || response.Content.Length < 1) { + if (response.StatusCode != HttpStatusCode.OK && + !response.ErrorMessage.IsEmpty()) { messageBus.Send(new MediaCubeMessage("Hiba a lekérdezésben. A rendszer üzenete: " + response.ErrorMessage)); return null; } - JObject media = JObject.Parse(response.Content); - if (media != null) - return media.Deserialize(); + if (!response.Content.IsEmpty()) { + JObject media = JObject.Parse(response.Content); + if (media != null) + return media.Deserialize(); + } return null; }