From 44d3d6810fed893fa96a48fa037ae9572777947e Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Tue, 6 Oct 2020 08:06:39 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31971 --- .../Maestro/ArchiveMetadataForm.Designer.cs | 347 +++++++++++------- client/Maestro/ArchiveMetadataForm.cs | 100 ++--- client/Maestro/ArchiveMetadataForm.resx | 2 +- client/Maestro/Commons/MXFMetadataReader.cs | 45 +++ .../Maestro/Configuration/configuration.json | 17 +- client/Maestro/Configuration/editor-mv.json | 2 +- client/Maestro/Form1.Designer.cs | 139 +++++++ client/Maestro/Form1.cs | 17 + client/Maestro/Form1.resx | 120 ++++++ client/Maestro/Maestro.csproj | 10 + client/Maestro/MaestroForm.Designer.cs | 112 +++--- client/Maestro/MaestroForm.Metadata.cs | 13 +- client/Maestro/MaestroForm.Source.cs | 103 ++++++ client/Maestro/MaestroForm.Target.cs | 35 +- client/Maestro/MaestroForm.resx | 8 +- client/Maestro/Sources/FileSystemSource.cs | 23 +- .../Configuration/ConfigurationInfo.cs | 3 +- .../MaestroShared/Metadata/ArchiveMetadata.cs | 1 + .../Targets/TargetProcessorParameter.cs | 3 + .../Targets/UNCTargetProcessor.cs | 41 ++- client/MediaCubeClient/MediaCubeApi.cs | 18 + .../Properties/AssemblyInfo.cs | 4 +- .../run-mediacube-server-user.launch | 2 +- server/-dependencies/jobengine.target | 3 +- server/-product/mediacube.product | 1 + .../mediacube/executors/tests/SmallTests.java | 71 ++++ .../executors/tests/SupportCheckItem.java | 4 +- .../config/config.xml | 2 +- .../server/steps/CancelableStep.java | 57 +-- .../src/user/jobengine/server/steps/Cmd.java | 78 ++++ .../user/jobengine/server/steps/FFMpeg.java | 136 +++++++ .../server/steps/FileValidatorStep.java | 6 +- .../server/steps/ForkUploadStep.java | 24 +- .../jobengine/server/steps/HLSProxyStep.java | 73 ++++ .../HarrisMissingMaterialCheckerStep.java | 2 +- .../server/steps/MetadataPersisterStep.java | 40 +- .../server/steps/NEXIO1TransferToStep.java | 37 +- .../server/steps/NEXIO2TransferToStep.java | 36 +- .../server/steps/NEXIOArchiveCheckerStep.java | 37 +- .../user/jobengine/server/steps/PBQuery.java | 8 +- .../server/steps/TestForkCancelableStep.java | 2 +- .../src/user/commons/mediatool/MediaInfo.java | 33 +- .../user/commons/remotestore/TSMLister.java | 7 +- .../commons/remotestore/TSMOutputStream.java | 3 +- .../user/jobengine/db/BreakDAO_SJProfile0.ser | Bin 3253 -> 3253 bytes .../db/DomainCategoryDAO_SJProfile0.ser | Bin 2552 -> 2552 bytes .../jobengine/db/DomainDAO_SJProfile0.ser | Bin 4043 -> 4043 bytes .../db/DomainIndexDAO_SJProfile0.ser | Bin 3143 -> 3143 bytes .../jobengine/db/EntityBaseDAO_SJProfile0.ser | Bin 2286 -> 2286 bytes .../jobengine/db/FileTypeDAO_SJProfile0.ser | Bin 3872 -> 3872 bytes .../jobengine/db/FolderDAO_SJProfile0.ser | Bin 2479 -> 2479 bytes .../jobengine/db/HelperDAO_SJProfile0.ser | Bin 1674 -> 1674 bytes .../user/jobengine/db/ItemDAO_SJProfile0.ser | Bin 4337 -> 4337 bytes .../jobengine/db/ItemTypeDAO_SJProfile0.ser | Bin 2933 -> 2933 bytes .../user/jobengine/db/JobDAO_SJProfile0.ser | Bin 5413 -> 5413 bytes .../db/JobParametersDAO_SJProfile0.ser | Bin 2355 -> 2355 bytes .../jobengine/db/MasterIdDAO_SJProfile0.ser | Bin 1655 -> 1655 bytes .../user/jobengine/db/MediaDAO_SJProfile0.ser | Bin 4847 -> 4847 bytes .../jobengine/db/MediaFileDAO_SJProfile0.ser | Bin 4725 -> 4725 bytes .../jobengine/db/MetadataDAO_SJProfile0.ser | Bin 6747 -> 6747 bytes .../db/MetadataElementDAO_SJProfile0.ser | Bin 2990 -> 2990 bytes .../db/MetadataTypeDAO_SJProfile0.ser | Bin 3013 -> 3013 bytes .../db/RemoteStoreDAO_SJProfile0.ser | Bin 3178 -> 3178 bytes .../db/SceneContentDAO_SJProfile0.ser | Bin 3376 -> 3376 bytes .../user/jobengine/db/SceneDAO_SJProfile0.ser | Bin 2973 -> 2973 bytes .../db/SearchDefinitionDAO_SJProfile0.ser | Bin 3528 -> 3528 bytes .../user/jobengine/db/ShotDAO_SJProfile0.ser | Bin 3487 -> 3487 bytes .../user/jobengine/db/StoreDAO_SJProfile0.ser | Bin 3164 -> 3164 bytes .../jobengine/db/StoreUriDAO_SJProfile0.ser | Bin 4756 -> 4756 bytes .../jobengine/db/UserInfoDAO_SJProfile0.ser | Bin 3637 -> 3637 bytes .../db/WorkflowActionDAO_SJProfile0.ser | Bin 4737 -> 4737 bytes .../scripts/017_add_filezize_mediafile.sql | 8 +- ....sql => 018_create_peablebeach_stores.sql} | 0 ...ore.sql => 019_create_filezilla_store.sql} | 0 ... => 020_add_lastmodified_to_mediafile.sql} | 8 +- ...item_sp.sql => 021_create_dropitem_sp.sql} | 0 ...d_to_job.sql => 022_create_tag_tables.sql} | 42 ++- ...l => 023_alter_mediafile_lastmodified.sql} | 13 +- .../src/user/jobengine/db/ArchivedMedia.java | 13 + .../src/user/jobengine/db/IItemManager.java | 21 +- .../src/user/jobengine/db/ItemManager.java | 128 ++++++- .../src/user/jobengine/db/SearchOptions.java | 153 ++++++-- .../user/jobengine/search/MediaFinder.java | 90 +---- .../js/searchitems.js | 74 ++-- .../pages/joblist.zul | 2 +- .../pages/searchitems.zul | 4 +- .../pages/searchitems/details.zul | 5 +- .../pages/searchitems/filters.zul | 10 +- .../pages/searchitems/results.zul | 6 +- .../src/user/jobengine/server/JobRuntime.java | 11 +- .../server/scheduler/SchedulerService.java | 2 +- .../user/jobengine/zk/model/JobListModel.java | 81 ++-- .../user/jobengine/zk/model/MenuModel.java | 7 +- .../user/jobengine/zk/model/SearchModel.java | 245 +++++++++++-- .../osgi/mediacube/MediaCubeService.java | 19 + .../src/user/tsm/client/TSMClient.java | 5 +- 96 files changed, 2110 insertions(+), 662 deletions(-) create mode 100644 client/Maestro/Commons/MXFMetadataReader.cs create mode 100644 client/Maestro/Form1.Designer.cs create mode 100644 client/Maestro/Form1.cs create mode 100644 client/Maestro/Form1.resx create mode 100644 server/user.jobengine.executors/src/user/jobengine/server/steps/Cmd.java create mode 100644 server/user.jobengine.executors/src/user/jobengine/server/steps/FFMpeg.java create mode 100644 server/user.jobengine.executors/src/user/jobengine/server/steps/HLSProxyStep.java rename server/user.jobengine.osgi.db/migrations/scripts/{020_create_peablebeach_stores.sql => 018_create_peablebeach_stores.sql} (100%) rename server/user.jobengine.osgi.db/migrations/scripts/{021_create_filezilla_store.sql => 019_create_filezilla_store.sql} (100%) rename server/user.jobengine.osgi.db/migrations/scripts/{022_add_lastmodified_to_mediafile.sql => 020_add_lastmodified_to_mediafile.sql} (88%) rename server/user.jobengine.osgi.db/migrations/scripts/{023_create_dropitem_sp.sql => 021_create_dropitem_sp.sql} (100%) rename server/user.jobengine.osgi.db/migrations/scripts/{018_add_related_to_job.sql => 022_create_tag_tables.sql} (53%) rename server/user.jobengine.osgi.db/migrations/scripts/{019_add_lookup_related.sql => 023_alter_mediafile_lastmodified.sql} (76%) diff --git a/client/Maestro/ArchiveMetadataForm.Designer.cs b/client/Maestro/ArchiveMetadataForm.Designer.cs index da8339bd..991a334d 100644 --- a/client/Maestro/ArchiveMetadataForm.Designer.cs +++ b/client/Maestro/ArchiveMetadataForm.Designer.cs @@ -26,9 +26,7 @@ this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.label_stuffID = new System.Windows.Forms.Label(); this.label_stuffDescription = new System.Windows.Forms.Label(); - this.label_mediaID = new System.Windows.Forms.Label(); this.label_mediaTitle = new System.Windows.Forms.Label(); - this.label_mediaDescription = new System.Windows.Forms.Label(); this.txtItemID = new System.Windows.Forms.TextBox(); this.txtItemTitle = new System.Windows.Forms.TextBox(); this.txtItemDescription = new System.Windows.Forms.TextBox(); @@ -39,22 +37,32 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.btnOk = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.btnMxfMetadata = new System.Windows.Forms.Button(); this.btnImportOctopus = new System.Windows.Forms.Button(); this.cbFolders = new System.Windows.Forms.ComboBox(); this.dtScheduled = new System.Windows.Forms.DateTimePicker(); - this.btnMxfMetadata = new System.Windows.Forms.Button(); + this.comboTags = new System.Windows.Forms.ComboBox(); + this.tcMediaDesc = new System.Windows.Forms.TabControl(); + this.tabMediaDesc = new System.Windows.Forms.TabPage(); + this.tabMediaImport = new System.Windows.Forms.TabPage(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label_mediaID = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.textTags = new System.Windows.Forms.TextBox(); + this.btnAddTag = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); + this.tcMediaDesc.SuspendLayout(); + this.tabMediaDesc.SuspendLayout(); + this.tabMediaImport.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // label_stuffID // - this.label_stuffID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_stuffID.AutoSize = true; - this.label_stuffID.Location = new System.Drawing.Point(11, 6); + this.label_stuffID.Location = new System.Drawing.Point(6, 6); this.label_stuffID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label_stuffID.Name = "label_stuffID"; this.label_stuffID.Size = new System.Drawing.Size(113, 17); @@ -63,117 +71,97 @@ // // label_stuffDescription // - this.label_stuffDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_stuffDescription.AutoSize = true; - this.label_stuffDescription.Location = new System.Drawing.Point(11, 102); + this.label_stuffDescription.Location = new System.Drawing.Point(33, 68); this.label_stuffDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label_stuffDescription.Name = "label_stuffDescription"; this.label_stuffDescription.Size = new System.Drawing.Size(86, 17); this.label_stuffDescription.TabIndex = 2; this.label_stuffDescription.Text = "Anyag leírás"; // - // label_mediaID - // - this.label_mediaID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label_mediaID.AutoSize = true; - this.label_mediaID.Location = new System.Drawing.Point(11, 192); - this.label_mediaID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label_mediaID.Name = "label_mediaID"; - this.label_mediaID.Size = new System.Drawing.Size(111, 17); - this.label_mediaID.TabIndex = 3; - this.label_mediaID.Text = "Média azonosító"; - // // label_mediaTitle // - this.label_mediaTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_mediaTitle.AutoSize = true; this.label_mediaTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.label_mediaTitle.Location = new System.Drawing.Point(11, 240); + this.label_mediaTitle.Location = new System.Drawing.Point(39, 174); this.label_mediaTitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label_mediaTitle.Name = "label_mediaTitle"; this.label_mediaTitle.Size = new System.Drawing.Size(80, 17); this.label_mediaTitle.TabIndex = 4; this.label_mediaTitle.Text = "Média cím"; // - // label_mediaDescription - // - this.label_mediaDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label_mediaDescription.AutoSize = true; - this.label_mediaDescription.Location = new System.Drawing.Point(11, 288); - this.label_mediaDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label_mediaDescription.Name = "label_mediaDescription"; - this.label_mediaDescription.Size = new System.Drawing.Size(84, 17); - this.label_mediaDescription.TabIndex = 5; - this.label_mediaDescription.Text = "Média leírás"; - // // txtItemID // - this.txtItemID.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtItemID.Location = new System.Drawing.Point(11, 27); + this.txtItemID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtItemID.Location = new System.Drawing.Point(127, 3); this.txtItemID.Margin = new System.Windows.Forms.Padding(4); this.txtItemID.Name = "txtItemID"; this.txtItemID.ReadOnly = true; - this.txtItemID.Size = new System.Drawing.Size(749, 23); + this.txtItemID.Size = new System.Drawing.Size(750, 23); this.txtItemID.TabIndex = 6; this.txtItemID.TabStop = false; // // txtItemTitle // - this.txtItemTitle.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtItemTitle.Location = new System.Drawing.Point(11, 75); + this.txtItemTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtItemTitle.Location = new System.Drawing.Point(127, 34); this.txtItemTitle.Margin = new System.Windows.Forms.Padding(4); this.txtItemTitle.Name = "txtItemTitle"; - this.txtItemTitle.Size = new System.Drawing.Size(749, 23); + this.txtItemTitle.Size = new System.Drawing.Size(750, 23); this.txtItemTitle.TabIndex = 1; // // txtItemDescription // - this.txtItemDescription.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtItemDescription.Location = new System.Drawing.Point(11, 123); + this.txtItemDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtItemDescription.Location = new System.Drawing.Point(127, 65); this.txtItemDescription.Margin = new System.Windows.Forms.Padding(4); this.txtItemDescription.Multiline = true; this.txtItemDescription.Name = "txtItemDescription"; this.txtItemDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtItemDescription.Size = new System.Drawing.Size(749, 65); + this.txtItemDescription.Size = new System.Drawing.Size(750, 65); this.txtItemDescription.TabIndex = 2; // // textBox_mediaID // - this.textBox_mediaID.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox_mediaID.Location = new System.Drawing.Point(11, 213); + this.textBox_mediaID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_mediaID.Location = new System.Drawing.Point(127, 138); this.textBox_mediaID.Margin = new System.Windows.Forms.Padding(4); this.textBox_mediaID.Name = "textBox_mediaID"; this.textBox_mediaID.ReadOnly = true; - this.textBox_mediaID.Size = new System.Drawing.Size(749, 23); + this.textBox_mediaID.Size = new System.Drawing.Size(750, 23); this.textBox_mediaID.TabIndex = 9; this.textBox_mediaID.TabStop = false; // // txtMediaTitle // - this.txtMediaTitle.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtMediaTitle.Location = new System.Drawing.Point(11, 261); + this.txtMediaTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtMediaTitle.Location = new System.Drawing.Point(127, 171); this.txtMediaTitle.Margin = new System.Windows.Forms.Padding(4); this.txtMediaTitle.Name = "txtMediaTitle"; - this.txtMediaTitle.Size = new System.Drawing.Size(749, 23); + this.txtMediaTitle.Size = new System.Drawing.Size(750, 23); this.txtMediaTitle.TabIndex = 3; // // txtMediaDescription // this.txtMediaDescription.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtMediaDescription.Location = new System.Drawing.Point(11, 351); + this.txtMediaDescription.Location = new System.Drawing.Point(3, 3); this.txtMediaDescription.Margin = new System.Windows.Forms.Padding(4); this.txtMediaDescription.Multiline = true; this.txtMediaDescription.Name = "txtMediaDescription"; this.txtMediaDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtMediaDescription.Size = new System.Drawing.Size(749, 186); + this.txtMediaDescription.Size = new System.Drawing.Size(851, 202); this.txtMediaDescription.TabIndex = 4; // // label_stuffTitle // - this.label_stuffTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label_stuffTitle.AutoSize = true; this.label_stuffTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.label_stuffTitle.Location = new System.Drawing.Point(11, 54); + this.label_stuffTitle.Location = new System.Drawing.Point(37, 37); this.label_stuffTitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label_stuffTitle.Name = "label_stuffTitle"; this.label_stuffTitle.Size = new System.Drawing.Size(82, 17); @@ -182,22 +170,21 @@ // // groupBox1 // - this.groupBox1.Controls.Add(this.btnMxfMetadata); this.groupBox1.Controls.Add(this.btnOk); this.groupBox1.Controls.Add(this.btnCancel); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.groupBox1.Location = new System.Drawing.Point(0, 547); + this.groupBox1.Location = new System.Drawing.Point(0, 498); this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(4); - this.groupBox1.Size = new System.Drawing.Size(771, 51); + this.groupBox1.Size = new System.Drawing.Size(889, 51); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // // btnOk // this.btnOk.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.btnOk.Location = new System.Drawing.Point(663, 16); + this.btnOk.Location = new System.Drawing.Point(781, 16); this.btnOk.Margin = new System.Windows.Forms.Padding(4); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(100, 28); @@ -210,7 +197,7 @@ // this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(557, 16); + this.btnCancel.Location = new System.Drawing.Point(675, 16); this.btnCancel.Margin = new System.Windows.Forms.Padding(4); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(100, 28); @@ -219,70 +206,24 @@ this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.OnCancelClick); // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.txtMediaDescription, 0, 12); - this.tableLayoutPanel1.Controls.Add(this.txtMediaTitle, 0, 9); - this.tableLayoutPanel1.Controls.Add(this.label_mediaTitle, 0, 8); - this.tableLayoutPanel1.Controls.Add(this.textBox_mediaID, 0, 7); - this.tableLayoutPanel1.Controls.Add(this.label_mediaID, 0, 6); - this.tableLayoutPanel1.Controls.Add(this.txtItemDescription, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.txtItemTitle, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.txtItemID, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.label_stuffID, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.label_mediaDescription, 0, 10); - this.tableLayoutPanel1.Controls.Add(this.label_stuffDescription, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.label_stuffTitle, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 11); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6); - this.tableLayoutPanel1.RowCount = 13; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(771, 547); - this.tableLayoutPanel1.TabIndex = 3; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.ColumnCount = 3; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.Controls.Add(this.btnImportOctopus, 2, 0); - this.tableLayoutPanel2.Controls.Add(this.cbFolders, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.dtScheduled, 0, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(10, 308); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(751, 36); - this.tableLayoutPanel2.TabIndex = 10; + // btnMxfMetadata + // + this.btnMxfMetadata.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.btnMxfMetadata.Location = new System.Drawing.Point(25, 20); + this.btnMxfMetadata.Margin = new System.Windows.Forms.Padding(4); + this.btnMxfMetadata.Name = "btnMxfMetadata"; + this.btnMxfMetadata.Size = new System.Drawing.Size(100, 26); + this.btnMxfMetadata.TabIndex = 7; + this.btnMxfMetadata.Text = "Import"; + this.btnMxfMetadata.UseVisualStyleBackColor = true; + this.btnMxfMetadata.Click += new System.EventHandler(this.OnImportMxfMetadataClick); // // btnImportOctopus // - this.btnImportOctopus.Anchor = System.Windows.Forms.AnchorStyles.None; - this.btnImportOctopus.Location = new System.Drawing.Point(647, 4); + this.btnImportOctopus.Location = new System.Drawing.Point(341, 20); this.btnImportOctopus.Margin = new System.Windows.Forms.Padding(4); this.btnImportOctopus.Name = "btnImportOctopus"; - this.btnImportOctopus.Size = new System.Drawing.Size(100, 28); + this.btnImportOctopus.Size = new System.Drawing.Size(100, 26); this.btnImportOctopus.TabIndex = 9; this.btnImportOctopus.Text = "Import"; this.btnImportOctopus.UseVisualStyleBackColor = true; @@ -290,49 +231,161 @@ // // cbFolders // - this.cbFolders.Dock = System.Windows.Forms.DockStyle.Fill; this.cbFolders.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbFolders.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.cbFolders.FormattingEnabled = true; - this.cbFolders.Location = new System.Drawing.Point(99, 6); + this.cbFolders.Location = new System.Drawing.Point(102, 22); this.cbFolders.Margin = new System.Windows.Forms.Padding(4, 6, 4, 4); this.cbFolders.Name = "cbFolders"; - this.cbFolders.Size = new System.Drawing.Size(540, 24); + this.cbFolders.Size = new System.Drawing.Size(231, 24); this.cbFolders.TabIndex = 8; // // dtScheduled // - this.dtScheduled.Anchor = System.Windows.Forms.AnchorStyles.None; this.dtScheduled.CustomFormat = " "; this.dtScheduled.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dtScheduled.Format = System.Windows.Forms.DateTimePickerFormat.Short; - this.dtScheduled.Location = new System.Drawing.Point(4, 6); + this.dtScheduled.Location = new System.Drawing.Point(7, 23); this.dtScheduled.Margin = new System.Windows.Forms.Padding(4); this.dtScheduled.Name = "dtScheduled"; this.dtScheduled.Size = new System.Drawing.Size(87, 23); this.dtScheduled.TabIndex = 7; this.dtScheduled.ValueChanged += new System.EventHandler(this.OnDateChanged); // - // btnMxfMetadata + // comboTags + // + this.comboTags.FormattingEnabled = true; + this.comboTags.Location = new System.Drawing.Point(127, 203); + this.comboTags.Name = "comboTags"; + this.comboTags.Size = new System.Drawing.Size(318, 24); + this.comboTags.TabIndex = 11; + // + // tcMediaDesc + // + this.tcMediaDesc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tcMediaDesc.Controls.Add(this.tabMediaDesc); + this.tcMediaDesc.Controls.Add(this.tabMediaImport); + this.tcMediaDesc.Location = new System.Drawing.Point(12, 270); + this.tcMediaDesc.Name = "tcMediaDesc"; + this.tcMediaDesc.SelectedIndex = 0; + this.tcMediaDesc.Size = new System.Drawing.Size(865, 237); + this.tcMediaDesc.TabIndex = 14; + // + // tabMediaDesc + // + this.tabMediaDesc.Controls.Add(this.txtMediaDescription); + this.tabMediaDesc.Location = new System.Drawing.Point(4, 25); + this.tabMediaDesc.Name = "tabMediaDesc"; + this.tabMediaDesc.Padding = new System.Windows.Forms.Padding(3); + this.tabMediaDesc.Size = new System.Drawing.Size(857, 208); + this.tabMediaDesc.TabIndex = 0; + this.tabMediaDesc.Text = "Média leírás"; + this.tabMediaDesc.UseVisualStyleBackColor = true; + // + // tabMediaImport + // + this.tabMediaImport.Controls.Add(this.groupBox3); + this.tabMediaImport.Controls.Add(this.groupBox2); + this.tabMediaImport.Location = new System.Drawing.Point(4, 25); + this.tabMediaImport.Name = "tabMediaImport"; + this.tabMediaImport.Padding = new System.Windows.Forms.Padding(3); + this.tabMediaImport.Size = new System.Drawing.Size(857, 208); + this.tabMediaImport.TabIndex = 1; + this.tabMediaImport.Text = "Média leírás beemelése"; + this.tabMediaImport.UseVisualStyleBackColor = true; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.btnMxfMetadata); + this.groupBox3.Location = new System.Drawing.Point(6, 6); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(151, 57); + this.groupBox3.TabIndex = 13; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "MXF Metadata"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.btnImportOctopus); + this.groupBox2.Controls.Add(this.dtScheduled); + this.groupBox2.Controls.Add(this.cbFolders); + this.groupBox2.Location = new System.Drawing.Point(163, 6); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(448, 57); + this.groupBox2.TabIndex = 12; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Octopus"; // - this.btnMxfMetadata.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.btnMxfMetadata.Location = new System.Drawing.Point(8, 15); - this.btnMxfMetadata.Margin = new System.Windows.Forms.Padding(4); - this.btnMxfMetadata.Name = "btnMxfMetadata"; - this.btnMxfMetadata.Size = new System.Drawing.Size(126, 28); - this.btnMxfMetadata.TabIndex = 7; - this.btnMxfMetadata.Text = "MXF Metadata"; - this.btnMxfMetadata.UseVisualStyleBackColor = true; - this.btnMxfMetadata.Click += new System.EventHandler(this.OnImportMxfMetadataClick); + // label_mediaID + // + this.label_mediaID.AutoSize = true; + this.label_mediaID.Location = new System.Drawing.Point(8, 141); + this.label_mediaID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_mediaID.Name = "label_mediaID"; + this.label_mediaID.Size = new System.Drawing.Size(111, 17); + this.label_mediaID.TabIndex = 3; + this.label_mediaID.Text = "Média azonosító"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(66, 206); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(53, 17); + this.label1.TabIndex = 15; + this.label1.Text = "Cimkék"; + // + // textTags + // + this.textTags.AcceptsReturn = true; + this.textTags.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textTags.Location = new System.Drawing.Point(451, 203); + this.textTags.Multiline = true; + this.textTags.Name = "textTags"; + this.textTags.ReadOnly = true; + this.textTags.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textTags.Size = new System.Drawing.Size(426, 86); + this.textTags.TabIndex = 16; + this.textTags.WordWrap = false; + // + // btnAddTag + // + this.btnAddTag.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.btnAddTag.Location = new System.Drawing.Point(345, 234); + this.btnAddTag.Margin = new System.Windows.Forms.Padding(4); + this.btnAddTag.Name = "btnAddTag"; + this.btnAddTag.Size = new System.Drawing.Size(100, 26); + this.btnAddTag.TabIndex = 17; + this.btnAddTag.Text = "Listára"; + this.btnAddTag.UseVisualStyleBackColor = true; + this.btnAddTag.Click += new System.EventHandler(this.btnAddTag_Click); // // ArchiveMetadataForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(771, 598); - this.Controls.Add(this.tableLayoutPanel1); + this.ClientSize = new System.Drawing.Size(889, 549); + this.Controls.Add(this.btnAddTag); + this.Controls.Add(this.textTags); + this.Controls.Add(this.label1); + this.Controls.Add(this.tcMediaDesc); + this.Controls.Add(this.comboTags); + this.Controls.Add(this.txtMediaTitle); this.Controls.Add(this.groupBox1); + this.Controls.Add(this.label_mediaTitle); + this.Controls.Add(this.label_stuffID); + this.Controls.Add(this.textBox_mediaID); + this.Controls.Add(this.label_stuffTitle); + this.Controls.Add(this.label_mediaID); + this.Controls.Add(this.txtItemID); + this.Controls.Add(this.txtItemDescription); + this.Controls.Add(this.txtItemTitle); + this.Controls.Add(this.label_stuffDescription); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.Icon = global::Maestro.Properties.Resources.AppIcon; this.Margin = new System.Windows.Forms.Padding(4); @@ -340,10 +393,14 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Archiv adatok"; this.groupBox1.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.tableLayoutPanel2.ResumeLayout(false); + this.tcMediaDesc.ResumeLayout(false); + this.tabMediaDesc.ResumeLayout(false); + this.tabMediaDesc.PerformLayout(); + this.tabMediaImport.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -352,9 +409,7 @@ private System.Windows.Forms.Label label_stuffTitle; private System.Windows.Forms.Label label_stuffID; private System.Windows.Forms.Label label_stuffDescription; - private System.Windows.Forms.Label label_mediaID; private System.Windows.Forms.Label label_mediaTitle; - private System.Windows.Forms.Label label_mediaDescription; private System.Windows.Forms.TextBox txtItemID; private System.Windows.Forms.TextBox txtItemTitle; private System.Windows.Forms.TextBox txtItemDescription; @@ -364,11 +419,19 @@ private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button btnOk; private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.ComboBox cbFolders; private System.Windows.Forms.DateTimePicker dtScheduled; private System.Windows.Forms.Button btnImportOctopus; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.Button btnMxfMetadata; + private System.Windows.Forms.ComboBox comboTags; + private System.Windows.Forms.TabControl tcMediaDesc; + private System.Windows.Forms.TabPage tabMediaDesc; + private System.Windows.Forms.TabPage tabMediaImport; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label_mediaID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textTags; + private System.Windows.Forms.Button btnAddTag; } } \ No newline at end of file diff --git a/client/Maestro/ArchiveMetadataForm.cs b/client/Maestro/ArchiveMetadataForm.cs index d8da45fc..04d2530a 100644 --- a/client/Maestro/ArchiveMetadataForm.cs +++ b/client/Maestro/ArchiveMetadataForm.cs @@ -11,16 +11,20 @@ using Maestro.Metadata; using Myriadbits.MXF; using System.Xml.Linq; using System.Diagnostics; +using MediaCubeClient; +using Maestro.Commons; namespace Maestro { public partial class ArchiveMetadataForm : Form { private ArchiveMetadata model; private readonly SourceInfo selectedSource; - private OctopusAPI client; + private OctopusAPI octopusAPI; + + public ArchiveMetadataForm(ref ArchiveMetadata model, OctopusAPI octopusAPI, MediaCubeApi mediaCubeApi, IMessageBus errorMessageBus, SourceInfo selectedSource) : this() { - public ArchiveMetadataForm(ref ArchiveMetadata model, OctopusMetadata metadata, IMessageBus errorMessageBus, SourceInfo selectedSource) : this() { this.model = model; + this.octopusAPI = octopusAPI; this.selectedSource = selectedSource; txtItemID.Text = model.itemHouseId; txtItemTitle.Text = model.itemTitle; @@ -28,22 +32,26 @@ namespace Maestro { textBox_mediaID.Text = model.mediaHouseId; txtMediaTitle.Text = model.mediaTitle; txtMediaDescription.Text = model.mediaDescription; - if (metadata == null) { - dtScheduled.Visible = false; - cbFolders.Visible = false; - btnImportOctopus.Visible = false; + if (octopusAPI == null) { + dtScheduled.Enabled = false; + cbFolders.Enabled = false; + btnImportOctopus.Enabled = false; + } + if (mediaCubeApi == null) { + comboTags.Enabled = false; + textTags.Enabled = false; } else { - client = new OctopusAPI(metadata.Server?.Address?.OriginalString, metadata.Server?.UserName, metadata.Server?.Password, metadata.Server?.Timeout ?? 0, errorMessageBus); - RefreshFolders(); + comboTags.Items.AddRange(mediaCubeApi.GetAllTags().ToArray()); } + btnMxfMetadata.Enabled = selectedSource?.FileInfo != null; } private void RefreshFolders() { Cursor.Current = Cursors.WaitCursor; - List rundownsResult = client.GetRundowns(dtScheduled.Value.Date)?.ToList(); + List rundownsResult = octopusAPI.GetRundowns(dtScheduled.Value.Date)?.ToList(); cbFolders.DataSource = rundownsResult; Cursor.Current = Cursors.Default; } @@ -63,6 +71,7 @@ namespace Maestro { model.mediaHouseId = textBox_mediaID.Text; model.mediaTitle = txtMediaTitle.Text; model.mediaDescription = txtMediaDescription.Text; + model.tags = textTags.Lines; DialogResult = DialogResult.OK; Close(); } @@ -73,50 +82,57 @@ namespace Maestro { } private void OnImportOctopusData(object sender, EventArgs e) { - if (!String.IsNullOrEmpty(txtMediaDescription.Text)) { - if (!MsgBox.YesNoQuestion("A média leírása nem üres és törlődni fog. Folytatja?")) + Cursor.Current = Cursors.WaitCursor; + try { + + if (!String.IsNullOrEmpty(txtMediaDescription.Text)) { + if (!MsgBox.YesNoQuestion("A média leírása nem üres és törlődni fog. Folytatja?")) + return; + } + + Rundown rundown = cbFolders.SelectedItem as Rundown; + if (rundown == null) return; - } + string text = octopusAPI.GetRundownContent(rundown.ID); + if (String.IsNullOrEmpty(text)) + MsgBox.Info("A tükör üres vagy nem található."); + else + txtMediaDescription.Text = text; + } catch { } + + + Cursor.Current = Cursors.Default; + tcMediaDesc.SelectedIndex = 0; - Rundown rundown = cbFolders.SelectedItem as Rundown; - if (rundown == null) - return; - string text = client.GetRundownContent(rundown.ID); - if (String.IsNullOrEmpty(text)) - MsgBox.Info("A tükör üres vagy nem található."); - else - txtMediaDescription.Text = text; } private void OnImportMxfMetadataClick(object sender, EventArgs e) { + Cursor.Current = Cursors.WaitCursor; try { - MXFFile mxf = new MXFFile(selectedSource.FileInfo.FullName); - string xml = mxf.GetMetadata(); - if (xml == null) { - MessageBox.Show("Nem található metaadat a fájlban."); - return; - } - - XElement root = XElement.Parse(xml); - string ns = root.GetDefaultNamespace()?.NamespaceName; - if (ns != null) - ns = "{" + ns + "}"; - - XElement xCreator = root.Elements(ns + "Creator").FirstOrDefault(); - if (xCreator != null) - txtItemTitle.Text = xCreator.Attribute("name").Value; - XElement xTitle = root.Elements(ns + "Title").FirstOrDefault(); - if (xTitle != null) - txtMediaTitle.Text = xTitle.Attribute("usAscii").Value; - XElement xDescription = root.Elements(ns + "Description").FirstOrDefault(); - if (xDescription != null) - txtMediaDescription.Text = xDescription.Value; - + ArchiveMetadata metadata = MXFMetadataReader.Read(selectedSource.FileInfo.FullName, false); + txtItemTitle.Text = metadata.itemTitle; + txtMediaTitle.Text = metadata.mediaTitle; + txtMediaDescription.Text = metadata.mediaDescription; } catch (Exception ex) { MessageBox.Show("Hiba! A rendszer üzenete: " + ex.Message); } + Cursor.Current = Cursors.Default; + tcMediaDesc.SelectedIndex = 0; + } + + private void btnAddTag_Click(object sender, EventArgs e) { + string tag = comboTags.Text; + if (string.IsNullOrWhiteSpace(comboTags.Text)) + return; + + if (textTags.Lines.Contains(tag)) + return; + List lines = textTags.Lines.ToList(); + lines.Add(tag); + textTags.Lines = lines.ToArray(); } } } +; \ No newline at end of file diff --git a/client/Maestro/ArchiveMetadataForm.resx b/client/Maestro/ArchiveMetadataForm.resx index ac1dbed9..ebea5d00 100644 --- a/client/Maestro/ArchiveMetadataForm.resx +++ b/client/Maestro/ArchiveMetadataForm.resx @@ -121,6 +121,6 @@ 17, 17 - 25 + 94 \ No newline at end of file diff --git a/client/Maestro/Commons/MXFMetadataReader.cs b/client/Maestro/Commons/MXFMetadataReader.cs new file mode 100644 index 00000000..88669feb --- /dev/null +++ b/client/Maestro/Commons/MXFMetadataReader.cs @@ -0,0 +1,45 @@ +using MaestroShared.Metadata; +using Myriadbits.MXF; +using System.Linq; +using System.Windows.Forms; +using System.Xml.Linq; + +namespace Maestro.Commons { + + class MXFMetadataReader { + static public ArchiveMetadata Read(string file, bool readLength) { + ArchiveMetadata result = new ArchiveMetadata(); + MXFFile mxf = new MXFFile(file); + + string xml = mxf.GetMetadata(); + if (xml == null) { + MessageBox.Show("Nem található metaadat a fájlban."); + } else { + XElement root = XElement.Parse(xml); + string ns = root.GetDefaultNamespace()?.NamespaceName; + if (ns != null) + ns = "{" + ns + "}"; + + XElement xCreator = root.Elements(ns + "Creator").FirstOrDefault(); + if (xCreator != null) + result.itemTitle = xCreator.Attribute("name").Value; + XElement xTitle = root.Elements(ns + "Title").FirstOrDefault(); + if (xTitle != null) + result.mediaTitle = xTitle.Attribute("usAscii").Value; + XElement xDescription = root.Elements(ns + "Description").FirstOrDefault(); + if (xDescription != null) + result.mediaDescription = xDescription.Value; + else + MessageBox.Show("A fájlban üres a média leírás."); + } + + if (result != null && readLength) { + mxf.Inspect(); + result.duration = (long)mxf.TimecodeComponent.Duration; + } + + return result; + } + + } +} diff --git a/client/Maestro/Configuration/configuration.json b/client/Maestro/Configuration/configuration.json index dca817fc..05e339a1 100644 --- a/client/Maestro/Configuration/configuration.json +++ b/client/Maestro/Configuration/configuration.json @@ -1,6 +1,6 @@ { "title": "Development", - "active": false, + "active": true, "startInTray": false, "enableCustomMetadataId": true, "filter": "avi", @@ -12,9 +12,10 @@ "source": { "$type": "UNCSource", "filter": "avi,wav,mxf,mts", - "useAlternateCopy": true, + "useAlternateCopy": true, + "autoTarget": "AUTOTARGET", "local": { - "address": "file://c:/_video", + "address": "file://f:/Clip", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 @@ -48,7 +49,7 @@ { "$type": "MediaCubeMetadata", "server": { - "address": "http://10.10.1.27:88/services/rest/jobengine", + "address": "http://localhost:8888/services/rest/jobengine", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 @@ -103,12 +104,12 @@ } }, { - "label": "UNC Teszt", + "label": "AUTOTARGET", "processor": "UNCTargetProcessor", - "outputFormat": "%ID%-%SOURCENAME%", + "outputFormat": "%SOURCENAME%", "tag": "Betöltés", - "killDateDays": 7, - "saveArchiveMetadata": false, + "killDateDays": 0, + "saveArchiveMetadata": true, "remote": { "address": "file://c:/opt1", "userName": "mediacube", diff --git a/client/Maestro/Configuration/editor-mv.json b/client/Maestro/Configuration/editor-mv.json index 7aeac7c3..0d9c2790 100644 --- a/client/Maestro/Configuration/editor-mv.json +++ b/client/Maestro/Configuration/editor-mv.json @@ -1,6 +1,6 @@ { "title": "Editor", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "player": { diff --git a/client/Maestro/Form1.Designer.cs b/client/Maestro/Form1.Designer.cs new file mode 100644 index 00000000..3f6ba02f --- /dev/null +++ b/client/Maestro/Form1.Designer.cs @@ -0,0 +1,139 @@ +namespace Maestro { + partial class Form1 { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(53, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(310, 20); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 1; + this.label1.Text = "label1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 35); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.TabIndex = 3; + this.label2.Text = "label2"; + // + // textBox2 + // + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox2.Location = new System.Drawing.Point(53, 32); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(310, 20); + this.textBox2.TabIndex = 2; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 61); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(35, 13); + this.label3.TabIndex = 5; + this.label3.Text = "label3"; + // + // textBox3 + // + this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox3.Location = new System.Drawing.Point(53, 58); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(310, 20); + this.textBox3.TabIndex = 4; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(12, 87); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(35, 13); + this.label4.TabIndex = 7; + this.label4.Text = "label4"; + // + // textBox4 + // + this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox4.Location = new System.Drawing.Point(53, 84); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(310, 20); + this.textBox4.TabIndex = 6; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(775, 357); + this.Controls.Add(this.label4); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.label3); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBox4; + } +} \ No newline at end of file diff --git a/client/Maestro/Form1.cs b/client/Maestro/Form1.cs new file mode 100644 index 00000000..7be79507 --- /dev/null +++ b/client/Maestro/Form1.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Maestro { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + } +} diff --git a/client/Maestro/Form1.resx b/client/Maestro/Form1.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/client/Maestro/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/client/Maestro/Maestro.csproj b/client/Maestro/Maestro.csproj index 758236f3..34febc2a 100644 --- a/client/Maestro/Maestro.csproj +++ b/client/Maestro/Maestro.csproj @@ -192,8 +192,15 @@ ArchiveMetadataForm.cs + + + Form + + + Form1.cs + Form @@ -255,6 +262,9 @@ ArchiveMetadataForm.cs + + Form1.cs + LoginForm.cs diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index 536a5b2a..0cb4c14c 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -26,17 +26,17 @@ namespace Maestro { /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MaestroForm)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupSource = new System.Windows.Forms.GroupBox(); this.dgSource = new System.Windows.Forms.DataGridView(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); @@ -190,32 +190,32 @@ namespace Maestro { this.dgSource.BackgroundColor = System.Drawing.Color.White; this.dgSource.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgSource.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; - dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle31.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle31.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle31.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle31.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle31.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle31; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dgSource.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgSource.DataSource = this.bindingSource; - dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle32.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle32.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle32.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgSource.DefaultCellStyle = dataGridViewCellStyle32; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgSource.DefaultCellStyle = dataGridViewCellStyle2; this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill; this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgSource.EnableHeadersVisualStyles = false; this.dgSource.Location = new System.Drawing.Point(10, 47); this.dgSource.Name = "dgSource"; this.dgSource.RowHeadersVisible = false; - dataGridViewCellStyle33.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle33; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle3; this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgSource.Size = new System.Drawing.Size(330, 163); @@ -794,15 +794,15 @@ namespace Maestro { this.columnKillDate, this.columnMessage}); this.dgJobs.DataSource = this.bindingSourceJobs; - dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle36.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle36.NullValue = null; - dataGridViewCellStyle36.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle36.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgJobs.DefaultCellStyle = dataGridViewCellStyle36; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.NullValue = null; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgJobs.DefaultCellStyle = dataGridViewCellStyle6; this.dgJobs.Dock = System.Windows.Forms.DockStyle.Fill; this.dgJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgJobs.EnableHeadersVisualStyles = false; @@ -810,8 +810,8 @@ namespace Maestro { this.dgJobs.Location = new System.Drawing.Point(3, 3); this.dgJobs.Name = "dgJobs"; this.dgJobs.RowHeadersVisible = false; - dataGridViewCellStyle37.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle37; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle7; this.dgJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgJobs.Size = new System.Drawing.Size(988, 96); @@ -848,8 +848,8 @@ namespace Maestro { // columnID // this.columnID.DataPropertyName = "ID"; - dataGridViewCellStyle34.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.columnID.DefaultCellStyle = dataGridViewCellStyle34; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.columnID.DefaultCellStyle = dataGridViewCellStyle4; this.columnID.HeaderText = "ID"; this.columnID.Name = "columnID"; this.columnID.Width = 44; @@ -857,8 +857,8 @@ namespace Maestro { // columnStatus // this.columnStatus.DataPropertyName = "Status"; - dataGridViewCellStyle35.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.columnStatus.DefaultCellStyle = dataGridViewCellStyle35; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.columnStatus.DefaultCellStyle = dataGridViewCellStyle5; this.columnStatus.HeaderText = "Status"; this.columnStatus.Name = "columnStatus"; this.columnStatus.Width = 66; @@ -928,15 +928,15 @@ namespace Maestro { this.dgMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.columnMessagesTime, this.columnMessagesMessage}); - dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle39.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle39.ForeColor = System.Drawing.Color.Red; - dataGridViewCellStyle39.NullValue = null; - dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle39.SelectionForeColor = System.Drawing.Color.Red; - dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgMessages.DefaultCellStyle = dataGridViewCellStyle39; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Red; + dataGridViewCellStyle9.NullValue = null; + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Red; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgMessages.DefaultCellStyle = dataGridViewCellStyle9; this.dgMessages.Dock = System.Windows.Forms.DockStyle.Fill; this.dgMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgMessages.EnableHeadersVisualStyles = false; @@ -945,8 +945,8 @@ namespace Maestro { this.dgMessages.Name = "dgMessages"; this.dgMessages.ReadOnly = true; this.dgMessages.RowHeadersVisible = false; - dataGridViewCellStyle40.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle40; + dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle10; this.dgMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgMessages.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgMessages.Size = new System.Drawing.Size(988, 96); @@ -965,8 +965,8 @@ namespace Maestro { // this.columnMessagesMessage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.columnMessagesMessage.DataPropertyName = "Message"; - dataGridViewCellStyle38.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.columnMessagesMessage.DefaultCellStyle = dataGridViewCellStyle38; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.columnMessagesMessage.DefaultCellStyle = dataGridViewCellStyle8; this.columnMessagesMessage.HeaderText = "Üzenet"; this.columnMessagesMessage.Name = "columnMessagesMessage"; this.columnMessagesMessage.ReadOnly = true; diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 181497a6..beb0f13a 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -100,8 +100,11 @@ namespace Maestro { if (metadata == null || metadata.Disabled) return; mediaCubeApi = new MediaCubeApi(metadata.Server.Address.ToString(), metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout, errorMessageBus); + //List list = mediaCubeApi.GetAllTags(); + } + private void OnEditMetadata(object sender, EventArgs e) { if (ArchiveMetadata == null) ArchiveMetadata = GetArchiveMetadata(); @@ -113,8 +116,9 @@ namespace Maestro { return; } - OctopusMetadata metadata = MetadataProvider.Get(Configuration.Metadatas); - ArchiveMetadataForm form = new ArchiveMetadataForm(ref archiveMetadata, metadata, errorMessageBus, SelectedSource); + OctopusAPI octopusAPI = octopusIDSelector?.GetClient(); + + ArchiveMetadataForm form = new ArchiveMetadataForm(ref archiveMetadata, octopusAPI, mediaCubeApi, errorMessageBus, SelectedSource); form.BackColor = partialColor; DialogResult result = form.ShowDialog(); @@ -244,7 +248,10 @@ namespace Maestro { //MetadataType metadataType = MetadataTypeUtil.Guess(textSelectedMetadata.Text); - MetadataType metadataType = SelectedMetadata.Kind; + MetadataType metadataType = MetadataType.MediaCube; + + if (SelectedMetadata != null) + metadataType = SelectedMetadata.Kind; switch (metadataType) { case MetadataType.None: diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 32513b5b..2815a8b4 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -1,16 +1,22 @@ using DxPlay; +using Maestro.Commons; using Maestro.Metadata; using Maestro.Sources; +using MaestroShared.Commons; using MaestroShared.Configuration; using MaestroShared.Metadata; using MaestroShared.Resources; +using MaestroShared.Target; +using MaestroShared.Targets; using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; +using System.Threading; using System.Windows.Forms; +using System.Xml; namespace Maestro { @@ -63,6 +69,7 @@ namespace Maestro { btnShowFolders.Enabled = true; logger.Debug("UNC source initialization"); source = new FileSystemSource(this, MessageBus, Configuration.Player.Enabled, Configuration.Source.Filter); + ((FileSystemSource)source).OnListReadCompleted += MaestroForm_OnListReadCompleted; logger.Debug("UNC source created"); } if (Configuration?.Source is NEXIOSource) { @@ -80,6 +87,102 @@ namespace Maestro { treeFolders.NodeDoubleClick += OnDoubleClickFolder; } + private void MaestroForm_OnListReadCompleted(string[] files) { + //nem UNC forras + if (!(Configuration?.Source is UNCSource)) + return; + + //nincs beallitva autotarget + UNCSource source = Configuration?.Source as UNCSource; + if (string.IsNullOrWhiteSpace(source.AutoTarget)) + return; + if (files == null || files.Count() == 0) { + logger.Info("Source is empty, skipping auto process"); + return; + } + + //nincs autotarget + var target = Configuration?.Targets?.FirstOrDefault(t => source.AutoTarget.Equals(t.Label)); + if (target == null) { + logger.Error($"Auto target {source.AutoTarget} is not available"); + return; + } + + //nincs discmeta.xml + string discMeta = Path.Combine(source.Local.Address.AbsolutePath.Replace("Clip", ""), "discmeta.xml"); + FileInfo discFileInfo = new FileInfo(discMeta); + if (!discFileInfo.Exists) { + logger.Info("discmeta.xml not exists, skipping auto process"); + return; + } + + + + XmlDocument doc = new XmlDocument(); + doc.Load(discMeta); + + string itemHouseId = null; + try { + XmlNode node = doc.DocumentElement.GetElementsByTagName("UserDiscId")[0]; + itemHouseId = node.Attributes["value"].Value; + } catch { + logger.Info("discmeta.xml doesn't contains UserDiscId, skipping auto process"); + return; + } + + + if (MsgBox.YesNoQuestion("Új betöltendő tartalmat deketáltam. Indulhat az automatikus betöltés?")) + BeginInvoke(new Action(() => AutoProcess(files, target, itemHouseId))); + + } + + private void AutoProcess(string[] files, Target target, string itemHouseId) { + + long count = files.Count() / 2; + logger.Info($"Auto processing {count} items"); + + //List allFiles = new List(); + foreach (string file in files) { + if (!file.ToUpper().EndsWith(".MXF")) + continue; + + var sourceItem = new FileSourceItem() { + FileInfo = new FileInfo(file) + }; + + logger.Info($"Reading metadata from {file}"); + + string proxy = file.Replace("\\Clip\\", "\\Sub\\"); + proxy = proxy.Substring(0, proxy.LastIndexOf(".")) + "S01" + proxy.Substring(proxy.LastIndexOf(".")); + + FileInfo proxyFi = new FileInfo(proxy); + if (!proxyFi.Exists) { + logger.Info($"Proxy {proxy} not exists, skipping {file}"); + continue; + } + + TargetProcessorParameter processorParameter = null; + try { + //mxf metadata + duration + ArchiveMetadata metadata = MXFMetadataReader.Read(file, true); + metadata.itemHouseId = itemHouseId; + metadata.mediaHouseId = metadata.mediaTitle; + metadata.mediaTitle = sourceItem.FileInfo.Name; + processorParameter = CreateProcessorParameter(target, sourceItem, metadata, DateTime.Now, null); + processorParameter.ProxyPath = proxy; + } catch (Exception e) { + logger.Error(e.Message); + break; + } + + ITargetProcessor p = TargetProcessor.Create(target.Processor); + p.Initialize(this, processorParameter); + ProcessJob(p); + Application.DoEvents(); + } + logger.Info("Auto processing source completed"); + } + private void Source_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { UpdateSelectionCounts(); } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 94ee4cdd..22eda654 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -124,7 +124,7 @@ namespace Maestro { TargetProcessorParameter processorParameter = null; try { - processorParameter = CreateProcessorParameter(target, sourceItem, createDate, partReplace); + processorParameter = CreateProcessorParameter(target, sourceItem, ArchiveMetadata, createDate, partReplace); } catch (Exception e) { result = null; break; @@ -224,7 +224,7 @@ namespace Maestro { return true; } - private TargetProcessorParameter CreateProcessorParameter(Target target, ISourceItem sourceItem, DateTime createDate, string partReplace) { + private TargetProcessorParameter CreateProcessorParameter(Target target, ISourceItem sourceItem, ArchiveMetadata metadata, DateTime createDate, string partReplace) { FileSystemSource source = bindingSource.DataSource as FileSystemSource; TargetProcessorParameter result = new TargetProcessorParameter(); @@ -251,11 +251,19 @@ namespace Maestro { result.TargetOrder = Configuration.Targets.ToList().IndexOf(target); result.SelectedSegments = SelectedMetadata?.Selected; result.PartReplace = partReplace; - if (ArchiveMetadata != null) { - result.ArchiveMetadata = ArchiveMetadata.DeepClone(ArchiveMetadata); - result.ArchiveMetadata.duration = sourceItem.Frames; + if (metadata != null) { + result.ArchiveMetadata = ArchiveMetadata.DeepClone(metadata); + + //ket uton is johet a hossz + if (metadata.duration > 0) + result.Frames = metadata.duration; + else + if (sourceItem.Frames > 0) + result.ArchiveMetadata.duration = sourceItem.Frames; + + result.ArchiveMetadata.userName = result.UserName; - if (SelectedMetadata.Kind == MetadataType.MediaCube) { + if (SelectedMetadata?.Kind == MetadataType.MediaCube) { result.ArchiveMetadata.itemHouseId = PatternNameMaker.Get(result.ArchiveMetadata.itemHouseId, result.ID, null, result.InputFileName, null, null, result.MetadataText, null); result.ArchiveMetadata.itemTitle = PatternNameMaker.Get(result.ArchiveMetadata.itemTitle, result.ID, null, result.InputFileName, null, null, result.MetadataText, null); result.ArchiveMetadata.mediaHouseId = PatternNameMaker.Get(result.ArchiveMetadata.mediaHouseId, result.ID, null, result.InputFileName, null, null, result.MetadataText, null); @@ -352,20 +360,23 @@ namespace Maestro { .ThenByDescending(p => p.Parameters.TargetConfig.NexioServer) .ThenBy(p => p.Parameters.TargetOrder) .ToList() - .ForEach(p => { - jobs.Add(p); - jobsQueue.Enqueue(p); - }); + .ForEach(p => ProcessJob(p) ); UpdateJobCounts(); ClearSelectedProcessors(); - if (processorWorkers == null) - CreateJobsQueueWorkers(); ActivateTab(0); SelectedSource = null; ClearSelectedMetadata(); } + private void ProcessJob(ITargetProcessor p) { + jobs.Add(p); + jobsQueue.Enqueue(p); + //az elso job eseten indul el a feldolgozo szal + if (processorWorkers == null) + CreateJobsQueueWorkers(); + } + } } diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index a37bd163..5ec29ae8 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAS - CAAAAk1TRnQBSQFMAgEBAgEAAcABAgHAAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAcgBAgHIAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -177,15 +177,9 @@ 951, 17 - - 951, 17 - 846, 17 - - 1146, 17 - True diff --git a/client/Maestro/Sources/FileSystemSource.cs b/client/Maestro/Sources/FileSystemSource.cs index 193e7ee5..fb37c7d7 100644 --- a/client/Maestro/Sources/FileSystemSource.cs +++ b/client/Maestro/Sources/FileSystemSource.cs @@ -11,9 +11,11 @@ using System.Linq; using System.Windows.Forms; namespace Maestro.Sources { - public delegate void ClearAndInitialize(); class FileSystemSource : BindingList, ISource, IBindingListView { + public delegate void ListReadCompletedHandler(string[] files); + public event ListReadCompletedHandler OnListReadCompleted; + private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private IMessageBus messageBus; private List createdFileMonitors = new List(); @@ -236,26 +238,13 @@ namespace Maestro.Sources { try { fileSourceItems.Where(x => x.CanHandle(acceptableExtensions)).ToList().ForEach(i => parent.SafeCall(() => Add(i))); logger.Trace("Added async list"); - //IAsyncResult invokeResult = parent.SafeCall(() => - // fileSourceItems.Where(x => x.CanHandle(acceptableExtensions)).ToList().ForEach(i => Add(i)) - //); - //BackgroundWorker bg = new BackgroundWorker(); - //bg.WorkerSupportsCancellation = true; - //bg.DoWork += (s, e) => { - // Color origColor = parent.BackColor; - // Color hlColor = MaestroColors.Yellow200; - // while (!invokeResult.IsCompleted) { - // parent.BackColor = parent.BackColor == hlColor ? origColor : hlColor; - // Thread.Sleep(1000); - // } - // logger.Trace("Added list"); - //}; - //bg.RunWorkerAsync(); - } catch (Exception e) { logger.Error(e); Shutdown(); } + + OnListReadCompleted?.Invoke(files); + logger.Trace("Exit"); } diff --git a/client/MaestroShared/Configuration/ConfigurationInfo.cs b/client/MaestroShared/Configuration/ConfigurationInfo.cs index b91e1357..3cf7a364 100644 --- a/client/MaestroShared/Configuration/ConfigurationInfo.cs +++ b/client/MaestroShared/Configuration/ConfigurationInfo.cs @@ -142,7 +142,8 @@ namespace MaestroShared.Configuration { public class Source { public Connection Local { get; set; } public Connection Remote { get; set; } - public String Filter { get; set; } + public string Filter { get; set; } + public string AutoTarget { get; set; } } public class UNCSource : Source { diff --git a/client/MaestroShared/Metadata/ArchiveMetadata.cs b/client/MaestroShared/Metadata/ArchiveMetadata.cs index b5a5d78b..cd4fc558 100644 --- a/client/MaestroShared/Metadata/ArchiveMetadata.cs +++ b/client/MaestroShared/Metadata/ArchiveMetadata.cs @@ -22,6 +22,7 @@ namespace MaestroShared.Metadata { public string userName { get; set; } public string mediaType { get; set; } public long duration { get; set; } + public string[] tags { get; set; } public override string ToString() { return JsonConvert.SerializeObject(this, Formatting.Indented); diff --git a/client/MaestroShared/Targets/TargetProcessorParameter.cs b/client/MaestroShared/Targets/TargetProcessorParameter.cs index 196b31c0..cf09d0a7 100644 --- a/client/MaestroShared/Targets/TargetProcessorParameter.cs +++ b/client/MaestroShared/Targets/TargetProcessorParameter.cs @@ -29,5 +29,8 @@ namespace MaestroShared.Target { public long Frames { get; set; } public int TargetOrder { get; set; } public TrafficMetadata TrafficMetadata { get; set; } + + public string ProxyPath; + } } diff --git a/client/MaestroShared/Targets/UNCTargetProcessor.cs b/client/MaestroShared/Targets/UNCTargetProcessor.cs index a0e170d8..4e866041 100644 --- a/client/MaestroShared/Targets/UNCTargetProcessor.cs +++ b/client/MaestroShared/Targets/UNCTargetProcessor.cs @@ -114,6 +114,12 @@ namespace MaestroShared.Targets { //logger.Info("Spend (s):" + (DateTime.Now - started).TotalSeconds); if (Parameters.TargetConfig.DeleteAfterCopy || Parameters.TargetConfig.MoveToFolder) DeleteAfterCopy(); + + //automatikus betoltes, letezo proxyval + if (!string.IsNullOrWhiteSpace(Parameters.SourceConfig.AutoTarget) && !string.IsNullOrWhiteSpace(Parameters.ProxyPath)) { + UploadProxy(); + } + ExecuteCompleted(); Status = READY; @@ -436,9 +442,9 @@ namespace MaestroShared.Targets { bool copyResult = false; if (Parameters.SourceConfig is UNCSource && ((UNCSource)Parameters.SourceConfig).UseAlternateCopy) - copyResult = doAlternateCopy(targetFilePath); + copyResult = doAlternateCopy(Input, targetFilePath); else - copyResult = doCopy(ref pbCancel, targetFilePath); + copyResult = doCopy(ref pbCancel, Input, targetFilePath); if (copyResult && Parameters.TargetConfig.TemporaryCopy) { @@ -446,12 +452,37 @@ namespace MaestroShared.Targets { } } - private bool doCopy(ref int pbCancel, string targetFilePath) { + protected virtual void UploadProxy() { + int pbCancel = 0; + string outputPath = Path.GetDirectoryName(Output); + string outputFile = Path.GetFileName(Parameters.ProxyPath); + + string targetFilePath = Path.Combine(outputPath, STATUS_FOLDER, outputFile); + EnsureDirectoryExistence(Path.GetDirectoryName(targetFilePath)); + + string tmpPath = targetFilePath; + if (Parameters.TargetConfig.TemporaryCopy) + tmpPath = targetFilePath + ".tmp"; + + bool copyResult = false; + + if (Parameters.SourceConfig is UNCSource && ((UNCSource)Parameters.SourceConfig).UseAlternateCopy) + copyResult = doAlternateCopy(Parameters.ProxyPath, tmpPath); + else + copyResult = doCopy(ref pbCancel, Parameters.ProxyPath, tmpPath); + + + if (copyResult && Parameters.TargetConfig.TemporaryCopy) { + File.Move(tmpPath, targetFilePath); + } + } + + private bool doCopy(ref int pbCancel, string sourceFilePath, string targetFilePath) { return Win32File.CopyFileEx(Input, targetFilePath, new CopyProgressRoutine(this.CopyProgressHandler), IntPtr.Zero, ref pbCancel, CopyFileFlags.COPY_FILE_RESTARTABLE); } - private bool doAlternateCopy(string targetFilePath) { - CustomFileCopier copier = new CustomFileCopier(Input, targetFilePath); + private bool doAlternateCopy(string sourceFilePath, string targetFilePath) { + CustomFileCopier copier = new CustomFileCopier(sourceFilePath, targetFilePath); copier.OnProgressChanged += Copier_OnProgressChanged; copier.Copy(); Boolean result = true; diff --git a/client/MediaCubeClient/MediaCubeApi.cs b/client/MediaCubeClient/MediaCubeApi.cs index fdcc5472..05e85123 100644 --- a/client/MediaCubeClient/MediaCubeApi.cs +++ b/client/MediaCubeClient/MediaCubeApi.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json.Linq; using NLog; using RestSharp; using RestSharp.Authenticators; +using System.Collections.Generic; using System.Diagnostics; using System.Net; @@ -78,6 +79,23 @@ namespace MediaCubeClient { return null; } + public List GetAllTags() { + var request = new RestRequest("tags", Method.GET); + var response = client.Execute(request); + if (response.StatusCode != HttpStatusCode.OK && + !response.ErrorMessage.IsEmpty()) { + messageBus.Send(new MediaCubeMessage("Hiba a lekérdezésben. A rendszer üzenete: " + response.ErrorMessage)); + return null; + } + + if (!response.Content.IsEmpty() && response.Content != "[]") { + JArray media = JArray.Parse(response.Content); + if (media != null) + return media.Deserialize>(); + } + return null; + } + public void Item() { var request = new RestRequest("item", Method.GET); var response = client.Execute(request); diff --git a/client/MediaCubeClient/Properties/AssemblyInfo.cs b/client/MediaCubeClient/Properties/AssemblyInfo.cs index b2ced48e..402a3d9a 100644 --- a/client/MediaCubeClient/Properties/AssemblyInfo.cs +++ b/client/MediaCubeClient/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.2")] -[assembly: AssemblyFileVersion("1.0.0.2")] +[assembly: AssemblyVersion("1.0.0.3")] +[assembly: AssemblyFileVersion("1.0.0.3")] diff --git a/server/-configuration/run-mediacube-server-user.launch b/server/-configuration/run-mediacube-server-user.launch index 283e43d3..878becd6 100644 --- a/server/-configuration/run-mediacube-server-user.launch +++ b/server/-configuration/run-mediacube-server-user.launch @@ -19,7 +19,7 @@ - + diff --git a/server/-dependencies/jobengine.target b/server/-dependencies/jobengine.target index 78bd1266..7974a10f 100644 --- a/server/-dependencies/jobengine.target +++ b/server/-dependencies/jobengine.target @@ -1,5 +1,5 @@ - + @@ -21,6 +21,7 @@ + diff --git a/server/-product/mediacube.product b/server/-product/mediacube.product index 992a0bf5..4d01c51b 100644 --- a/server/-product/mediacube.product +++ b/server/-product/mediacube.product @@ -108,6 +108,7 @@ + diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java index 4a5fbbd0..bb4be753 100644 --- a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java @@ -5,6 +5,13 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.sql.Timestamp; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -24,6 +31,7 @@ import org.junit.Test; import user.jobengine.db.Media; import user.jobengine.server.steps.EscortFiles; +import user.jobengine.server.steps.FFMpeg; import user.jobengine.server.steps.TSMExtendedRetrieveStep; public class SmallTests { @@ -420,4 +428,67 @@ public class SmallTests { Files.write(Paths.get("/opt/sql.txt"), out); } + + //ffmpeg hls + @Test + public void test99() throws Exception { + System.setProperty("jobengine.ffmpeg.location", "/Programs/ffmpeg/bin/ffmpeg.exe"); + System.setProperty("java.library.path", System.getProperty("java.library.path") + ";/_workspace/USER/MediaCube/server/-dependencies/libs"); + Path input = Paths.get("/_XDCAM/Sub/0410_1006_DEMO_mariagyud_mixS01.MXF"); + Path output = Paths.get("/_XDCAM/out"); + + FFMpeg.hls_audio4ch(input.toAbsolutePath().toString(), output.toAbsolutePath().toString(), p -> { + System.out.println(p + "%"); + }); + } + + //mc tsm tartalom osszehasonlitas + @Test + public void test990() throws Exception { + List missing = new ArrayList<>(); + + //pasatol/lekerdezes + List mcL = Files.readAllLines(Paths.get("/opt/AMC/mc.txt")); + // + List tsmL = Files.readAllLines(Paths.get("/opt/AMC/tsm.txt")); + int count = 0; + for (String mc : mcL) { + if (!tsmL.contains(mc)) { + missing.add(mc); + System.out.println(mc); + count++; + } + } + System.out.println(count); + + Files.write(Paths.get("/opt/AMC/missing.txt"), missing); + } + + //tsm-missing pasa tartalom osszehasonlitas + @Test + public void test991() throws Exception { + List mcmissing = new ArrayList<>(); + List missingL = Files.readAllLines(Paths.get("/opt/AMC/missing.txt")); + List pasaL = Files.readAllLines(Paths.get("/opt/AMC/pasa.txt")); + for (String missing : missingL) { + if (pasaL.contains(missing)) + System.out.println("PASA: " + missing); + else { + System.out.println("MC: " + missing); + mcmissing.add(missing); + } + } + Files.write(Paths.get("/opt/AMC/mcmissing.txt"), mcmissing); + } + + //nexio modification change + @Test + public void test992() throws Exception { + Timestamp nexio = Timestamp.from(Instant.now().minus(2, ChronoUnit.HOURS)); + LocalDateTime ldt = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.systemDefault()); + LocalDateTime ldn = LocalDateTime.ofInstant(Instant.now().minus(2, ChronoUnit.HOURS), ZoneOffset.systemDefault()); + long modifiedHours = Duration.between(ldt, ldn).toHours(); + System.out.println(modifiedHours); + System.out.println(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(ldt)); + } } diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SupportCheckItem.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SupportCheckItem.java index 08492587..b15d1ef0 100644 --- a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SupportCheckItem.java +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SupportCheckItem.java @@ -180,10 +180,10 @@ public class SupportCheckItem { private void updateMediaDescription(long itemId, long mediaId, long mediaFileId) { // TODO Auto-generated method stub - manager.executeUpdate(String.format("delete from MEDIADESCRIPTION where ITEMID=%d and MEDIAID=%d", itemId, mediaId), null); + manager.executeUpdate(String.format("delete from MEDIADESCRIPTION where ITEMID=%d and MEDIAID=%d", itemId, mediaId), null, null); String sql = String.format("insert into mediadescription (itemid, mediaid, mediafileid, description) " + "select itemid, mediaid, mediafileid, fulldesc(itemid, mediaid, mediafileid) from vw_items " + "where mediafileid=%d", mediaFileId); - manager.executeUpdate(sql, null); + manager.executeUpdate(sql, null, null); } diff --git a/server/user.jobengine.executors/config/config.xml b/server/user.jobengine.executors/config/config.xml index 1e5abe19..49d708c0 100644 --- a/server/user.jobengine.executors/config/config.xml +++ b/server/user.jobengine.executors/config/config.xml @@ -2,7 +2,7 @@ - + diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java index dae68860..ea5d7bb9 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java @@ -1,56 +1,57 @@ package user.jobengine.server.steps; +import org.apache.commons.net.ftp.FTPClient; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.fasterxml.jackson.databind.ObjectMapper; - -import user.commons.rest.ServiceObjectMapper; +import user.commons.StoreUri; +import user.commons.remotestore.FtpDirectoryLister; +import user.commons.remotestore.RemoteStoreProtocol; public class CancelableStep extends JobStep { private static final Logger logger = LogManager.getLogger(); int count = 10; - private ObjectMapper mapper = ServiceObjectMapper.getMapper(); @StepEntry public Object[] execute(int param) throws Exception { - - // DownloadableArchive a = new DownloadableArchive(); - // Media media = getManager().createMedia("Generic", "Name", "description", "houseId"); - // a.setMedia(media); - // - // String m1 = mapper.writeValueAsString(media); - // Media m2 = mapper.readValue(m1, Media.class); - // - // String prettyString = mapper.writeValueAsString(a); - // DownloadableArchive b = mapper.readValue(prettyString, DownloadableArchive.class); - // Media media2 = b.getMedia(); - - // getJobRuntime().setDescription(String.valueOf(param)); - try { - //logger.info(new MediaCubeMarker("vasary@elgekko.net", "TESZT"), "Heloka"); - logger.error(getSessionMarker(), "Heloka"); + // ftpTest(); + for (int i = 0; i < count; i++) { if (getJobRuntime().isWaitingCancel()) break; Thread.sleep(500); int progress = (i + 1) * 100 / count; setProgress(progress); - // if (i == 5) - // throw new Exception("Test"); } } catch (Exception e) { e.printStackTrace(); throw e; } - - // Path filePath = Paths.get("/mnt/ISILON/ARCHIVE_RESTORE/XXX/xxx-ARCH-209740793_2-207990326.MXF"); - // MediaInfo mi = new MediaInfo(filePath); - // mi.process(); - // if (true) - // throw new Exception("Frames. " + mi.getFrames()); return null; } + void ftpTest() throws Exception { + StoreUri source = null; + StoreUri target = null; + try { + source = getManager().getStoreUri("MEDIACUBE_UPLOADS", RemoteStoreProtocol.LOCAL); + target = getManager().getStoreUri("NEXIO1", RemoteStoreProtocol.FTP); + source.addProgressListener(e -> setProgress(e.getProgress())); + logger.info("Uploading file PART_TEST.mxf"); + source.transferFrom(target, "PART_TEST.mxf", "PART_TEST.mxf"); + FTPClient client = ((FtpDirectoryLister) target.getLister()).connect(); + logger.info("Renaming file PART_TEST.mxf to RENAME_TEST.mxf"); + client.rename("PART_TEST.mxf", "RENAME_TEST.mxf"); + } catch (Exception e) { + logger.catching(e); + } finally { + if (target != null) + target.cleanUp(); + if (source != null) + source.cleanUp(); + } + + } + } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/Cmd.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/Cmd.java new file mode 100644 index 00000000..797dc12f --- /dev/null +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/Cmd.java @@ -0,0 +1,78 @@ +package user.jobengine.server.steps; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Cmd { + interface IResponseCallback { + void onResponse(String line); + } + + private static final Logger log = LogManager.getLogger(); + + public static ProcessBuilder create(String... args) { + List chunks = new ArrayList<>(); + for (String arg : args) + chunks.add(arg); + + ProcessBuilder processBuilder = new ProcessBuilder(); + processBuilder.command(chunks).redirectErrorStream(true); + return processBuilder; + } + + public static ProcessBuilder create(String command, StringBuilder args) { + args.insert(0, command + "\r\n"); + String[] chunks = args.toString().replace("\r\n", " ").split(" "); + return create(chunks); + } + + public static String execute(ProcessBuilder processBuilder) { + return execute(processBuilder, true); + } + + public static String execute(ProcessBuilder processBuilder, boolean firstResponse) { + return execute(processBuilder, firstResponse, null); + } + + public static String execute(ProcessBuilder processBuilder, boolean firstResponse, IResponseCallback responseCallBack) { + String result = null; + try { + log.debug("Executing : {}", processBuilder.command().toString().replace("[", "").replace("]", "").replace(",", "")); + Process process = processBuilder.start(); + + try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + String line = null; + while ((line = reader.readLine()) != null) { + log.debug("Process response: {}", line); + if (responseCallBack != null) + responseCallBack.onResponse(line); + //System.out.println(line); + if (line != null && line.length() > 0) { + result = line; + if (firstResponse) + break; + } + } + int exitCode = process.waitFor(); + if (exitCode != 0) + log.error("Exited with error code : " + exitCode); + } catch (Exception e) { + throw e; + } + } catch (Exception e) { + log.error(e); + } + + return result; + } + + public static String getFFMpegExecutable() { + return System.getProperty("jobengine.ffmpeg.location"); + } + +} diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/FFMpeg.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/FFMpeg.java new file mode 100644 index 00000000..d3e8eec7 --- /dev/null +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/FFMpeg.java @@ -0,0 +1,136 @@ +package user.jobengine.server.steps; + +import java.io.FileNotFoundException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import user.commons.mediatool.MediaInfo; + +public class FFMpeg { + public interface IProgressChanged { + void onProgressChanged(long progress); + } + + private static final String FPS = "fps="; + private static final String FRAME = "frame="; + + private static final Logger logger = LogManager.getLogger(); + + //@formatter:off + public static void concatenate(String chunklist, String output) { + ProcessBuilder processBuilder = Cmd.create( + Cmd.getFFMpegExecutable(), + "-f", "concat", + "-safe", "0", + "-i", chunklist, + "-vcodec", "copy", "-acodec", "libmp3lame", + "-y", "-v", "error", "-stats", output); + + Cmd.execute(processBuilder, false); + } + + //@formatter:off + public static void encode(String input, String output, double from, double length) { + ProcessBuilder processBuilder = Cmd.create( + Cmd.getFFMpegExecutable(), + "-ss", String.valueOf(from), + "-t", String.valueOf(length), + "-i", input, + "-vcodec", "libx264", "-acodec", "ac3", + "-movflags", "+faststart", + "-vf", "scale=-2:480,format=yuv420p", + "-y", "-v", "error", "-stats", "-f", "mp4", output); + + Cmd.execute(processBuilder, false); + } + + //@formatter:off + static public void hls_audio4ch(String input, String output, IProgressChanged progressCallback) throws Exception { + StringBuilder sb = new StringBuilder(); + sb.append("-v panic -stats -y") + .append("\r\n") + .append(String.format("-i %s", input)) + .append("\r\n") + .append("-map 0:0 -c:v h264 -an -hls_time 100000000000 -hls_list_size 0") + .append("\r\n") + .append(String.format("-f hls %s/video.m3u8", output)) + .append("\r\n"); + + for (int i = 0; i < 4; i++) { + sb.append(String.format("-map 0:%d -f segment -segment_time 100000000000 -segment_list_size 0", i+1)) + .append("\r\n") + .append(String.format("-segment_list %s/audio%d.m3u8 -segment_format mpegts %s/audio%d%%d.aac", output, i, output, i)) + .append("\r\n"); + } + System.out.println(sb); + ProcessBuilder processBuilder = Cmd.create(Cmd.getFFMpegExecutable(), sb); + long allFrames[] = {0}; + + try { + MediaInfo mi = new MediaInfo(Paths.get(input)); + mi.process(); + allFrames[0] = mi.getFrames(); + } catch (Exception e ){ + System.err.println(e); + + } + + Cmd.execute(processBuilder, false, l -> { + if (allFrames[0] == 0) { + logger.debug(l); + System.out.println(l); + return; + } + + if (progressCallback == null) + return; + if (l.contains(FRAME) && l.contains(FPS)) { + String p = StringUtils.substringBetween(l, FRAME, FPS); + if (p != null) { + p = p.trim(); + try { + int currentFrames = Integer.parseInt(p); + progressCallback.onProgressChanged((long)currentFrames * 100 / allFrames[0]); + } catch (Exception e){} + } + } + }); + +// #EXTM3U +// #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="CH1",URI="audio0.m3u8" +// #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="CH2",URI="audio1.m3u8" +// #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="CH3",URI="audio2.m3u8" +// #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="CH4",URI="audio3.m3u8" +// #EXT-X-STREAM-INF:PROGRAM-ID=1,AUDIO="audio" +// video.m3u8 + + if (!Paths.get(output, "video.m3u8").toFile().exists()) + throw new FileNotFoundException("video.m3u8"); + if (!Paths.get(output, "video0.ts").toFile().exists()) + throw new FileNotFoundException("video0.ts"); + for (int i = 0; i < 4; i++) { + String file = String.format("audio%d.m3u8", i); + if (!Paths.get(output, file).toFile().exists()) + throw new FileNotFoundException(file); + file = String.format("audio%d0.aac", i); + if (!Paths.get(output, file).toFile().exists()) + throw new FileNotFoundException(file); + } + + List indexLines = new ArrayList<>(); + indexLines.add("#EXTM3U"); + for (int i = 0; i < 4; i++) { + indexLines.add(String.format("#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio\",NAME=\"CH%d\",URI=\"audio%d.m3u8\"", i+1, i)); + } + indexLines.add("#EXT-X-STREAM-INF:PROGRAM-ID=1,AUDIO=\"audio\""); + indexLines.add("video.m3u8"); + + Files.write(Paths.get(output, "index.m3u8"), indexLines); + } +} diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java index c3b51c8c..e8662e49 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java @@ -108,8 +108,10 @@ public class FileValidatorStep extends JobStep { Message msg = new ParameterizedMessage("Validációs hiba miatt a {} fájl másolása nem lehetséges.", filePath.getFileName()); EscortFiles.notifyRecipient(Paths.get(escortFile), logger, msg); - EscortFiles.remove(filePath); - EscortFiles.remove(Paths.get(escortFile)); + //200924 komment, mert a mar TSM-bol letoltott mozikat hagyjuk ott, a download irany ugyis felulir + //EscortFiles.remove(filePath); + //EscortFiles.remove(Paths.get(escortFile)); + //200911 a kommentet kivettem, mert ezeket is torolni kell EscortFiles.remove(Paths.get(escortFile + EscortFiles.DOT_CATCHED)); throw new Exception("Length mismatch in " + filePath + ". Expected: " + expectedFrameNumber + ", found: " + frames); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java index 68398fcf..d580e05f 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java @@ -10,6 +10,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -94,13 +95,17 @@ public class ForkUploadStep extends JobStep { private String getTSMFileName(long mediaId, StoreUri sourceStoreUri) { String result = null; Media media = getManager().getMedia(mediaId); - List mediaFiles = media.getMediaFiles(); - for (MediaFile mediaFile : mediaFiles) { - if (mediaFile.getStoreId() == sourceStoreUri.getStoreId()) { - result = mediaFile.getRelativePath(); - break; + + if (media != null) { + List mediaFiles = media.getMediaFiles(); + for (MediaFile mediaFile : mediaFiles) { + if (mediaFile.getStoreId() == sourceStoreUri.getStoreId()) { + result = mediaFile.getRelativePath(); + break; + } } } + return result; } @@ -135,13 +140,20 @@ public class ForkUploadStep extends JobStep { } StoreUri sourceStoreUri = getManager().getStoreUri("TSM", RemoteStoreProtocol.TSM); + + long mediaId = downloadable.getLong("mediaId"); + String tsmFileName = getTSMFileName(mediaId, sourceStoreUri); + if (StringUtils.isBlank(tsmFileName)) { + logger.error(getMarker(), "Media ID not exists anymore {}", mediaId); + return false; + } + StoreUri targetStoreUri = getManager().getStoreUri(downloadable.getLong("targetStoreUriId")); Store targetStore = getManager().getStore(targetStoreUri.getStoreId()); template = targetStore.getName() + "-" + template; logger.info(getMarker(), "Starting {} for {}", template, escortFileName); - String tsmFileName = getTSMFileName(downloadable.getLong("mediaId"), sourceStoreUri); String targetFileName = downloadable.getString("fileName"); Map parameters = new HashMap<>(); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/HLSProxyStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/HLSProxyStep.java new file mode 100644 index 00000000..e18ca0cf --- /dev/null +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/HLSProxyStep.java @@ -0,0 +1,73 @@ +package user.jobengine.server.steps; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; + +import user.commons.StoreUri; +import user.commons.remotestore.RemoteStoreProtocol; +import user.jobengine.db.Media; +import user.jobengine.db.MediaFile; +import user.jobengine.db.Store; + +public class HLSProxyStep extends JobStep { + private static final Logger logger = LogManager.getLogger(); + private static final String LOWRES_FILETYPE = "Low-res"; + private Marker marker; + + @StepEntry + public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia) throws Exception { + marker = getSessionMarker(); + + Path sourceFilePath = Paths.get(archiveItem.getMediaFile()); + try { + String fileName = sourceFilePath.getFileName().toString(); + String proxyName = fileName.substring(0, fileName.lastIndexOf(".")) + "S01" + fileName.substring(fileName.lastIndexOf(".")); + Path lowresSourcePath = Paths.get(sourceFilePath.getParent().toString(), EscortFiles.STATUSFOLDER, proxyName); + if (!lowresSourcePath.toFile().exists()) + throw new Exception("File not exists: " + lowresSourcePath); + + Store lowresStore = getManager().getCurrentLowresStore(); + StoreUri lowresStoreUri = lowresStore.getTargetStoreUri(RemoteStoreProtocol.LOCAL); + String webPath = lowresStoreUri.toString(true); + + Path subdirPath = null; + if (proxyName.indexOf(".") > 2) { + subdirPath = Paths.get(proxyName.substring(0, 1), proxyName.substring(1, 2), proxyName.substring(2, 3), proxyName); + } else { + subdirPath = Paths.get(proxyName); + } + + String subDir = subdirPath.toString(); + Path lowresTargetPath = Paths.get(webPath, subDir); + + int version = 1; + while (lowresTargetPath.toFile().exists()) { + subDir = subDir + version; + lowresTargetPath = Paths.get(webPath, subDir); + version++; + } + + EscortFiles.ensureUNCFolder(webPath, subDir); + lowresTargetPath = Paths.get(webPath, subDir); + //Files.move(lowresSourcePath, lowresTargetPath); + + FFMpeg.hls_audio4ch(lowresSourcePath.toAbsolutePath().toString(), lowresTargetPath.toAbsolutePath().toString(), p -> { + setProgress((int) p); + }); + + Path lowresHTTPPath = Paths.get(subDir, "index.m3u8"); + MediaFile mediaFile = getManager().createMediaFile(lowresHTTPPath.toString(), LOWRES_FILETYPE, lowresStore.getName()); + mediaFile.setMediaId(mediaCubeMedia.getId()); + getManager().add(mediaFile); + } catch (Exception e) { + logger.catching(e); + logger.error(marker, "A HLS proxy létrehozása sikertelen a '{}' fájlból. A rendszer üzenete: {}", sourceFilePath, e.getMessage()); + } + return null; + } + +} diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/HarrisMissingMaterialCheckerStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/HarrisMissingMaterialCheckerStep.java index 0663d5b3..9f683503 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/HarrisMissingMaterialCheckerStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/HarrisMissingMaterialCheckerStep.java @@ -69,7 +69,7 @@ public class HarrisMissingMaterialCheckerStep extends JobStep { break; } - boolean contains = fileNames.contains(record.getFileName()); + boolean contains = fileNames.contains(record.getFileName() + ".lxf"); if (contains) logger.info(getMarker(), "File {} already exists on {}", record.getFileName(), targetStoreName); else diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/MetadataPersisterStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/MetadataPersisterStep.java index 007ad6c0..f0d1cb9f 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/MetadataPersisterStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/MetadataPersisterStep.java @@ -1,5 +1,6 @@ package user.jobengine.server.steps; +import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; @@ -40,7 +41,19 @@ public class MetadataPersisterStep extends JobStep { mediaId = tryGetMediaId(title, mediaId); } - //TODO ha van mediaId, akkor update!!!!!!!!! + long fileSize = 0; + try { + Path filePath = Paths.get(escortFilePath.getParent().toString(), fileName); + File file = filePath.toFile(); + if (file.exists()) + fileSize = file.length(); + } catch (Exception e) { + logger.error(getMarker(), e.getMessage()); + } + + Timestamp modified = downloadable.getTimestamp("modified"); + Timestamp created = downloadable.getTimestamp("created"); + long frames = downloadable.getLong("frames"); if (mediaId == 0) { String targetStoreName = getManager().getStore(targetStoreUri.getStoreId()).getName(); @@ -54,29 +67,30 @@ public class MetadataPersisterStep extends JobStep { //TODO megoldani egy tranzakcioban item.add(); media.setItemId(item.getId()); - media.setLength(downloadable.getLong("frames")); - media.setArchived(Timestamp.from(Instant.now())); - Timestamp modified = downloadable.getTimestamp("modified"); - Timestamp created = downloadable.getTimestamp("created"); - media.setModified(Timestamp.from(Instant.now())); + media.setLength(frames); media.setCreated(created); + media.setModified(modified); + media.setArchived(Timestamp.from(Instant.now())); media.add(); + + //TODO mediaFile.setMediaId(media.getId()); mediaFile.setLastModified(modified); - //TODO - //mediaFile.setFileSize(fileSize); + mediaFile.setFileSize(fileSize); mediaFile.add(); } else { Media media = manager.getMedia(mediaId); - Timestamp modified = downloadable.getTimestamp("modified"); - Timestamp created = downloadable.getTimestamp("created"); - media.setModified(Timestamp.from(Instant.now())); + media.setLength(frames); media.setCreated(created); + media.setModified(modified); + media.setArchived(Timestamp.from(Instant.now())); manager.modify(media); - MediaFile mediaFile = manager.getSystemMediaFile(media); + //TODO - //mediaFile.setFileSize(fileSize); + MediaFile mediaFile = manager.getSystemMediaFile(media); + mediaFile.setRelativePath(fileName); mediaFile.setLastModified(modified); + mediaFile.setFileSize(fileSize); manager.modify(mediaFile); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java index f089605c..201f22f1 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java @@ -1,10 +1,14 @@ package user.jobengine.server.steps; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.net.ftp.FTPClient; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import user.commons.RemoteFile; import user.commons.StoreUri; +import user.commons.remotestore.FtpDirectoryLister; public class NEXIO1TransferToStep extends TransferStep { private static final Logger logger = LogManager.getLogger(); @@ -12,18 +16,35 @@ public class NEXIO1TransferToStep extends TransferStep { @Override @StepEntry public Object[] execute(StoreUri sourceStoreUri, String sourceFileName, StoreUri targetStoreUri, String targetFileName) throws Exception { + // + // try { + // String title = targetFileName; + // if (title.contains(".")) + // title = title.substring(0, title.lastIndexOf(".")); + // RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); + // if (remoteFile != null && remoteFile.getContent() != null) { + // logger.info("File already exists on NEXIO1 {}", targetFileName); + // return null; + // } + // } catch (Exception e) { + // logger.error(e.getMessage()); + // } finally { + // targetStoreUri.cleanUp(); + // } try { - String title = targetFileName; - if (title.contains(".")) - title = title.substring(0, title.lastIndexOf(".")); - RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); - if (remoteFile != null && remoteFile.getContent() != null) { - logger.info("File already exists on NEXIO1 {}", targetFileName); + FTPClient client = ((FtpDirectoryLister) targetStoreUri.getLister()).connect(); + logger.info(getMarker(), "Reading target file list"); + List fileNames = Arrays.asList(client.listNames()); + logger.info(getMarker(), "Target file list reading completed, mediabase size is {}", fileNames.size()); + String title = targetFileName.replace(".mxf", ".lxf"); + boolean contains = fileNames.contains(title); + if (contains) { + logger.info(getMarker(), "File already exists {} on {}", title, getManager().getStore(targetStoreUri.getStoreId()).getName()); return null; } } catch (Exception e) { - logger.error(e.getMessage()); + logger.catching(e); } finally { targetStoreUri.cleanUp(); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java index a5374e27..7136b02b 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java @@ -1,10 +1,14 @@ package user.jobengine.server.steps; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.net.ftp.FTPClient; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import user.commons.RemoteFile; import user.commons.StoreUri; +import user.commons.remotestore.FtpDirectoryLister; public class NEXIO2TransferToStep extends TransferStep { private static final Logger logger = LogManager.getLogger(); @@ -12,17 +16,33 @@ public class NEXIO2TransferToStep extends TransferStep { @Override @StepEntry public Object[] execute(StoreUri sourceStoreUri, String sourceFileName, StoreUri targetStoreUri, String targetFileName) throws Exception { + // try { + // String title = targetFileName; + // if (title.contains(".")) + // title = title.substring(0, title.lastIndexOf(".")); + // RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); + // if (remoteFile != null && remoteFile.getContent() != null) { + // logger.info("File already exists on NEXIO2 {}", targetFileName); + // return null; + // } + // } catch (Exception e) { + // logger.error(e.getMessage()); + // } finally { + // targetStoreUri.cleanUp(); + // } try { - String title = targetFileName; - if (title.contains(".")) - title = title.substring(0, title.lastIndexOf(".")); - RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); - if (remoteFile != null && remoteFile.getContent() != null) { - logger.info("File already exists on NEXIO2 {}", targetFileName); + FTPClient client = ((FtpDirectoryLister) targetStoreUri.getLister()).connect(); + logger.info(getMarker(), "Reading target file list"); + List fileNames = Arrays.asList(client.listNames()); + logger.info(getMarker(), "Target file list reading completed, mediabase size is {}", fileNames.size()); + String title = targetFileName.replace(".mxf", ".lxf"); + boolean contains = fileNames.contains(title); + if (contains) { + logger.info(getMarker(), "File already exists {} on {}", title, getManager().getStore(targetStoreUri.getStoreId()).getName()); return null; } } catch (Exception e) { - logger.error(e.getMessage()); + logger.catching(e); } finally { targetStoreUri.cleanUp(); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java index 231af2a0..03cda26d 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java @@ -6,6 +6,7 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.time.Duration; import java.time.Instant; +import java.util.Date; import java.util.Iterator; import org.apache.logging.log4j.LogManager; @@ -36,17 +37,8 @@ public class NEXIOArchiveCheckerStep extends JobStep { return false; } - //utolso modositas a mosthoz kepest - //The result of this method can be a negative period if the end is before the start. - long modifiedHours = Duration.between(modified.toInstant(), Instant.now()).toHours(); - if (modifiedHours < 0) { - logger.info(getMarker(), "{} modification time greather than now", title); - return false; - } - if (modifiedHours < lastModifiedHours) { - logger.debug(getMarker(), "{} modification time is too cloose for now", title); + if (!checkModifiedByTime(title, modified, lastModifiedHours)) return false; - } //utolso modositas MediaFile mediaFile = getManager().getSystemMediaFile(media); @@ -73,6 +65,25 @@ public class NEXIOArchiveCheckerStep extends JobStep { return false; } + private boolean checkModifiedByTime(String title, Timestamp modified, int lastModifiedHours) { + //utolso modositas a mosthoz kepest + //The result of this method can be a negative period if the end is before the start. + + long modifiedHours = Duration.between(modified.toInstant(), Instant.now()).toHours(); + if (modifiedHours < 0) { + logger.info(getMarker(), "{} modification time greather than now", title); + return false; + } + if (modifiedHours < lastModifiedHours) { + logger.debug(getMarker(), "{} modification time is too cloose for now", title); + return false; + } + + logger.info(getMarker(), "Found modified media {} with NEXIO timestamp {}", title, df.format(new Date(modified.getTime()))); + + return true; + } + @StepEntry public Object[] execute(String sourceStoreName, String escortStoreName, int lastModifiedHours) throws Exception { Controller controller = null; @@ -145,8 +156,10 @@ public class NEXIOArchiveCheckerStep extends JobStep { long mediaId = 0; if (media == null) { - createEscort = true; - logger.info(getMarker(), "{} not archived yet", title); + if (checkModifiedByTime(title, modified, lastModifiedHours)) { + createEscort = true; + logger.info(getMarker(), "{} not archived yet", title); + } } else { mediaId = media.getId(); createEscort = check(modified, created, frames, media, videoFormat, lastModifiedHours); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/PBQuery.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/PBQuery.java index 458b1375..b441b0c7 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/PBQuery.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/PBQuery.java @@ -230,8 +230,10 @@ public class PBQuery { continue; } - if (poolContent.contains(mediaName)) + if (poolContent.contains(mediaName)) { + logger.info("Pool already contains {}", mediaName); continue; + } String usageTime = getAttribute(mediaNode, "earliestUsageTime"); putEarliest(result, mediaName, usageTime); @@ -296,8 +298,10 @@ public class PBQuery { continue; } - if (poolContent.contains(mediaName)) + if (poolContent.contains(mediaName)) { + logger.info("Pool already contains {}", mediaName); continue; + } Node usageChild = mediaNode.getFirstChild(); if (usageChild == null) { diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TestForkCancelableStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TestForkCancelableStep.java index 91d00a8d..39e39270 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TestForkCancelableStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TestForkCancelableStep.java @@ -14,7 +14,7 @@ public class TestForkCancelableStep extends JobStep { // private static final String CHILD_TEMPLATE = "fake-concurrent.xml"; private static final String CHILD_TEMPLATE = "cancelable.xml"; private static final Logger logger = LogManager.getLogger(); - int count = 5; + int count = 20; @StepEntry public Object[] execute(IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { diff --git a/server/user.jobengine.osgi.commons/src/user/commons/mediatool/MediaInfo.java b/server/user.jobengine.osgi.commons/src/user/commons/mediatool/MediaInfo.java index 4ccac3f3..46e05f4b 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/mediatool/MediaInfo.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/mediatool/MediaInfo.java @@ -24,17 +24,30 @@ public class MediaInfo { this.filePath = filePath; } + public int getAudioStreams() { + return audioStreams; + } + public int getBitRate() { return bitRate; } + public String getColorSpace() { + return colorSpace; + } + public long getFrames() { return frames; } + public int getVideoStreams() { + return videoStreams; + } + public void process() throws InterruptedException, IOException { - final Demuxer demuxer = Demuxer.make(); + Demuxer demuxer = null; try { + demuxer = Demuxer.make(); demuxer.open(filePath.toString(), null, false, true, null, null); bitRate = demuxer.getBitRate(); @@ -62,13 +75,15 @@ public class MediaInfo { } if (videoStreamId == -1) throw new RuntimeException("Could not find video stream in " + filePath); - + } catch (UnsatisfiedLinkError e) { + logger.catching(e); } catch (Exception e) { logger.catching(e); throw e; } finally { try { - demuxer.close(); + if (demuxer != null) + demuxer.close(); } catch (Exception e) { logger.catching(e); throw e; @@ -76,16 +91,4 @@ public class MediaInfo { } } - public String getColorSpace() { - return colorSpace; - } - - public int getAudioStreams() { - return audioStreams; - } - - public int getVideoStreams() { - return videoStreams; - } - } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java index cdd011d3..b85e1463 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java @@ -17,6 +17,7 @@ import user.tsm.client.TSMBufferedClient; public class TSMLister implements IDirectoryLister { + private static final String DELIMITER = "/"; private static final String NODENAME = System.getProperty("tsm.nodename", "JOBENGINE"); private static final String FSNAME = System.getProperty("tsm.fsname", "JOBENGINE"); private static final String ALTERNATE_FSNAME = System.getProperty("tsm.fsname.alternate", "JOBENGINE"); @@ -68,12 +69,12 @@ public class TSMLister implements IDirectoryLister { String currentFileName = fileName; logger.info("Getting {}, {}, {}", FSNAME, HLNAME, currentFileName); - TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, "\\", "\\" + currentFileName); + TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, DELIMITER, DELIMITER + currentFileName); //probaljuk meg a masik tarbol if (backupFileObject == null) { logger.info("Getting {}, {}, {}", ALTERNATE_FSNAME, HLNAME, currentFileName); - backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, "\\", "\\" + currentFileName); + backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, DELIMITER, DELIMITER + currentFileName); } //probaljuk meg kiterjesztes nelkul is @@ -120,7 +121,7 @@ public class TSMLister implements IDirectoryLister { // } catch (Exception e) { // logger.info(e.getMessage()); // } - TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, "\\", remoteFile); + TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, DELIMITER, remoteFile); outputStream.open(); return outputStream; } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java index fba6c442..03463dab 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java @@ -17,6 +17,7 @@ public class TSMOutputStream extends OutputStream { private boolean initialized; private long sizeEstimate; + //highLevelName == delimiter public TSMOutputStream(TSMBufferedClient client, String filespaceName, String highLevelName, RemoteFile remoteFile) { this.client = client; this.filespaceName = filespaceName; @@ -36,7 +37,7 @@ public class TSMOutputStream extends OutputStream { } public void open() throws TSMException, FileNotFoundException { - backupObject = new TSMBackupFileObject(filespaceName, highLevelName, "\\" + fileName); + backupObject = new TSMBackupFileObject(filespaceName, highLevelName, highLevelName + fileName); backupObject.setSizeEstimate(sizeEstimate); } diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/BreakDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/BreakDAO_SJProfile0.ser index 8623276fc2bd19edab814cc493174d33cee5d080..4b35461a0e4c30b67b6639dfd53512bfbd57c549 100644 GIT binary patch delta 18 acmdlgxm9ul4IOWOrmn*|w{a0389Q3iJa delta 18 acmdlgxm9ul4w-O5|sn*|w{a038A7Y2a< diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainCategoryDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainCategoryDAO_SJProfile0.ser index 101941e9a76028ba9dac0e5f97bcd93ba407d795..b01c0b4557d87c3e9a0f34899cf784697fce31d0 100644 GIT binary patch delta 18 acmew%{6lyH4IOWOr|Hw!X8=Kugo><5GZ delta 18 acmew%{6lyH4w-O5{Gn*|x4a{vHKf(M2G diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainDAO_SJProfile0.ser index eb1ac450b57355a9f32891b156f779564d43a49a..f03cf916cc4e1b1b9841bcc629e2f2b473edff14 100644 GIT binary patch delta 18 acmX>te_DP64IOWTEfn*|wn@c{rr3kGcf delta 18 acmX>te_DP64w-O5|7n*|wn@c{rw&Ie2Y diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainIndexDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/DomainIndexDAO_SJProfile0.ser index baa3715294146dbd93c3841c1352bd00fc5dfe46..fb72d90a4e85876f0016511654a6c7ab3748edb3 100644 GIT binary patch delta 18 ZcmX>uaa>{p4IOWTFfn*|xoxB)?C1|0wZ delta 18 acmX>uaa>{p4w-O5{=HVZPEaRUHGX$IT? diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/EntityBaseDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/EntityBaseDAO_SJProfile0.ser index 41300e56bfd448f08b3773afdd5561ace137dd71..33f05e2206d1e2522ef260453e281dafe6af0995 100644 GIT binary patch delta 18 acmaDS_)c&G4IOWTFXn*|x~vI77|E(Ztz delta 18 acmaDS_)c&G4w-O5`hHVZP|Wd{IEg$LCD diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/FileTypeDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/FileTypeDAO_SJProfile0.ser index 52589159365ba71599f4047909627e781d8c8d50..eaa80a0bf61f8a4d7ba7ab21b88b2f95d7792e07 100644 GIT binary patch delta 18 acmZ1=w?J+K4IOWTE0HVZQH^8o-p0|oE^ delta 18 acmZ1=w?J+K4w-O5{EHw!ZI^8o-uLI$}2 diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/FolderDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/FolderDAO_SJProfile0.ser index 1f5baa0694cb70592f517f091686936193df2767..8fe928380e34aab11b88bdf39c1fcf20f02f5ed4 100644 GIT binary patch delta 18 acmZ24yk2+%4IOWTEOHw!Y(;{X6aPX?L* delta 18 acmZ24yk2+%4w-OAfMn*|x?aR2~6i3VZ- diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/HelperDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/HelperDAO_SJProfile0.ser index 1f14b659ba1a6e9f90cc9435b324b90e5d7c4597..d596bd3064acb7278fa1368901d18c4238d87cc6 100644 GIT binary patch delta 18 ZcmeC;?c&|Q!^m3l(stpV&4P@TtN=Q)1}gvn delta 18 ZcmeC;?c&|Q!^m2ExAL~YWIOWTFFHVZO7;0FLqYzMFa delta 18 acmeyU_)&2K4w-OAf~n*|vk@B;u#WCv{k diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/ItemTypeDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/ItemTypeDAO_SJProfile0.ser index e0e14d2651f1377103d145e46418a33ae50aa329..2f196a5e0fdd170a27e1b333d82cdf13d84cb3cc 100644 GIT binary patch delta 18 acmew=_El^H4IOWTDXHVZPQZ~*{I8wWQ4 delta 18 Zcmew=_El^H4w-OAf;n*|wDxByBY2KE2| diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/JobDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/JobDAO_SJProfile0.ser index faa88b59c2614592938599854f66a9a15487f67e..f91175e9e9826fe0917914c8ad03ebe8a1bff731 100644 GIT binary patch delta 18 ZcmZ3gwNz^Z4IOWQ@9n*|v~L;yVk1(N^( delta 18 ZcmZ3gwNz^Z4w-OAhXn*|v~L;ykm22lV2 diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/JobParametersDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/JobParametersDAO_SJProfile0.ser index 301438423ae9b755280e4abc566a1b729b03a431..0838889f251a7356c7f8a4ee1197292ef8d36751 100644 GIT binary patch delta 18 Zcmdliv{`5a4IOWQ?Sn*|w_H~>7f1)=}| delta 18 Zcmdliv{`5a4w-OAf#n*|w_H~>L)237z7 diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/MasterIdDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/MasterIdDAO_SJProfile0.ser index 68ce617087c42a8096b3b3bb8db92128fc68b711..7573db067cce181df0c95dd3c4e9f254e48d0fda 100644 GIT binary patch delta 18 Zcmey)^POh{4IOWQ>{n*|xuSOGw-OAe)n*|xuSOH2-2NeJS diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/MediaDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/MediaDAO_SJProfile0.ser index 212468d3ed2e0e4e8409549fefe94c972d8d32d6..b48972027f9532e82b594c47d7d45cbc09fc7e32 100644 GIT binary patch delta 18 acmaE_`d)Pd4IOWQ@hn*|x~2?78~Uk4}v delta 18 acmaE_`d)Pd4w-OAfbHVZP|69fQGVh85{ diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/MediaFileDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/MediaFileDAO_SJProfile0.ser index bb26aa2aeb02419564dd3b0cf28f8ec8ae09421e..4ca9e8bf1d94964dcb54d94c1c8c36d4df47116b 100644 GIT binary patch delta 18 ZcmeyW@>OL64IOWQ^1n*|wD1OZ922GRfk delta 18 acmeyW@>OL64w-OAg0Hw!YR2m%03um_L; diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/MetadataDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/MetadataDAO_SJProfile0.ser index b816912bd6af10012fd189a309db80342a9526e8..47884950fafec7538a29bdb7e139afc0b9432e4b 100644 GIT binary patch delta 18 Zcmca@a@%AB4IOWQ@wn*|xYBmqdf2FL&a delta 18 acmca@a@%AB4w-OAfHHw!X)Ndf>(xCe#+ diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/MetadataElementDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/MetadataElementDAO_SJProfile0.ser index 7e4128fb444d410e3ec73ed2237abae6366eb57e..5e1b326bbf4eac86f25a3f5757ef461408f8fb0f 100644 GIT binary patch delta 18 acmZ1{zD|4t4IOWQ>=Hw!Y(w-OAg~HVZP&qepGw|4IOWQ^3HVZOt;Q|0d_6Fzx delta 18 acmX>qepGw|4w-OAg)Hw!Xu;Q|0iy$78D diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/RemoteStoreDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/RemoteStoreDAO_SJProfile0.ser index 34f04a30ba3faf65617eac522dd741e5df816535..a5f260c55efcc81e7e3f3f779073c9150ad9e667 100644 GIT binary patch delta 18 acmaDQ@k(L?4IOWQ?w-O4+Xn*|voxdBJb2Ce`A diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/SceneContentDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/SceneContentDAO_SJProfile0.ser index 1aa06b2b48bca1b83a5c0b4c06054ff3f71f119f..2b00f2546ddb283698210846637d49a7ab753cd3 100644 GIT binary patch delta 18 acmdlWwLxkF4IOWQ?fHVZP!^8f%r7zR%O delta 18 ZcmdlWwLxkF4w-O4*kn*|x=c>q8h1`YrK diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/SceneDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/SceneDAO_SJProfile0.ser index 799e66b5c7d8e7aa8b170af48d0a0c82c378b07d..9b1fda83ad8fcdccbe477b0db7a0f951770e3cdf 100644 GIT binary patch delta 18 acmbO$K39AL4IOWQ?{HVZQLZ~*{6js~Ov delta 18 ZcmbO$K39AL4w-O4-Wn*|wrxBxzk24VmJ diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/SearchDefinitionDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/SearchDefinitionDAO_SJProfile0.ser index 80dedcfe1b5752312754e7f55c91bc2f201a8fd2..2010cc8bd02f26347f83a6317acf732c0998977d 100644 GIT binary patch delta 18 acmX>heL{Kz4IOWVafn*|xS^8f%r9|l?g delta 18 acmX>heL{Kz4w-O4+Dn*|xS^8f%vqz425 diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/ShotDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/ShotDAO_SJProfile0.ser index 0dc2921040c5f491008c6ef830edbe36f0065922..53fad35915284b96861b490b1be503951f51cf7c 100644 GIT binary patch delta 18 ZcmbO)JzshQ4IOWVZ?n*|yBcmO-o1@iy^ delta 18 ZcmbO)JzshQ4w-O4-3n*|yBcmP0N2A%)_ diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/StoreDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/StoreDAO_SJProfile0.ser index 73f6f721bc1d0f4a32e4c89dd7339890453fc3e0..41d5e701b730ccbde02617bbe5a1ff1acf9dcc5e 100644 GIT binary patch delta 18 Zcmca3aYteU4IOWVcPn*|xYxdB6{20j1) delta 18 Zcmca3aYteU4w-O4-Jn*|xYxdBJP2G#%o diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/StoreUriDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/StoreUriDAO_SJProfile0.ser index 6bfd563ec64a376f3a4ab5ce821caf99a9d72ba1..d2f9600743e6505f7d74c464815852b3bd99b5a2 100644 GIT binary patch delta 18 ZcmbQDIz@E@4IOWVb+n*|x01pz#21`q%M delta 18 ZcmbQDIz@E@4w-O4)+n*|x01pz?C2D1PF diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/UserInfoDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/UserInfoDAO_SJProfile0.ser index 636dfe5ffd41b1f4dd88709cb524c73c4fcbfdb0..7b7301e694d08b19cdb337092b53ede02c77fdb5 100644 GIT binary patch delta 18 ZcmdlgvsGpT4IOWVb{n*|wFcmY4!1_b~B delta 18 acmdlgvsGpT4w-O4-DHVZPU@B#os$p)4H diff --git a/server/user.jobengine.osgi.db/generated/user/jobengine/db/WorkflowActionDAO_SJProfile0.ser b/server/user.jobengine.osgi.db/generated/user/jobengine/db/WorkflowActionDAO_SJProfile0.ser index d92f4d828f891b251019342da73f9211d62b6aa8..7dbdd906664b2d5ba9a231c87dc13ac969bd329c 100644 GIT binary patch delta 18 ZcmZovZB*UB!^m3l(sps{W#~G1{VMT delta 18 ZcmZovZB*UB!^m2ExAM-~&4P>tf&f1!2B!c3 diff --git a/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql b/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql index 97bc1a0d..4c117489 100644 --- a/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql +++ b/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql @@ -3,13 +3,13 @@ ALTER TABLE MEDIAFILE ADD COLUMN FILESIZE BIGINT default 0 @ -CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) -@ +--CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) +--@ -- //@UNDO -- SQL to undo the change goes here. ALTER TABLE MEDIAFILE DROP COLUMN FILESIZE @ -CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) -@ +--CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) +--@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/020_create_peablebeach_stores.sql b/server/user.jobengine.osgi.db/migrations/scripts/018_create_peablebeach_stores.sql similarity index 100% rename from server/user.jobengine.osgi.db/migrations/scripts/020_create_peablebeach_stores.sql rename to server/user.jobengine.osgi.db/migrations/scripts/018_create_peablebeach_stores.sql diff --git a/server/user.jobengine.osgi.db/migrations/scripts/021_create_filezilla_store.sql b/server/user.jobengine.osgi.db/migrations/scripts/019_create_filezilla_store.sql similarity index 100% rename from server/user.jobengine.osgi.db/migrations/scripts/021_create_filezilla_store.sql rename to server/user.jobengine.osgi.db/migrations/scripts/019_create_filezilla_store.sql diff --git a/server/user.jobengine.osgi.db/migrations/scripts/022_add_lastmodified_to_mediafile.sql b/server/user.jobengine.osgi.db/migrations/scripts/020_add_lastmodified_to_mediafile.sql similarity index 88% rename from server/user.jobengine.osgi.db/migrations/scripts/022_add_lastmodified_to_mediafile.sql rename to server/user.jobengine.osgi.db/migrations/scripts/020_add_lastmodified_to_mediafile.sql index f7906c11..9aa43665 100644 --- a/server/user.jobengine.osgi.db/migrations/scripts/022_add_lastmodified_to_mediafile.sql +++ b/server/user.jobengine.osgi.db/migrations/scripts/020_add_lastmodified_to_mediafile.sql @@ -20,13 +20,13 @@ ALTER TABLE MEDIAFILE ADD COLUMN LASTMODIFIED TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL @ -CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.MEDIAFILE') -@ +--CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.MEDIAFILE') +--@ -- //@UNDO -- SQL to undo the change goes here. ALTER TABLE MEDIAFILE DROP COLUMN LASTMODIFIED @ -CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.MEDIAFILE') -@ +--CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.MEDIAFILE') +--@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/023_create_dropitem_sp.sql b/server/user.jobengine.osgi.db/migrations/scripts/021_create_dropitem_sp.sql similarity index 100% rename from server/user.jobengine.osgi.db/migrations/scripts/023_create_dropitem_sp.sql rename to server/user.jobengine.osgi.db/migrations/scripts/021_create_dropitem_sp.sql diff --git a/server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql b/server/user.jobengine.osgi.db/migrations/scripts/022_create_tag_tables.sql similarity index 53% rename from server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql rename to server/user.jobengine.osgi.db/migrations/scripts/022_create_tag_tables.sql index fddbea58..da08d171 100644 --- a/server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql +++ b/server/user.jobengine.osgi.db/migrations/scripts/022_create_tag_tables.sql @@ -14,26 +14,48 @@ -- limitations under the License. -- --- // Alter JOB table, add RELATED column +-- // Create TAG TAG2MEDIA tables -- Migration SQL that makes the change goes here. -ALTER TABLE JOB ADD COLUMN RELATED VARCHAR(255) +CREATE TABLE TAG +( + ID BIGINT GENERATED ALWAYS AS IDENTITY (START WITH 1) PRIMARY KEY, + NAME VARCHAR(40) NOT NULL +)@ + +CREATE UNIQUE INDEX UDX_TAG_NAME ON TAG ("NAME") +@ + +CREATE TABLE MEDIATAGS +( + MEDIAID BIGINT NOT NULL, + TAGID BIGINT NOT NULL +)@ + +CREATE UNIQUE INDEX UDX_MEDIATAG ON MEDIATAGS (MEDIAID, TAGID) @ -CREATE INDEX IDX_JOB_RELATED ON JOB ("RELATED") +ALTER TABLE MEDIATAGS + ADD CONSTRAINT FK_MEDIATAGS_MEDIAID + FOREIGN KEY(MEDIAID) + REFERENCES MEDIA(ID) + ON DELETE CASCADE + ON UPDATE NO ACTION @ -CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.JOB') +ALTER TABLE MEDIATAGS + ADD CONSTRAINT FK_MEDIATAGS_TAGID + FOREIGN KEY(TAGID) + REFERENCES TAG(ID) + ON DELETE CASCADE + ON UPDATE NO ACTION @ -- //@UNDO -- SQL to undo the change goes here. -DROP INDEX IDX_JOB_RELATED +DROP TABLE TAG @ -ALTER TABLE JOB DROP COLUMN RELATED -@ - -CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.JOB') -@ +DROP TABLE MEDIATAGS +@ \ No newline at end of file diff --git a/server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql b/server/user.jobengine.osgi.db/migrations/scripts/023_alter_mediafile_lastmodified.sql similarity index 76% rename from server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql rename to server/user.jobengine.osgi.db/migrations/scripts/023_alter_mediafile_lastmodified.sql index ef93c831..2f98a406 100644 --- a/server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql +++ b/server/user.jobengine.osgi.db/migrations/scripts/023_alter_mediafile_lastmodified.sql @@ -14,17 +14,18 @@ -- limitations under the License. -- --- // Add LOOKUP function for use dynamic like from sqlj +-- // Create TAG TAG2MEDIA tables -- Migration SQL that makes the change goes here. -CREATE OR REPLACE FUNCTION LOOKUP(col VARCHAR(255), search VARCHAR(255)) - RETURNS int - RETURN -SELECT LOCATE(search, LOWER(col)) FROM SYSIBM.SYSDUMMY1 +ALTER TABLE MEDIAFILE + ALTER COLUMN LASTMODIFIED + DROP NOT NULL @ -- //@UNDO -- SQL to undo the change goes here. -DROP FUNCTION LOOKUP +ALTER TABLE MEDIAFILE + ALTER COLUMN LASTMODIFIED + SET NOT NULL @ diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/ArchivedMedia.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/ArchivedMedia.java index 43dc4cfe..b6ede4bb 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/ArchivedMedia.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/ArchivedMedia.java @@ -1,6 +1,8 @@ package user.jobengine.db; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; public class ArchivedMedia implements Serializable { private static final long serialVersionUID = 1L; @@ -9,6 +11,7 @@ public class ArchivedMedia implements Serializable { private String relevant; private Float tcIn; private Float tcOut; + private List tags; public Item getItem() { return item; @@ -22,6 +25,12 @@ public class ArchivedMedia implements Serializable { return relevant; } + public List getTags() { + if (tags == null) + tags = new ArrayList<>(); + return tags; + } + public Float getTcIn() { return this.tcIn; } @@ -42,6 +51,10 @@ public class ArchivedMedia implements Serializable { this.relevant = relevant; } + public void setTags(List tags) { + this.tags = tags; + } + public void setTcIn(Float tcIn) { this.tcIn = tcIn; } diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/IItemManager.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/IItemManager.java index ee909a1a..7fb9ee79 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/IItemManager.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/IItemManager.java @@ -6,6 +6,7 @@ import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.TreeMap; import com.ibm.nosql.json.api.BasicDBObject; @@ -33,6 +34,12 @@ import user.jobengine.search.SearchResult; * */ public interface IItemManager extends IEntityPersister { + void addMediaTag(long tagId, long mediaId); + + long addMediaTag(String tagText, long mediaId); + + long addTag(String tagText); + /** * Létrehoz egy új adatbázis kapcsolatot. */ @@ -109,9 +116,11 @@ public interface IItemManager extends IEntityPersister { void executeQuery(String query, IResultSetConsumer consumer, IStatementDecorator decorator); - int executeUpdate(Connection connection, String query, IStatementDecorator decorator); + int executeUpdate(Connection connection, String query, IStatementDecorator decorator, IResultSetConsumer keysConsumer); + + // long getExistingRundownMedia(String houseid); - void executeUpdate(String query, IStatementDecorator decorator); + void executeUpdate(String query, IStatementDecorator decorator, IResultSetConsumer keysConsumer); /** * A type paraméterből lekéri az entitás DAO objektumát, amin keresztül visszakapjuk az összes entitást. @@ -130,8 +139,6 @@ public interface IItemManager extends IEntityPersister { */ List getAll(Class type, long id); - // long getExistingRundownMedia(String houseid); - /** * Visszaadja egy átmeneti tárolóban tárolt entitás listáját. * @@ -140,6 +147,8 @@ public interface IItemManager extends IEntityPersister { */ List getAllCached(Class baseClass); + TreeMap getAllTags(); + /** * Visszaadja az entitásnak megfelelő DAO objektumot. * @@ -231,6 +240,8 @@ public interface IItemManager extends IEntityPersister { Media getMedia(String title); + List getMediaTags(long mediaId); + /** * Azonosító alapján elkér egy Metaadat elem objektumot. * @@ -372,6 +383,8 @@ public interface IItemManager extends IEntityPersister { */ void removeCached(Class baseClass, Object key); + void removeMediaTag(long tagId, long mediaId); + /** * A bemeneti paraméterként kapott típus és kulcs alapján elkéri a megfelelő objektumot az átmeneti tárolóból. * diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java index 26464c20..e557272f 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java @@ -16,6 +16,7 @@ import java.util.Date; import java.util.Hashtable; import java.util.List; import java.util.Map; +import java.util.TreeMap; import java.util.stream.Collectors; import org.apache.commons.io.FileSystemUtils; @@ -113,6 +114,39 @@ public class ItemManager extends MemoryCache implements IItemManager { traceOut(); } + @Override + public void addMediaTag(long tagId, long mediaId) { + String query = "INSERT INTO MEDIATAGS (tagId, mediaId) VALUES (?, ?)"; + executeUpdate(query, p -> { + p.setLong(1, tagId); + p.setLong(2, mediaId); + }, null); + } + + @Override + public long addMediaTag(String tagText, long mediaId) { + long tagId = getTagId(tagText); + if (tagId == 0) + tagId = addTag(tagText); + addMediaTag(tagId, mediaId); + return tagId; + } + + @Override + public long addTag(String tagText) { + long result[] = { 0 }; + String query = "INSERT INTO TAG (name) VALUES (?)"; + executeUpdate(query, p -> { + p.setString(1, tagText); + }, r -> { + long id = r.getLong(1); + result[0] = id; + return false; + }); + + return result[0]; + } + public synchronized void bindSignalServerService(SignalServer service) { try { initializeItemManager(service); @@ -492,7 +526,7 @@ public class ItemManager extends MemoryCache implements IItemManager { while (rs.next()) { if (!consumer.process(rs)) { - // ha nem megyunk vevig pool exception a tranzakcio miatt + // ha nem megyunk vegig pool exception a tranzakcio miatt connection.rollback(); break; } @@ -534,15 +568,27 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public int executeUpdate(Connection connection, String query, IStatementDecorator decorator) { + public int executeUpdate(Connection connection, String query, IStatementDecorator decorator, IResultSetConsumer keysConsumer) { int result = -1; PreparedStatement st = null; + ResultSet rs = null; try { - st = connection.prepareStatement(query); + st = connection.prepareStatement(query, Statement.RETURN_GENERATED_KEYS); if (decorator != null) decorator.decorate(st); result = st.executeUpdate(); connection.commit(); + if (keysConsumer != null) { + rs = st.getGeneratedKeys(); + while (rs.next()) { + if (!keysConsumer.process(rs)) { + // ha nem megyunk vegig pool exception a tranzakcio miatt ??? + connection.rollback(); + break; + } + } + } + } catch (Exception e) { logger.catching(e); try { @@ -550,6 +596,11 @@ public class ItemManager extends MemoryCache implements IItemManager { } catch (Exception e1) { } } finally { + try { + if (rs != null) + rs.close(); + } catch (Exception e1) { + } try { if (st != null) st.close(); @@ -560,12 +611,12 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public void executeUpdate(String query, IStatementDecorator decorator) { + public void executeUpdate(String query, IStatementDecorator decorator, IResultSetConsumer keysConsumer) { DefaultContext context = getDbContext(); Connection connection = null; try { connection = context.getConnection(); - executeUpdate(connection, query, decorator); + executeUpdate(connection, query, decorator, keysConsumer); } catch (Exception e) { } finally { putDbContext(context); @@ -600,6 +651,20 @@ public class ItemManager extends MemoryCache implements IItemManager { return result; } + //a map miatt az ID-k elerhetoek + @Override + public TreeMap getAllTags() { + TreeMap result = new TreeMap<>(); + String query = "SELECT id, name FROM TAG ORDER BY name"; + executeQuery(query, r -> { + long id = r.getLong("id"); + String name = r.getString("name"); + result.put(name, id); + return true; + }, null); + return result; + } + @Override public IEntityBaseDAO getBaseDAO(Class classInfo) { IEntityBaseDAO entityBaseDb = null; @@ -642,14 +707,6 @@ public class ItemManager extends MemoryCache implements IItemManager { return result; } - @Override - public DefaultContext getDbContext() { - DefaultContext context = null; - if (contextPool != null) - context = contextPool.borrowObject(); - return context; - } - // @Override // public long getExistingRundownMedia(String houseid) { // final long[] result = { 0 }; @@ -673,6 +730,14 @@ public class ItemManager extends MemoryCache implements IItemManager { // return result[0]; // } + @Override + public DefaultContext getDbContext() { + DefaultContext context = null; + if (contextPool != null) + context = contextPool.borrowObject(); + return context; + } + @Override public List getDynamicItemTypes() { List result = new ArrayList(); @@ -886,6 +951,21 @@ public class ItemManager extends MemoryCache implements IItemManager { }); } + @Override + public List getMediaTags(long mediaId) { + List result = new ArrayList<>(); + long id[] = { mediaId }; + String query = "SELECT t.name FROM TAG t, MEDIATAGS mt WHERE mt.tagid=t.id AND mt.mediaId=? ORDER BY name"; + executeQuery(query, r -> { + String name = r.getString("name"); + result.add(name); + return true; + }, p -> { + p.setLong(1, id[0]); + }); + return result; + } + @Override public MetadataElement getMetadataElement(long id) { return (MetadataElement) get(MetadataElement.class, id); @@ -1007,6 +1087,19 @@ public class ItemManager extends MemoryCache implements IItemManager { return result; } + public long getTagId(String tagText) { + long result[] = { 0 }; + String query = "SELECT id FROM TAG WHERE name=?"; + executeQuery(query, r -> { + long id = r.getLong("id"); + result[0] = id; + return true; + }, p -> { + p.setString(1, tagText); + }); + return result[0]; + } + @SuppressWarnings("unchecked") @Override public List getTargetStores() { @@ -1202,6 +1295,15 @@ public class ItemManager extends MemoryCache implements IItemManager { traceOut(); } + @Override + public void removeMediaTag(long tagId, long mediaId) { + String query = "DELETE FROM MEDIATAGS WHERE tagId = ? AND mediaId = ?"; + executeUpdate(query, p -> { + p.setLong(1, tagId); + p.setLong(2, mediaId); + }, null); + } + @Override public SearchResult search(SearchOptions options) { traceIn(); diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java index 3b94e594..fb09bee4 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java @@ -4,32 +4,60 @@ import java.util.Date; import java.util.List; public class SearchOptions { - final private String text; - final private List filters; - final private Date searchFrom; - final private Date searchTo; - final private int descLength; - final private String orderBy; - final private boolean orderAscending; - final private boolean missingProxy; + static public SearchOptions create() { + return new SearchOptions(); + } + + private String text; + private List types; + private List tags; + private Date from; + private Date to; + private int descLength; + private String orderBy; + private boolean orderAscending; + private boolean missingProxy; private long mediaId; private int fromResult; + private int toResult; - public SearchOptions(String text, List filters, Date searchFrom, Date searchTo, boolean missingProxy, int descLength, String orderBy, - boolean orderAscending) { - this.text = text; - this.filters = filters; - this.searchFrom = searchFrom; - this.searchTo = searchTo; - this.missingProxy = missingProxy; - this.descLength = descLength; - this.orderBy = orderBy; - this.orderAscending = orderAscending; + public StringBuilder getCriteriaForTag() { + StringBuilder result = null; + if (tags != null && tags.size() > 0) { + result = new StringBuilder(); + for (Long tagId : tags) { + if (result.length() > 0) + result.append(","); + result.append(tagId); + } + result.insert(0, "("); + result.append(")"); + } + return result; + } + + public StringBuilder getCriteriaForType() { + StringBuilder result = null; + if (types != null && types.size() > 0) { + result = new StringBuilder(); + for (Long typeId : types) { + if (result.length() > 0) + result.append(","); + result.append(typeId); + } + result.insert(0, "("); + result.append(")"); + } + return result; + } + + public int getDescLength() { + return descLength; } - public List getFilters() { - return filters; + public Date getFrom() { + return from; } public int getFromResult() { @@ -44,22 +72,26 @@ public class SearchOptions { return orderBy; } - public Date getSearchFrom() { - return searchFrom; - } - - public Date getSearchTo() { - return searchTo; + public List getTags() { + return tags; } public String getText() { return text; } + public Date getTo() { + return to; + } + public int getToResult() { return toResult; } + public List getTypes() { + return types; + } + public boolean isMissingProxy() { return missingProxy; } @@ -68,20 +100,79 @@ public class SearchOptions { return orderAscending; } - public void setFromResult(int fromResult) { + public boolean isValid() { + if (text != null && text.trim().length() > 2) + return true; + + if (from != null || to != null) + return true; + + if (missingProxy) + return true; + + if (types != null && types.size() > 0) + return true; + + if (tags != null && tags.size() > 0) + return true; + + return false; + } + + public SearchOptions setDescLength(int descLength) { + this.descLength = descLength; + return this; + } + + public SearchOptions setFrom(Date from) { + this.from = from; + return this; + } + + public SearchOptions setFromResult(int fromResult) { this.fromResult = fromResult; + return this; } - public void setMediaId(long mediaId) { + public SearchOptions setMediaId(long mediaId) { this.mediaId = mediaId; + return this; + } + + public SearchOptions setMissingProxy(boolean missingProxy) { + this.missingProxy = missingProxy; + return this; + } + + public SearchOptions setOrder(String orderBy, boolean orderAscending) { + this.orderBy = orderBy; + this.orderAscending = orderAscending; + return this; + } + + public SearchOptions setTags(List tags) { + this.tags = tags; + return this; + } + + public SearchOptions setText(String text) { + this.text = text; + return this; + } + + public SearchOptions setTo(Date to) { + this.to = to; + return this; } - public void setToResult(int toResult) { + public SearchOptions setToResult(int toResult) { this.toResult = toResult; + return this; } - public int getDescLength() { - return descLength; + public SearchOptions setTypes(List types) { + this.types = types; + return this; } } diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java b/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java index 967303ab..7f5dfb41 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java @@ -28,8 +28,7 @@ public class MediaFinder implements IMediaFinder { this.manager = manager; } - private PreparedStatement createStatement(Connection connection, String criteria, List typeIDs, SearchOptions options) throws Exception { - StringBuilder typeCriteria = getTypeCriterias(typeIDs); + private PreparedStatement createStatement(Connection connection, String criteria, SearchOptions options) throws Exception { String criteriasPattern = getCriteriasRegexPattern(criteria); StringBuilder sql = new StringBuilder(); @@ -42,7 +41,6 @@ public class MediaFinder implements IMediaFinder { sql.append("m.length,"); sql.append("m.itemtypeid mediaitemtypeid,"); sql.append(String.format("HIGHLIGHT(md.description, '', '', '%s') description,", criteriasPattern)); - // sql.append("'blabla' description,"); sql.append("it.name mediaitemtypename,"); sql.append("m.houseid mediahouseid,"); sql.append("mf.houseid mediafilehouseid,"); @@ -50,9 +48,18 @@ public class MediaFinder implements IMediaFinder { sql.append(" FROM ITEM i, MEDIA m, MEDIAFILE mf, MEDIADESCRIPTION md, VW_MEDIAFILES vw_mf, ITEMTYPE it"); sql.append(" WHERE i.id = md.itemid AND m.id = md.mediaid AND mf.id = md.mediafileid"); sql.append(" AND m.id=vw_mf.mediaid AND m.itemTypeId = it.id"); - if (typeIDs != null) { + + StringBuilder criteriaForType = options.getCriteriaForType(); + if (criteriaForType != null) { sql.append(" AND m.itemtypeid IN "); - sql.append(typeCriteria.toString()); + sql.append(criteriaForType.toString()); + } + + StringBuilder criteriaForTag = options.getCriteriaForTag(); + if (criteriaForTag != null) { + sql.append(" AND m.id IN (SELECT mediaid FROM MEDIATAGS WHERE tagid IN "); + sql.append(criteriaForTag.toString()); + sql.append(" )"); } if (simpleSearch) { @@ -67,11 +74,11 @@ public class MediaFinder implements IMediaFinder { sql.append(" AND CONTAINS(md.description, '" + criteria + "') >= 1"); } - if (options.getSearchFrom() != null) - sql.append(String.format(" AND m.archived > '%s'", df.format(options.getSearchFrom()))); + if (options.getFrom() != null) + sql.append(String.format(" AND m.archived > '%s'", df.format(options.getFrom()))); - if (options.getSearchTo() != null) - sql.append(String.format(" AND m.archived < '%s'", df.format(options.getSearchTo()))); + if (options.getTo() != null) + sql.append(String.format(" AND m.archived < '%s'", df.format(options.getTo()))); if (options.isMissingProxy()) sql.append(" AND vw_mf.mediafilecount=1"); @@ -124,47 +131,16 @@ public class MediaFinder implements IMediaFinder { return sb.toString(); } - private StringBuilder getTypeCriterias(List typeIDs) { - StringBuilder typeCriteria = new StringBuilder(); - if (typeIDs != null) { - typeCriteria.append("("); - for (int i = 0; i < typeIDs.size(); i++) { - typeCriteria.append(typeIDs.get(i)); - if (i < typeIDs.size() - 1) - typeCriteria.append(","); - } - typeCriteria.append(")"); - } - return typeCriteria; - } - - private List getTypeIDs(List searchFilters) { - List result = null; - if (searchFilters != null) { - for (String typeName : searchFilters) { - ItemType itemType = manager.getItemType(typeName); - if (itemType == null) - continue; - if (result == null) - result = new ArrayList<>(); - result.add(String.valueOf(itemType.getId())); - } - } - return result; - } - @Override public SearchResult search(SearchOptions options) { SearchResult result = new SearchResult<>(); - List typeIDs = getTypeIDs(options.getFilters()); - ResultSet rs = null; PreparedStatement st = null; DefaultContext context = manager.getDbContext(); Connection connection = context.getConnection(); try { - st = createStatement(connection, options.getText(), typeIDs, options); + st = createStatement(connection, options.getText(), options); rs = st.executeQuery(); rs.last(); result.setItemCount(rs.getRow()); @@ -251,36 +227,4 @@ public class MediaFinder implements IMediaFinder { return result; } - // private void setRelevant(String[] criterias, ArchivedMedia am, String content) { - // if (content == null) - // return; - // for (String c : criterias) { - // if (c != null && c.length() > 2) { - // - // int pos = content.toLowerCase().indexOf(c.toLowerCase()); - // if (pos > -1) { - // int start = 0; - // if (pos > 100) - // start = pos - 100; - // else - // start = 0; - // int end = pos + 200; - // if (end > content.length() - 1) - // end = content.length() - 1; - // - // String relevant = content.substring(start, pos) + "" + content.substring(pos, pos + c.length()) + "" - // + content.substring(pos + c.length(), end); - // - // if (start > 0) - // relevant = "..." + relevant; - // if (end < content.length() - 1) - // relevant = relevant + "..."; - // - // am.setRelevant(relevant); - // break; - // } - // - // } - // } - // } } diff --git a/server/user.jobengine.osgi.server/js/searchitems.js b/server/user.jobengine.osgi.server/js/searchitems.js index 2ad9236a..96f83df0 100644 --- a/server/user.jobengine.osgi.server/js/searchitems.js +++ b/server/user.jobengine.osgi.server/js/searchitems.js @@ -4,11 +4,11 @@ var player = videojs('myVideoDiv', { preload : "auto" }); -function setSource(src) { +function setSource(src, srcType) { console.log("setSource", player, src); if (src != null) { player.src({ - type : 'video/mp4', + type : srcType, src : src }); } else { @@ -49,31 +49,61 @@ function pushTcOut() { /* Címke kezelés */ -var input = document.querySelector('textarea[name=tags2]'), tagify = new Tagify( - input, - { - enforceWhitelist : false, - keepInvalidTags : true, - callbacks : { - add : onTag, // callback when adding a tag - remove : onTag - // callback when removing a tag - } - } -); +var mediaTagify = new Tagify(document.querySelector('textarea[name=mediaTags]'), { + enforceWhitelist : false, + keepInvalidTags : true, + callbacks : { + add : onTag, + remove : onTag + } +}); + +var filterTagify = new Tagify(document.querySelector('textarea[name=filterTags]'), { + enforceWhitelist : true, + keepInvalidTags : false, + settings : { + readOnly: true + }, + callbacks : { + add : onFilterTag, + remove : onFilterTag + } +}); -function addTags(tags, current) { - // console.log("Adding tags", tagify, input); - tagify.settings.whitelist = tags; - tagify.addTags(current); +function addAllTags(tags) { + console.log("Adding all tags", tags); + filterTagify.settings.whitelist = tags; + mediaTagify.settings.whitelist = tags; } +function addMediaTags(tags) { + console.log("Clear selected tags"); + mediaTagify.removeAllTags(); + console.log("Adding selected tags", tags); + mediaTagify.addTags(tags); +} + + function onTag(e) { - console.log("onTag", e); - zk.Widget.$('$listenerDiv').fire('onChange', e, { +// console.log("onTag", e); + + zk.Widget.$('$tagListener').fire('onChange',{ + source: 'media', + type : e.type, + tagtext: e.detail.data.value, + index: e.detail.index + },{ toServer : true }); } -function addTags(tags, current) { -} \ No newline at end of file +function onFilterTag(e) { + zk.Widget.$('$tagListener').fire('onChange',{ + source: 'filter', + type : e.type, + tagtext: e.detail.data.value, + index: e.detail.index + },{ + toServer : true + }); +} diff --git a/server/user.jobengine.osgi.server/pages/joblist.zul b/server/user.jobengine.osgi.server/pages/joblist.zul index 0eb013fe..3f9694bc 100644 --- a/server/user.jobengine.osgi.server/pages/joblist.zul +++ b/server/user.jobengine.osgi.server/pages/joblist.zul @@ -44,7 +44,7 @@
- diff --git a/server/user.jobengine.osgi.server/pages/searchitems.zul b/server/user.jobengine.osgi.server/pages/searchitems.zul index c75274b5..013a18bc 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems.zul @@ -25,6 +25,7 @@ document.selection.empty(); } } + @@ -35,9 +36,10 @@
+
- +
diff --git a/server/user.jobengine.osgi.server/pages/searchitems/details.zul b/server/user.jobengine.osgi.server/pages/searchitems/details.zul index e0069a44..c77befaa 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems/details.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems/details.zul @@ -63,10 +63,9 @@
+
- -
- +
diff --git a/server/user.jobengine.osgi.server/pages/searchitems/filters.zul b/server/user.jobengine.osgi.server/pages/searchitems/filters.zul index a2c6163c..53bce9d6 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems/filters.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems/filters.zul @@ -1,4 +1,4 @@ - + @@ -18,6 +18,10 @@ + + + + @@ -59,7 +63,7 @@ - + @@ -92,6 +96,8 @@
+ + diff --git a/server/user.jobengine.osgi.server/pages/searchitems/results.zul b/server/user.jobengine.osgi.server/pages/searchitems/results.zul index 5fd1e537..48146dea 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems/results.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems/results.zul @@ -3,8 +3,8 @@ emptyMessage="Nincs találat!" pageSize="50" onAfterRender="@command('onAfterRenderGrid')" style="border: none; background: white !important;" oddRowSclass="listbox-odd-style"> - Clients.evalJavaScript("clearSelection();"); - + Clients.evalJavaScript("clearSelection();"); + @@ -43,7 +43,7 @@