git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorBellai Ádám <USER\adam.bellai>
Fri, 6 Oct 2017 13:54:32 +0000 (13:54 +0000)
committerBellai Ádám <USER\adam.bellai>
Fri, 6 Oct 2017 13:54:32 +0000 (13:54 +0000)
client/IntegrationTests/MaestroIT.cs
client/Maestro/MaestroForm.Target.cs
client/Maestro/MaestroForm.cs
client/Maestro/Targets/FTPTargetProcessor.cs
client/Maestro/Targets/FXPTargetProcessor.cs
client/Maestro/Targets/UNCTargetProcessor.cs
client/PlanAIRClient/TrafficAPI.cs
client/PlanAIRClient/Workers/BroadcastWorker.cs

index 2ab62d648ae68d4f017dae0c7d371e51b20a3298..10b60eec8bc9bfa855d36fce52ea8ec1de561065 100644 (file)
@@ -1,5 +1,6 @@
 using Maestro.Configuration;\r
 using Maestro.Targets;\r
+using Maestro;\r
 using Microsoft.VisualStudio.TestTools.UnitTesting;\r
 using System;\r
 \r
@@ -17,7 +18,16 @@ namespace IntegrationTests {
                 },\r
                 OutputFormat = "{0}_{1}_{2}"\r
             };\r
-            FTPTargetProcessor sut = new FTPTargetProcessor(null, null, configuration, @"c:\tmp\watch\tcdrone.MXF", "000000", null, null, null);\r
+            TargetProcessorParametersWrapper parameters = new TargetProcessorParametersWrapper() {\r
+                SourceConfig = null,\r
+                TargetConfig = configuration,\r
+                InputFileName = @"c:\tmp\watch\tcdrone.MXF",\r
+                ID = "000000",\r
+                Segments = null,\r
+                MediaCubeApi = null,\r
+                ArchiveMetadata = null\r
+            };\r
+            FTPTargetProcessor sut = new FTPTargetProcessor(null, parameters);\r
             sut.Execute();\r
         }\r
 \r
index a95a6bf836816a65cef7735e9e3599afa7d70571..d8a69d2345bd2f21713f58ec33efd406d2f66c09 100644 (file)
@@ -14,15 +14,15 @@ using JobEngineClient;
 namespace Maestro {\r
 \r
     public class TargetProcessorParametersWrapper {\r
-        public Source sourceConfig { get; set; }\r
-        public Target targetConfig { get; set; }\r
-        public string inputFileName { get; set; }\r
-        public string id { get; set; }\r
-        public List<Segment> segments { get; set; }\r
-        public MediaCubeApi mediaCubeApi { get; set; }\r
-        public ArchiveMetadata archiveMetadata { get; set; }\r
-        public TrafficAPI client { get; set; }\r
-        public int variantID { get; set; }\r
+        public Source SourceConfig { get; set; }\r
+        public Target TargetConfig { get; set; }\r
+        public string InputFileName { get; set; }\r
+        public string ID { get; set; }\r
+        public List<Segment> Segments { get; set; }\r
+        public MediaCubeApi MediaCubeApi { get; set; }\r
+        public ArchiveMetadata ArchiveMetadata { get; set; }\r
+        public TrafficAPI Client { get; set; }\r
+        public int VariantID { get; set; }\r
     }\r
 \r
     public partial class MaestroForm {\r
@@ -62,7 +62,18 @@ namespace Maestro {
                         string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID;\r
                         ArchiveMetadata archiveMetadataClone = ArchiveMetadata.DeepClone(archiveMetadatamodel);\r
                         List<Segment> segmentsClone = new List<Segment>(segments);\r
-                        object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segmentsClone, mediaCubeApi, archiveMetadataClone, api, variantID };\r
+                        TargetProcessorParametersWrapper parameterObj = new TargetProcessorParametersWrapper() {\r
+                            ArchiveMetadata = archiveMetadataClone,\r
+                            Client = api,\r
+                            ID = id,\r
+                            InputFileName = selectedFile.Name,\r
+                            MediaCubeApi = mediaCubeApi,\r
+                            Segments = segmentsClone,\r
+                            SourceConfig = Configuration.Source,\r
+                            TargetConfig = target,\r
+                            VariantID = variantID\r
+                        };\r
+                        object[] parameters = new object[] { this, parameterObj};\r
                         ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters);\r
                         processors.Add(processor);\r
                     }\r
index d99aa6fa81a58c8c5b0216d80f8e049023a9a3a1..e9a08042f3a4c095a84b60f2938434c5b9211bbd 100644 (file)
@@ -223,7 +223,6 @@ namespace Maestro {
                 result = api.GetBroadcasts(startingName, null, null, true);\r
             else if (startingName.StartsWith("P"))\r
                 result = api.GetPromotionals(startingName);\r
-            //todo ha az adatbázis felvan töltve normális adatokkal, megnézni hogy tényleg R betüvel kezdődnek-e a reklámok\r
             else if (startingName.StartsWith("R"))\r
                 result = api.GetAdvertisements(startingName);\r
             ProcessMamResults(result);\r
@@ -244,6 +243,6 @@ namespace Maestro {
             searchResult.ShowDialog();\r
         }\r
 \r
-        \r
+\r
     }\r
 }\r
index 983670bbe56fc5c463cf05dcc4b3216b87070c89..fb82d9e5f38ac8729aeab4f4d41ad1a2ad7f9712 100644 (file)
@@ -5,11 +5,7 @@ using System;
 using System.IO;\r
 using System.Net;\r
 using System.Windows.Forms;\r
-using System.Collections.Generic;\r
-using TrafficClient;\r
 using Model;\r
-using JobEngineClient;\r
-using Maestro.Metadata;\r
 \r
 namespace Maestro.Targets {\r
 \r
@@ -17,22 +13,19 @@ namespace Maestro.Targets {
         private readonly Logger logger = LogManager.GetCurrentClassLogger();\r
         protected FtpClient targetFTP;\r
 \r
-        public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, \r
-            string inputFileName, string id, List<Segment> segments, \r
-            MediaCubeApi mediaCubeApi, ArchiveMetadata archiveMetadata,\r
-            TrafficAPI client, int variantID)\r
-            : base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, archiveMetadata, client, variantID) {\r
+        public FTPTargetProcessor(Control parent, TargetProcessorParametersWrapper parameters)\r
+            : base(parent, parameters) {\r
             FtpTrace.LogFunctions = false;\r
-            Uri inputUri = new Uri(String.Format("{0}/{1}", sourceConfig.Local.Address.LocalPath, inputFileName));\r
+            Uri inputUri = new Uri(String.Format("{0}/{1}", parameters.SourceConfig.Local.Address.LocalPath, parameters.InputFileName));\r
             inputFile = new FileInfo(inputUri.LocalPath);\r
             Input = inputFile.FullName;\r
-            ID = id;\r
-            workFlowAction = new WorkflowAction() { houseId = ID, tag = targetConfig.Tag, touched = DateTime.Now };\r
+            ID = parameters.ID;\r
+            workFlowAction = new WorkflowAction() { houseId = ID, tag = parameters.TargetConfig.Tag, touched = DateTime.Now };\r
         }\r
 \r
         protected override void BeforeExecute() {\r
             base.BeforeExecute();\r
-            targetFTP = CreateClient(targetConfig.Remote);\r
+            targetFTP = CreateClient(parameters.TargetConfig.Remote);\r
         }\r
 \r
         protected override void AfterExecute() {\r
index 52e4a835e042462b430d8fd97022e137f68750b1..9bc19495812d1ff4a953ac6dd925108127dc3f0e 100644 (file)
@@ -1,15 +1,10 @@
 using FluentFTP;\r
-using Maestro.Commons;\r
 using Maestro.Configuration;\r
 using NLog;\r
 using System;\r
 using System.Text.RegularExpressions;\r
 using System.Threading;\r
 using System.Windows.Forms;\r
-using System.Collections.Generic;\r
-using TrafficClient;\r
-using JobEngineClient;\r
-using Maestro.Metadata;\r
 \r
 namespace Maestro.Targets {\r
 \r
@@ -17,12 +12,9 @@ namespace Maestro.Targets {
         private Logger logger = LogManager.GetCurrentClassLogger();\r
         private Source sourceConfig;\r
 \r
-        public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, \r
-            string inputFileName, string id, List<Segment> segments,\r
-            MediaCubeApi mediaCubeApi, ArchiveMetadata archiveMetadata,\r
-            TrafficAPI client, int variantID) :\r
-            base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, archiveMetadata, client, variantID) {\r
-            this.sourceConfig = sourceConfig;\r
+        public FXPTargetProcessor(Control parent,TargetProcessorParametersWrapper parameters) :\r
+            base(parent, parameters) {\r
+            sourceConfig = parameters.SourceConfig;\r
         }\r
 \r
         protected override void UploadFile() {\r
@@ -61,7 +53,7 @@ namespace Maestro.Targets {
                 if (!replyRETR.Success)\r
                     throw new Exception(replyRETR.ErrorMessage);\r
 \r
-                monitorFTP = CreateClient(targetConfig.Remote);\r
+                monitorFTP = CreateClient(parameters.TargetConfig.Remote);\r
 \r
                 long overall = 0;\r
                 while (overall != ilength) {\r
index e74c9ad938b7d28857c29b5c06b2b5b48ce1a725..34cd43ae8ccfb72b5b4f51772907e2303b9d65cb 100644 (file)
@@ -1,14 +1,10 @@
 using Maestro.Configuration;\r
 using NLog;\r
 using System;\r
-using System.Linq;\r
 using System.IO;\r
 using System.Windows.Forms;\r
-using System.Collections.Generic;\r
 using TrafficClient;\r
 using Model;\r
-using JobEngineClient;\r
-using Maestro.Metadata;\r
 using System.Text;\r
 using Maestro.Commons;\r
 \r
@@ -25,33 +21,20 @@ namespace Maestro.Targets {
         private const string STATUS_FOLDER = ".STATUS";\r
         private const string KILLDATE_FILE = "{0}.{1}.killdate";\r
         private const string METADATA_FILE = "{0}.json";\r
-        private MediaCubeApi mediaCubeApi;\r
-        protected Target targetConfig;\r
         protected FileInfo inputFile;\r
         protected string workingDir;\r
-        protected List<Segment> segments;\r
-        protected ArchiveMetadata archiveMetadata;\r
-        protected TrafficAPI client;\r
-        protected int variantID;\r
+        protected TargetProcessorParametersWrapper parameters;\r
 \r
         public WorkflowAction workFlowAction { get; set; }\r
 \r
-        public UNCTargetProcessor(Control parent, Source sourceConfig, Target targetConfig,\r
-            string inputFileName, string id, List<Segment> segments,\r
-            MediaCubeApi mediaCubeApi, ArchiveMetadata archiveMetadata, \r
-            TrafficAPI client, int variantID)\r
+        public UNCTargetProcessor(Control parent, TargetProcessorParametersWrapper parameters)\r
             : base(parent) {\r
-            this.mediaCubeApi = mediaCubeApi;\r
-            this.targetConfig = targetConfig;\r
-            this.archiveMetadata = archiveMetadata;\r
-            this.segments = segments;\r
-            this.client = client;\r
-            this.variantID = variantID;\r
-            InputName = inputFileName;\r
-            Input = Path.Combine(sourceConfig.Local.Address.LocalPath, inputFileName);\r
+            this.parameters = parameters;\r
+            InputName = parameters.InputFileName;\r
+            Input = Path.Combine(parameters.SourceConfig.Local.Address.LocalPath, parameters.InputFileName);\r
             inputFile = new FileInfo(Input);\r
-            ID = id;\r
-            workFlowAction = new WorkflowAction() { houseId = ID, tag = targetConfig.Tag, touched = DateTime.Now };\r
+            ID = parameters.ID;\r
+            workFlowAction = new WorkflowAction() { houseId = ID, tag = parameters.TargetConfig.Tag, touched = DateTime.Now };\r
         }\r
 \r
         protected virtual void BeforeExecute() {\r
@@ -64,7 +47,7 @@ namespace Maestro.Targets {
             bool result = false;\r
             try {\r
                 BeforeExecute();\r
-                workingDir = DetermineWorkingDirectory(targetConfig.Remote);\r
+                workingDir = DetermineWorkingDirectory(parameters.TargetConfig.Remote);\r
                 EnsureDirectoryExistence(workingDir);\r
                 OutputName = CreateOutputFileName();\r
                 Output = Path.Combine(workingDir, OutputName);\r
@@ -93,18 +76,18 @@ namespace Maestro.Targets {
             Message = SUCCESS;\r
             workFlowAction.description = SUCCESS;\r
             workFlowAction.successful = true;\r
-            if (targetConfig.KillDateDays > 0)\r
+            if (parameters.TargetConfig.KillDateDays > 0)\r
                 UploadKillDateFile();\r
-            if (targetConfig.UseMetadata && archiveMetadata != null)\r
+            if (parameters.TargetConfig.UseMetadata && parameters.ArchiveMetadata != null)\r
                 CreateMetadata();\r
-            if (targetConfig.SaveSegments && segments != null)\r
+            if (parameters.TargetConfig.SaveSegments && parameters.Segments != null)\r
                 SaveSegments();\r
         }\r
 \r
         private void SaveSegments() {\r
-            client.DeleteSegments(variantID);\r
-            foreach (Segment actual in segments) {\r
-                client.AddSegmentToCopia(variantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
+            parameters.Client.DeleteSegments(parameters.VariantID);\r
+            foreach (Segment actual in parameters.Segments) {\r
+                parameters.Client.AddSegmentToCopia(parameters.VariantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
             }\r
         }\r
 \r
@@ -120,7 +103,7 @@ namespace Maestro.Targets {
 \r
         private void SendWorkFlowAction() {\r
             try {\r
-                mediaCubeApi.Create(workFlowAction);\r
+                parameters.MediaCubeApi.Create(workFlowAction);\r
             }\r
             catch (Exception e) {\r
                 MessageBox.Show(parent, e.Message);\r
@@ -129,7 +112,7 @@ namespace Maestro.Targets {
 \r
         private String DetermineWorkingDirectory(Connection connection) {\r
             string result = null;\r
-            if (targetConfig.CreateSubFolder)\r
+            if (parameters.TargetConfig.CreateSubFolder)\r
                 result = Path.Combine(connection.Address.LocalPath, ID);\r
             else\r
                 result = connection.Address.LocalPath;\r
@@ -137,23 +120,23 @@ namespace Maestro.Targets {
         }\r
 \r
         private void UploadKillDateFile() {\r
-            Uri address = targetConfig.Remote.Address;\r
+            Uri address = parameters.TargetConfig.Remote.Address;\r
             string statusWorkDir = Path.Combine(address.LocalPath, STATUS_FOLDER);\r
             EnsureDirectoryExistence(statusWorkDir);\r
             DateTime date = DateTime.Now;\r
-            date = date.AddDays(targetConfig.KillDateDays);\r
+            date = date.AddDays(parameters.TargetConfig.KillDateDays);\r
             string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd"));\r
             logger.Debug("Creating KILLDATE status file {0}", fileName);\r
             UploadContent(Path.Combine(statusWorkDir, fileName), null);\r
         }\r
 \r
         private void CreateMetadata() {\r
-            Uri address = targetConfig.Remote.Address;\r
+            Uri address = parameters.TargetConfig.Remote.Address;\r
             string statusWorkDir = Path.Combine(address.LocalPath, STATUS_FOLDER);\r
             EnsureDirectoryExistence(statusWorkDir);\r
             string fileName = String.Format(METADATA_FILE, OutputName);\r
             logger.Debug("Creating METADATA file {0}", fileName);\r
-            byte[] content = Encoding.UTF8.GetBytes(archiveMetadata.ToString());\r
+            byte[] content = Encoding.UTF8.GetBytes(parameters.ArchiveMetadata.ToString());\r
             UploadContent(Path.Combine(statusWorkDir, fileName), content);\r
         }\r
 \r
@@ -183,7 +166,7 @@ namespace Maestro.Targets {
         }\r
 \r
         protected virtual string CreateOutputFileName() {\r
-            string nameWithoutExtension = targetConfig.OutputFormat.Replace("%ID%", ID).Replace("%SOURCENAME%", Path.GetFileNameWithoutExtension(inputFile.Name));\r
+            string nameWithoutExtension = parameters.TargetConfig.OutputFormat.Replace("%ID%", ID).Replace("%SOURCENAME%", Path.GetFileNameWithoutExtension(inputFile.Name));\r
             string result = String.Format(FILENAME, nameWithoutExtension, inputFile.Extension);\r
             int version = 1;\r
             while (FileExists(Path.Combine(workingDir, result))) {\r
index 5edaac15da0d9969b66222a1332bc3e0730f1728..050aacab69a7182afceebe8fa3d3f67604f8868d 100644 (file)
@@ -36,7 +36,7 @@ namespace TrafficClient {
         }\r
 \r
         public void BroadcastOKForAir(int itemID) {\r
-            broadvastWorker.BroadcastOKForAir(itemID);\r
+            broadvastWorker.SetBroadcastOKForAir(itemID);\r
         }\r
 \r
         public List<MamResultWrapper> GetPromotionals(string strParam) {\r
index ec29695f2a461d4792e55f3a335321c97b4c83fb..70097c6c374d8416f3305686b7a22a0ca0eedef1 100644 (file)
@@ -124,7 +124,7 @@ namespace TrafficClient.Workers {
             return result;\r
         }\r
 \r
-        public void BroadcastOKForAir(int itemID) {\r
+        public void SetBroadcastOKForAir(int itemID) {\r
             try {\r
                 TryConnect();\r
                 using (SqlCommand cmd = new SqlCommand("dbo.clIFsp_EC_MAM", connection)) {\r