using Maestro.Configuration;\r
using Maestro.Targets;\r
+using Maestro;\r
using Microsoft.VisualStudio.TestTools.UnitTesting;\r
using System;\r
\r
},\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
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
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
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
searchResult.ShowDialog();\r
}\r
\r
- \r
+\r
}\r
}\r
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
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
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
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
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
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
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
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
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
\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
\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
}\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
}\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
}\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
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