From: Bellai Ádám Date: Thu, 5 Oct 2017 15:04:19 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=596b892d4ac1ef9397586f4f4ff29f714c322ca5;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30542 --- diff --git a/client/DxPlay/PlayerForm.Designer.cs b/client/DxPlay/PlayerForm.Designer.cs index 5c8a8f6a..d1875909 100644 --- a/client/DxPlay/PlayerForm.Designer.cs +++ b/client/DxPlay/PlayerForm.Designer.cs @@ -61,8 +61,8 @@ namespace DxPlay { this.defineOneSegmentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitSegmentAtCurrentPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteSegmentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.actualPositionToIntroToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.actualPositionToOutroToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.actualPositionToIntroToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.actualPositionToOutroToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -319,45 +319,45 @@ namespace DxPlay { this.defineOneSegmentToolStripMenuItem, this.splitSegmentAtCurrentPositionToolStripMenuItem, this.deleteSegmentToolStripMenuItem, - this.actualPositionToIntroToolStripMenuItem1, - this.actualPositionToOutroToolStripMenuItem1}); + this.actualPositionToIntroToolStripMenuItem, + this.actualPositionToOutroToolStripMenuItem}); this.ctxmSegmentActions.Name = "ctxmSegmentActions"; - this.ctxmSegmentActions.Size = new System.Drawing.Size(302, 114); + this.ctxmSegmentActions.Size = new System.Drawing.Size(296, 114); // // defineOneSegmentToolStripMenuItem // this.defineOneSegmentToolStripMenuItem.Name = "defineOneSegmentToolStripMenuItem"; - this.defineOneSegmentToolStripMenuItem.Size = new System.Drawing.Size(301, 22); + this.defineOneSegmentToolStripMenuItem.Size = new System.Drawing.Size(295, 22); this.defineOneSegmentToolStripMenuItem.Text = "Define one segment for movie"; this.defineOneSegmentToolStripMenuItem.Click += new System.EventHandler(this.OnDefineOneSegmentClick); // // splitSegmentAtCurrentPositionToolStripMenuItem // this.splitSegmentAtCurrentPositionToolStripMenuItem.Name = "splitSegmentAtCurrentPositionToolStripMenuItem"; - this.splitSegmentAtCurrentPositionToolStripMenuItem.Size = new System.Drawing.Size(301, 22); + this.splitSegmentAtCurrentPositionToolStripMenuItem.Size = new System.Drawing.Size(295, 22); this.splitSegmentAtCurrentPositionToolStripMenuItem.Text = "Split segment at current position"; this.splitSegmentAtCurrentPositionToolStripMenuItem.Click += new System.EventHandler(this.OnSplitSegmentAtCurrentPositionClick); // // deleteSegmentToolStripMenuItem // this.deleteSegmentToolStripMenuItem.Name = "deleteSegmentToolStripMenuItem"; - this.deleteSegmentToolStripMenuItem.Size = new System.Drawing.Size(301, 22); + this.deleteSegmentToolStripMenuItem.Size = new System.Drawing.Size(295, 22); this.deleteSegmentToolStripMenuItem.Text = "Delete segment"; this.deleteSegmentToolStripMenuItem.Click += new System.EventHandler(this.OnDeleteSegmentClick); // - // actualPositionToIntroToolStripMenuItem1 + // actualPositionToIntroToolStripMenuItem // - this.actualPositionToIntroToolStripMenuItem1.Name = "actualPositionToIntroToolStripMenuItem1"; - this.actualPositionToIntroToolStripMenuItem1.Size = new System.Drawing.Size(301, 22); - this.actualPositionToIntroToolStripMenuItem1.Text = "actualPositionToIntroToolStripMenuItem1"; - this.actualPositionToIntroToolStripMenuItem1.Click += new System.EventHandler(this.OnActualPositionToIntroToolStripMenuItem1Click); + this.actualPositionToIntroToolStripMenuItem.Name = "actualPositionToIntroToolStripMenuItem"; + this.actualPositionToIntroToolStripMenuItem.Size = new System.Drawing.Size(295, 22); + this.actualPositionToIntroToolStripMenuItem.Text = "actualPositionToIntroToolStripMenuItem"; + this.actualPositionToIntroToolStripMenuItem.Click += new System.EventHandler(this.OnActualPositionToTCInToolStripMenuItem1Click); // - // actualPositionToOutroToolStripMenuItem1 + // actualPositionToOutroToolStripMenuItem // - this.actualPositionToOutroToolStripMenuItem1.Name = "actualPositionToOutroToolStripMenuItem1"; - this.actualPositionToOutroToolStripMenuItem1.Size = new System.Drawing.Size(301, 22); - this.actualPositionToOutroToolStripMenuItem1.Text = "actualPositionToOutroToolStripMenuItem1"; - this.actualPositionToOutroToolStripMenuItem1.Click += new System.EventHandler(this.OnActualPositionToOutroToolStripMenuItem1Click); + this.actualPositionToOutroToolStripMenuItem.Name = "actualPositionToOutroToolStripMenuItem"; + this.actualPositionToOutroToolStripMenuItem.Size = new System.Drawing.Size(295, 22); + this.actualPositionToOutroToolStripMenuItem.Text = "actualPositionToOutroToolStripMenuItem"; + this.actualPositionToOutroToolStripMenuItem.Click += new System.EventHandler(this.OnActualPositionToTCOutToolStripMenuItem1Click); // // PlayerForm // @@ -406,8 +406,8 @@ namespace DxPlay { private DataGridView dgSegments; private BindingSource bsSegments; private ToolStripMenuItem deleteSegmentToolStripMenuItem; - private ToolStripMenuItem actualPositionToIntroToolStripMenuItem1; - private ToolStripMenuItem actualPositionToOutroToolStripMenuItem1; + private ToolStripMenuItem actualPositionToIntroToolStripMenuItem; + private ToolStripMenuItem actualPositionToOutroToolStripMenuItem; } } diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 6a2a24de..9834d16b 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -274,7 +274,7 @@ namespace DxPlay { } return result; } - + private void PlayerForm_FormClosing(object sender, FormClosingEventArgs e) { if (m_play != null) { m_play.Stop(); @@ -310,6 +310,12 @@ namespace DxPlay { TCOut = new Timecode(m_mediaDescription.FirstFrame, m_mediaDescription.Duration) }; segments.Add(segment); + //if (outro == null) + // segments.Add(segment); + //else { + // int index = segments.Count - 2; + // segments.Insert(index, segment); + //} } private void OnDeleteSegmentClick(object sender, EventArgs e) { @@ -324,14 +330,83 @@ namespace DxPlay { } - private void OnActualPositionToIntroToolStripMenuItem1Click(object sender, EventArgs e) { - //todo + //todo stringetket resources file-ba + private void OnActualPositionToTCInToolStripMenuItem1Click(object sender, EventArgs e) { + MovieSegment currentSegment = GetCurrentSegment(); + if (currentSegment != null) { + if (currentSegment.TCIn != null) { + DialogResult dialogResult = MessageBox.Show("Biztos felül akarja írni az belépõt?", "Belépõ felülírása", MessageBoxButtons.YesNo); + if (dialogResult == DialogResult.Yes) + currentSegment.TCIn = m_play.CurrentTC; + } else + currentSegment.TCIn = m_play.CurrentTC; + } + + + //if (intro != null) { + // DialogResult dialogResult = MessageBox.Show("Biztos felül akarja írni az belépõt?", "Belépõ felülírása", MessageBoxButtons.YesNo); + // if (dialogResult == DialogResult.Yes) { + // segments.RemoveAt(0); + // CreateAndAddIntroToSegments(); + // } + //} else + // CreateAndAddIntroToSegments(); + } + + //private void CreateAndAddIntroToSegments() { + // intro = new MovieSegment() { + // TCIn = new Timecode(m_mediaDescription.FirstFrame), + // TCOut = m_play.CurrentTC + // }; + // segments.Insert(0, intro); + //} + + private void OnActualPositionToTCOutToolStripMenuItem1Click(object sender, EventArgs e) { + MovieSegment currentSegment = GetCurrentSegment(); + if (currentSegment != null) { + if (currentSegment.TCOut != null) { + DialogResult dialogResult = MessageBox.Show("Biztos felül akarja írni a kilépõt?", "Kilépõ felülírása", MessageBoxButtons.YesNo); + if (dialogResult == DialogResult.Yes) { + currentSegment.TCOut = m_play.CurrentTC; + } + } else + currentSegment.TCOut = m_play.CurrentTC; + } + + + + //if (outro != null) { + // DialogResult dialogResult = MessageBox.Show("Biztos felül akarja írni a kilépõt?", "Kilépõ felülírása", MessageBoxButtons.YesNo); + // if (dialogResult == DialogResult.Yes) { + // int outroIndex = segments.Count - 1; + // segments.RemoveAt(outroIndex); + // CreateAndAddOutroToSegments(); + // } + //} else + // CreateAndAddOutroToSegments(); } - private void OnActualPositionToOutroToolStripMenuItem1Click(object sender, EventArgs e) { - //todo + private MovieSegment GetCurrentSegment() { + DataGridViewRow selectedRow = dgSegments.SelectedRows[0]; + for (int i = 0; i < dgSegments.Rows.Count; i++) { + DataGridViewRow actual = dgSegments.Rows[i]; + if (selectedRow.Equals(actual)) { + return segments[i]; + } + + } + return null; } + //private void CreateAndAddOutroToSegments() { + // outro = new MovieSegment() { + // TCIn = m_play.CurrentTC, + // TCOut = new Timecode(m_play.CurrentTC, m_play.MediaDescription.Duration) + // }; + // int index = segments.Count; + // segments.Insert(index, outro); + //} + private void OnSplitSegmentAtCurrentPositionClick(object sender, EventArgs e) { MovieSegment segment = segments.Where(s => m_play.CurrentTC.Frames > s.TCIn.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).FirstOrDefault(); diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index cba2bd62..df6ddc14 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -66,8 +66,6 @@ namespace Maestro { this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.groupActions = new System.Windows.Forms.GroupBox(); this.dataGridJobs = new System.Windows.Forms.DataGridView(); - this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components); - this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.columnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn(); @@ -75,6 +73,8 @@ namespace Maestro { this.columnFinished = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnInput = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnOutput = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components); + this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.groupSource.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); @@ -581,10 +581,6 @@ namespace Maestro { this.dataGridJobs.TabIndex = 0; this.dataGridJobs.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridJobs_CellEnter); // - // metadataInfoBindingSource - // - this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo); - // // columnID // this.columnID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; @@ -653,6 +649,10 @@ namespace Maestro { this.columnOutput.Name = "columnOutput"; this.columnOutput.Width = 68; // + // metadataInfoBindingSource + // + this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo); + // // MaestroForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 88cba312..91ffa1e7 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -90,7 +90,7 @@ namespace Maestro { if (match.Success) { result = IDTypes.TrafficID; } else { - pattern = "[0-9]"; + pattern = "^[0-9]+$"; match = Regex.Match(selectedMetadata.ID, pattern); result = match.Success ? IDTypes.OctopusID : IDTypes.None; } @@ -112,6 +112,7 @@ namespace Maestro { } private void ConvertMovieSegmentsToSegments(BindingList movieSegments) { + segments.Clear(); foreach (MovieSegment actual in movieSegments) { Segment actualSegment = segmentConverter.ConvertToSegment(actual); segments.Add(actualSegment); @@ -137,7 +138,7 @@ namespace Maestro { ID = selectedID, VariantID = variantID }; - EnableArchiveMetadataButtonAndCreateMetadataModel(); + // EnableArchiveMetadataButtonAndCreateMetadataModel(); } } } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 17a16d91..7b4cab5a 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -128,7 +128,7 @@ namespace Maestro { IDTypes idType = GetTypeOfSelectedMetadata(); if (idType == IDTypes.OctopusID) FillTheModelFromOctopus(model); - else if (idType == IDTypes.TrafficID) + else //if (idType == IDTypes.TrafficID) FillTheModelFromTraffic(model); } else model = null; @@ -137,7 +137,15 @@ namespace Maestro { private void FillTheModelFromTraffic(ArchiveMetadataModel model) { string id = selectedMetadata.ID; TrafficAPI api = trafficIDSelector.trafficAPI; - List result = api.SearchArchiveMetadata(id); ; + List result = null; + if (id.StartsWith("M")) + result = api.SearchArchiveMetadataBroadcast(id); + else if (id.StartsWith("P")) + result = api.SearchArchiveMetadataPromotional(id); + else if (id.StartsWith("R")) + result = api.SearchArchiveMetadataAdvertisement(id); + if (result == null) + return; ArchiveMatadataWrapper actualResult = result[0]; model.itemHouseId = actualResult.ProgID; model.itemTitle = actualResult.ProgTitle; @@ -163,6 +171,8 @@ namespace Maestro { } private void FillModelFromStories(ArchiveMetadataModel model, List stories, OctopusAPI api) { + if (stories == null || stories.Count == 0) + return; Story story = stories[0]; if (story.StoryFolders != null) { IEnumerable storyFoldersEnum = api.GetStoryFoldersByStoryID(story.ID); diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index a3c13d1c..8bd406ac 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -168,9 +168,6 @@ namespace Maestro { case Metadata.IDTypes.OctopusID: SetOctopusIDToMetadataText(); break; - //case Metadata.IDTypes.None: - // MessageBox.Show(this, StringResources.NINCS_TALALAT); - // break; } } @@ -238,6 +235,7 @@ namespace Maestro { return; } if (result.Count == 1) { + trafficMetadataSelected?.Invoke(result[0].MediaID, result[0].VariantID); EnableArchiveMetadataButtonAndCreateMetadataModel(); textSelectedMetadata.Text = result[0].MediaID; return; diff --git a/client/Maestro/Targets/UNCTargetProcessor.cs b/client/Maestro/Targets/UNCTargetProcessor.cs index 615abcf6..423671e4 100644 --- a/client/Maestro/Targets/UNCTargetProcessor.cs +++ b/client/Maestro/Targets/UNCTargetProcessor.cs @@ -89,7 +89,7 @@ namespace Maestro.Targets { UploadKillDateFile(); if (targetConfig.UseMetadata && archiveMetadata != null) CreateMetadata(); - if (targetConfig.SaveSegments && segments != null && segments.Count > 0) + if (targetConfig.SaveSegments && segments != null) SaveSegments(); } diff --git a/client/PlanAIRClient/TrafficAPI.cs b/client/PlanAIRClient/TrafficAPI.cs index 948f6b02..44cbf772 100644 --- a/client/PlanAIRClient/TrafficAPI.cs +++ b/client/PlanAIRClient/TrafficAPI.cs @@ -212,7 +212,7 @@ namespace TrafficClient { return result; } - public List SearchArchiveMetadata(string strParam) { + public List SearchArchiveMetadataBroadcast(string strParam) { List sqlResult = null; List result = null; try { @@ -224,7 +224,7 @@ namespace TrafficClient { cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); cmd.Parameters.AddWithValue("@@StrParam1", strParam); sqlResult = ExecuteAndReadBradcast(cmd); - result = ProcessArchiveResult(sqlResult); + result = ProcessArchiveBroadcastResult(sqlResult); } } catch (Exception e) { @@ -237,7 +237,57 @@ namespace TrafficClient { return result; } - private List ProcessArchiveResult(List sqlResult) { + public List SearchArchiveMetadataPromotional(string strParam) { + List sqlResult = null; + List result = null; + try { + TryConnect(); + using (SqlCommand cmd = new SqlCommand("dbo.clIFsp_EC_MAM", connection)) { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Operation", 2001); + cmd.Parameters.AddWithValue("@@@Options", 40); + cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); + cmd.Parameters.AddWithValue("@@StrParam1", strParam); + sqlResult = ExecuteAndReadPromotionals(cmd); + result = ProcessArchivePromotionalResult(sqlResult); + } + } + catch (Exception e) { + logger.Error(e.Message); + throw e; + } + finally { + connection.Close(); + } + return result; + } + + public List SearchArchiveMetadataAdvertisement(string strParam) { + List sqlResult = null; + List result = null; + try { + TryConnect(); + using (SqlCommand cmd = new SqlCommand("dbo.clIFsp_EC_MAM", connection)) { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Operation", 3001); + cmd.Parameters.AddWithValue("@@@Options", 40); + cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); + cmd.Parameters.AddWithValue("@@StrParam1", strParam); + sqlResult = ExecuteAndReadAdvertisement(cmd); + result = ProcessArchiveAdvertisementResult(sqlResult); + } + } + catch (Exception e) { + logger.Error(e.Message); + throw e; + } + finally { + connection.Close(); + } + return result; + } + + private List ProcessArchiveBroadcastResult(List sqlResult) { if (sqlResult == null) return null; List result = new List(); @@ -253,6 +303,37 @@ namespace TrafficClient { return result; } + private List ProcessArchivePromotionalResult(List sqlResult) { + if (sqlResult == null) + return null; + List result = new List(); + foreach (clIFsp_EC_MAMPromotionalResult actual in sqlResult) { + ArchiveMatadataWrapper actualObject = new ArchiveMatadataWrapper() { + EpisodeID = actual.t_MediaID, + ProgID = actual.t_SpotID.ToString(), + ProgTitle = actual.v_ProgTitle, + }; + result.Add(actualObject); + } + return result; + } + + private List ProcessArchiveAdvertisementResult(List sqlResult) { + if (sqlResult == null) + return null; + List result = new List(); + foreach (clIFsp_EC_MAMAdvertismentResult actual in sqlResult) { + ArchiveMatadataWrapper actualObject = new ArchiveMatadataWrapper() { + EpisodeID = actual.t_MediaID, + EpisodeTitle = actual.v_Title, + ProgID = actual.t_SpotID.ToString(), + ProgTitle = actual.v_Title + }; + result.Add(actualObject); + } + return result; + } + public List SearchPromotional(string strParam) { List sqlResult = null; List result = null;