namespace Maestro {\r
- partial class ArchiveMetadata {\r
+ partial class ArchiveMetadataForm {\r
/// <summary>\r
/// Required designer variable.\r
/// </summary>\r
this.tableLayoutPanel1.Size = new System.Drawing.Size(565, 357);\r
this.tableLayoutPanel1.TabIndex = 3;\r
// \r
- // ArchiveMetadata\r
+ // ArchiveMetadataForm\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.Controls.Add(this.tableLayoutPanel1);\r
this.Controls.Add(this.groupBox1);\r
this.Icon = global::Maestro.Properties.Resources.AppIcon;\r
- this.Name = "ArchiveMetadata";\r
+ this.Name = "ArchiveMetadataForm";\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
this.Text = "Archive metaadatok módosítása";\r
this.groupBox1.ResumeLayout(false);\r
using Maestro.Metadata;\r
\r
namespace Maestro {\r
- public partial class ArchiveMetadata : Form {\r
+ public partial class ArchiveMetadataForm : Form {\r
\r
- private ArchiveMetadataModel model;\r
+ private ArchiveMetadata model;\r
\r
- public ArchiveMetadata(ArchiveMetadataModel model) : this() {\r
+ public ArchiveMetadataForm(ArchiveMetadata model) : this() {\r
this.model = model;\r
FillTheTextBoxes();\r
}\r
\r
- public ArchiveMetadata() {\r
+ public ArchiveMetadataForm() {\r
InitializeComponent();\r
}\r
\r
<Reference Include="WindowsBase" />\r
</ItemGroup>\r
<ItemGroup>\r
- <Compile Include="ArchiveMetadata.cs">\r
+ <Compile Include="ArchiveMetadataForm.cs">\r
<SubType>Form</SubType>\r
</Compile>\r
- <Compile Include="ArchiveMetadata.Designer.cs">\r
- <DependentUpon>ArchiveMetadata.cs</DependentUpon>\r
+ <Compile Include="ArchiveMetadataForm.Designer.cs">\r
+ <DependentUpon>ArchiveMetadataForm.cs</DependentUpon>\r
</Compile>\r
<Compile Include="Commons\DataGridViewProgressColumn.cs" />\r
<Compile Include="Commons\ObjectExtensions.cs" />\r
<Compile Include="MaestroForm.Metadata.cs">\r
<SubType>Form</SubType>\r
</Compile>\r
- <Compile Include="MaestroForm.Target.cs">\r
- <SubType>Form</SubType>\r
- </Compile>\r
+ <Compile Include="MaestroForm.Target.cs" />\r
<Compile Include="Metadata\ArchiveMetadata.cs" />\r
<Compile Include="Metadata\IDTypes.cs" />\r
<Compile Include="Metadata\MenuButton.cs">\r
<Compile Include="Targets\SegmentConverter.cs" />\r
<Compile Include="Targets\TargetProcessor.cs" />\r
<Compile Include="Targets\ITargetProcessor.cs" />\r
- <EmbeddedResource Include="ArchiveMetadata.resx">\r
- <DependentUpon>ArchiveMetadata.cs</DependentUpon>\r
+ <EmbeddedResource Include="ArchiveMetadataForm.resx">\r
+ <DependentUpon>ArchiveMetadataForm.cs</DependentUpon>\r
</EmbeddedResource>\r
<EmbeddedResource Include="MaestroForm.resx">\r
<DependentUpon>MaestroForm.cs</DependentUpon>\r
private MetadataInfo selectedMetadata;\r
private List<Segment> segments = new List<Segment>();\r
private MediaCubeApi mediaCubeApi;\r
- private ArchiveMetadataModel model;\r
+ private ArchiveMetadata archiveMetadatamodel;\r
public MetadataInfo SelectedMetadata {\r
get {\r
return selectedMetadata;\r
}\r
\r
private void ModifyArchiveMetadataClick(object sender, EventArgs e) {\r
- ArchiveMetadata form = new ArchiveMetadata(model);\r
+ ArchiveMetadataForm form = new ArchiveMetadataForm(archiveMetadatamodel);\r
form.ShowDialog();\r
}\r
\r
using System.Text.RegularExpressions;\r
using TrafficClient;\r
using OctopusClient;\r
+using JobEngineClient;\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
+ }\r
+\r
public partial class MaestroForm {\r
\r
private SegmentConverter segmentConverter;\r
string fileName = actualRow.Cells[1].Value as string;\r
string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor);\r
Type type = Type.GetType(typeName);\r
+ int variantID = selectedMetadata.VariantID;\r
+ TrafficAPI api = trafficIDSelector.trafficAPI;\r
ISourceItem selectedFile = GetSourceItemFromBindingSource(fileName);//bindingSource.Current as ISourceItem;\r
string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID;\r
- object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi, model };\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
ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters);\r
processors.Add(processor);\r
}\r
private void EnableArchiveMetadataButtonAndCreateMetadataModel() {\r
ctxiModifyArchiveMetadata.Enabled = selectedMetadata != null;\r
if (ctxiModifyArchiveMetadata.Enabled) {\r
- model = new ArchiveMetadataModel();\r
+ archiveMetadatamodel = new ArchiveMetadata();\r
Cursor.Current = Cursors.WaitCursor;\r
IDTypes idType = GetTypeOfSelectedMetadata();\r
if (idType == IDTypes.OctopusID)\r
- FillTheModelFromOctopus(model);\r
+ FillTheModelFromOctopus(archiveMetadatamodel);\r
else //if (idType == IDTypes.TrafficID)\r
- FillTheModelFromTraffic(model);\r
+ FillTheModelFromTraffic(archiveMetadatamodel);\r
} else\r
- model = null;\r
+ archiveMetadatamodel = null;\r
}\r
\r
- private void FillTheModelFromTraffic(ArchiveMetadataModel model) {\r
+ private void FillTheModelFromTraffic(ArchiveMetadata model) {\r
string id = selectedMetadata.ID;\r
TrafficAPI api = trafficIDSelector.trafficAPI;\r
List<ArchiveMatadataWrapper> result = null;\r
model.mediaDescription = actualResult.EpisodeDescription;\r
}\r
\r
- private void FillTheModelFromOctopus(ArchiveMetadataModel model) {\r
+ private void FillTheModelFromOctopus(ArchiveMetadata model) {\r
string id = selectedMetadata.ID;\r
OctopusAPI api = octopusIDSelector.GetClient();\r
IEnumerable<Story> storyEnum = api.GetStoriesById(id);\r
}\r
}\r
\r
- private void FillModelFromStories(ArchiveMetadataModel model, List<Story> stories, OctopusAPI api) {\r
+ private void FillModelFromStories(ArchiveMetadata model, List<Story> stories, OctopusAPI api) {\r
if (stories == null || stories.Count == 0)\r
return;\r
Story story = stories[0];\r
-using Newtonsoft.Json;\r
+using System;\r
+using Newtonsoft.Json;\r
+using System.Runtime.Serialization.Formatters.Binary;\r
+using System.IO;\r
\r
namespace Maestro.Metadata {\r
- public class ArchiveMetadataModel {\r
+\r
+ [Serializable()]\r
+ public class ArchiveMetadata {\r
\r
//todo rename a Stuffra??\r
public string itemHouseId { get; set; }\r
//return String.Format("{{\n \"Anyag azonosító\": \"{0}\",\n, \"Anyag cím\": \"{1}\",\n \"Anyag leírása\": \"{2}\",\n \"Média azonosító\": \"{3}\",\n \"Média cím\": \"{4}\",\n \"Média leírás\": \"{5}\" \n}}",\r
// StuffID, StuffTitle, StuffDescription, MediaID, MediaTitle, MediaDescription);\r
}\r
+\r
+ public static ArchiveMetadata DeepClone(ArchiveMetadata obj) {\r
+ using (var ms = new MemoryStream()) {\r
+ var formatter = new BinaryFormatter();\r
+ formatter.Serialize(ms, obj);\r
+ ms.Position = 0;\r
+\r
+ return (ArchiveMetadata)formatter.Deserialize(ms);\r
+ }\r
+ }\r
}\r
}\r
private readonly Logger logger = LogManager.GetCurrentClassLogger();\r
protected FtpClient targetFTP;\r
\r
- public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel archiveMetadata)\r
- : base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, archiveMetadata) {\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
FtpTrace.LogFunctions = false;\r
Uri inputUri = new Uri(String.Format("{0}/{1}", sourceConfig.Local.Address.LocalPath, inputFileName));\r
inputFile = new FileInfo(inputUri.LocalPath);\r
private Logger logger = LogManager.GetCurrentClassLogger();\r
private Source sourceConfig;\r
\r
- public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel model) :\r
- base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, model) {\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
}\r
\r
protected FileInfo inputFile;\r
protected string workingDir;\r
protected List<Segment> segments;\r
- protected ArchiveMetadataModel archiveMetadata;\r
+ protected ArchiveMetadata archiveMetadata;\r
+ protected TrafficAPI client;\r
+ protected int variantID;\r
+\r
public WorkflowAction workFlowAction { get; set; }\r
\r
- public UNCTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel archiveMetadata)\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
: 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
inputFile = new FileInfo(Input);\r
SaveSegments();\r
}\r
\r
- \r
private void SaveSegments() {\r
- MaestroForm maestroForm = parent as MaestroForm;\r
- TrafficMetadata metadata = maestroForm.Configuration.Metadatas.Where(m => { return m is TrafficMetadata; }).FirstOrDefault() as TrafficMetadata;\r
- TrafficAPI client = new TrafficAPI(metadata.Server.Address.OriginalString, metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout);\r
- client.DeleteSegments(maestroForm.SelectedMetadata.VariantID);\r
+ client.DeleteSegments(variantID);\r
foreach (Segment actual in segments) {\r
- client.AddSegmentToCopia(maestroForm.SelectedMetadata.VariantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
+ client.AddSegmentToCopia(variantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
}\r
}\r
\r