From: Vásáry Dániel Date: Thu, 15 Nov 2018 20:35:07 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=9b2b202dd31a50941e64eefdc5dfad645410e384;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31342 --- diff --git a/client/Maestro/Configuration/configuration.json b/client/Maestro/Configuration/configuration.json index 6abfefc1..24c4828a 100644 --- a/client/Maestro/Configuration/configuration.json +++ b/client/Maestro/Configuration/configuration.json @@ -20,7 +20,7 @@ { "$type": "OctopusMetadata", "server": { - "address": "http://10.10.1.27/services/rest/octopus", + "address": "http://localhost:8888/services/rest/octopus", "timeout": 1000 } }, @@ -46,7 +46,7 @@ "targets": [ { "label": "Teszt", - "processor": "FXPTargetProcessor", + "processor": "FTPTargetProcessor", "outputFormat": "%ID%-%SOURCENAME%", "tag": "Betöltés", "killDateDays": 7, diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index e2b56137..c5b8876d 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -1,17 +1,17 @@ using Maestro.Metadata; +using MaestroShared.Commons; +using MaestroShared.Configuration; +using MaestroShared.Metadata; +using MaestroShared.Model; +using MaestroShared.Targets; +using MediaCubeClient; using OctopusClient; -using System.Linq; using System; -using System.Windows.Forms; -using TrafficClient; using System.Collections.Generic; using System.ComponentModel; -using MediaCubeClient; -using MaestroShared.Configuration; -using MaestroShared.Metadata; -using MaestroShared.Targets; -using MaestroShared.Commons; -using MaestroShared.Model; +using System.Linq; +using System.Windows.Forms; +using TrafficClient; namespace Maestro { public partial class MaestroForm { @@ -40,7 +40,7 @@ namespace Maestro { get => archiveMetadata; set { archiveMetadata = value; - btnEditMetadata.ToolTipText = archiveMetadata == null ? "Metaadat" :archiveMetadata.ToString(); + btnEditMetadata.ToolTipText = archiveMetadata == null ? "Metaadat" : archiveMetadata.ToString(); } } @@ -201,6 +201,10 @@ namespace Maestro { case MetadataType.OctopusStory: case MetadataType.OctopusPlaceHolder: result = GetOctopusMetadata(metadataType); + if (result == null) { + MsgBox.Error("A metaadatok lekérdezése nem lehetséges!"); + result = new ArchiveMetadata(); + } result.mediaType = "Hír nyers"; break; case MetadataType.TrafficMaterial: @@ -274,7 +278,7 @@ namespace Maestro { result.itemTitle = actualResult.ProgTitle; result.itemDescription = actualResult.ProgDescription; result.mediaHouseId = actualResult.EpisodeID; - result.mediaTitle = !String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle; + result.mediaTitle = !string.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle; result.mediaDescription = actualResult.EpisodeDescription; result.ok = actualResult.OK; return result; diff --git a/client/OctopusClient/OctopusAPI.cs b/client/OctopusClient/OctopusAPI.cs index 65c242e5..7e850255 100644 --- a/client/OctopusClient/OctopusAPI.cs +++ b/client/OctopusClient/OctopusAPI.cs @@ -105,8 +105,7 @@ namespace OctopusClient { return null; JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => ToRundown(d)); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -122,8 +121,7 @@ namespace OctopusClient { return null; JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => ToRundown(d)); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -139,8 +137,7 @@ namespace OctopusClient { return null; JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => ToRundown(d)); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -162,8 +159,7 @@ namespace OctopusClient { }).OrderBy(r => { return r.ID; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -185,8 +181,7 @@ namespace OctopusClient { }).OrderBy(r => { return r.ID; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -206,8 +201,7 @@ namespace OctopusClient { //logger.Debug($"{r}"); return r; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -229,8 +223,7 @@ namespace OctopusClient { }).OrderBy(r => { return r.ID; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -249,8 +242,7 @@ namespace OctopusClient { //logger.Debug($"{r}"); return r; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -270,8 +262,7 @@ namespace OctopusClient { //logger.Debug($"{r}"); return r; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -295,8 +286,7 @@ namespace OctopusClient { //logger.Debug($"{r}"); return r; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; @@ -318,20 +308,19 @@ namespace OctopusClient { }).OrderBy(r => { return r.ID; }); - } - catch (Exception e) { + } catch (Exception e) { OnError(e); } return result; } private bool CheckResponse(IRestResponse response) { + if (response.ErrorException != null) + throw new Exception(response.ErrorMessage); if (String.IsNullOrEmpty(response.Content)) return false; //if (response.ContentLength != 0) // return false; - if (response.ErrorException != null) - throw new Exception(response.ErrorMessage); else return true; } @@ -383,54 +372,36 @@ namespace OctopusClient { } private static Story ToRundownStory(JToken d, string id) { - Story result = ToPartialStory(d); + Story result = ToStory(d); result.Position = result.Rundowns.Where(r => id.Equals(r.ID)).FirstOrDefault()?.StoryPosition; return result; } private static Story ToStoryFolderStory(JToken d, string id) { - Story result = ToPartialStory(d); + Story result = ToStory(d); result.Position = result.StoryFolders.Where(r => id.Equals(r.ID)).FirstOrDefault()?.StoryPosition; return result; } - private static Story ToPartialStory(JToken d) { - Story result = new Story { - ID = d[ID]?.ToString(), - ParentStoryID = d["parentStoryId"]?.ToString(), - Name = d["name"]?.ToString() ?? UNNAMED, - Format = d["format"]?.ToString(), - Script = d["script"]?.ToString(), - ScriptContent = d["script_content"]?.ToString(), - MosObjects = GetMosObjectsFromStory(d)?.ToArray(), - StoryFolders = GetPartialStoryFolderFromStory(d)?.ToArray(), - Rundowns = GetPartialRundownFromStory(d)?.ToArray() - }; - - return result; - } - private static Story ToStory(JToken d) { - Story result = new Story { - ID = d[ID]?.ToString(), - ParentStoryID = d["parentStoryId"]?.ToString(), - Name = d["name"]?.ToString() ?? UNNAMED, - Format = d["format"]?.ToString(), - Script = d["script"]?.ToString(), - ScriptContent = d["script_content"]?.ToString(), - MosObjects = GetMosObjectsFromStory(d)?.ToArray(), - StoryFolders = GetStoryFolderFromStory(d)?.ToArray(), - Rundowns = GetRundownFromStory(d)?.ToArray() - }; + Story result = new Story(); + result.ID = d[ID]?.ToString(); + result.ParentStoryID = d["parentStoryId"]?.ToString(); + result.Name = d["name"]?.ToString() ?? UNNAMED; + result.Format = d["format"]?.ToString(); + result.Script = d["script"]?.ToString(); + result.ScriptContent = d["script_content"]?.ToString(); + result.MosObjects = GetMosObjectsFromStory(d)?.ToArray(); + result.StoryFolders = GetStoryFolderFromStory(d)?.ToArray(); + result.Rundowns = GetRundownFromStory(d)?.ToArray(); return result; } private static Rundown ToRundown(JToken d) { - Rundown result = new Rundown { - ID = d[ID].ToString(), - Name = d["name"]?.ToString() ?? UNNAMED, - Start = DateTime.Parse(d["scheduledStart"]?.ToString()), - }; + Rundown result = new Rundown(); + result.ID = d[ID].ToString(); + result.Name = d["name"]?.ToString() ?? UNNAMED; + result.Start = d["scheduledStart"] == null ? DateTime.MinValue : DateTime.Parse(d["scheduledStart"].ToString()); if (result.Start == null) result.FormattedStart = "?"; else diff --git a/client/OctopusClient/Properties/AssemblyInfo.cs b/client/OctopusClient/Properties/AssemblyInfo.cs index ca8e1297..4b934f8d 100644 --- a/client/OctopusClient/Properties/AssemblyInfo.cs +++ b/client/OctopusClient/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Support.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Support.java index 936ba862..bb610fc8 100644 --- a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Support.java +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Support.java @@ -3,13 +3,21 @@ package hu.user.mediacube.executors.tests; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import java.io.File; +import java.nio.file.Files; +import java.nio.file.attribute.BasicFileAttributes; +import java.sql.Timestamp; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import user.commons.logging.LogUtils; import user.jobengine.db.IItemManager; +import user.jobengine.db.Item; import user.jobengine.db.ItemManager; +import user.jobengine.db.Media; +import user.jobengine.db.MediaFile; import user.jobengine.server.steps.PlanAirExtensions; public class Support { @@ -49,4 +57,24 @@ public class Support { assertNotNull(actual); assertTrue(actual.length() > 0); } + + @Test + public void test1() throws Exception { + File sourceFile = new File("c:\\thumbnail - generali\\ShellExtractLoadTest.exe"); + BasicFileAttributes attr = Files.readAttributes(sourceFile.toPath(), BasicFileAttributes.class); + Timestamp timestamp = new Timestamp(attr.creationTime().toMillis()); + System.out.println(timestamp); + } + + @Test + public void test2() throws Exception { + Item i = manager.createItem("Generic", "Trigger teszt", "itemdesc1", "itemhouseid1"); + Media m = manager.createMedia("Generic", "mediatitle1", "mediadesc1", "mediahouseid1"); + i.appendMedia(m); + MediaFile mf = manager.createMediaFile("filename1", manager.getFileType("High-res"), manager.getSystemStore(false), m); + m.appendMediaFile(mf); + manager.mergeItemStructure(i); + + System.out.println("itemid=" + i.getId() + " AND mediaid=" + m.getId() + " AND mediafileid=" + mf.getId()); + } } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/CopyForArchiveNEXIORecordingsStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/CopyForArchiveNEXIORecordingsStep.java index 6bd36918..1aaa8e10 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/CopyForArchiveNEXIORecordingsStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/CopyForArchiveNEXIORecordingsStep.java @@ -212,41 +212,41 @@ public class CopyForArchiveNEXIORecordingsStep extends JobStep { e.getMessage()); return null; } - - if (clipName.startsWith("1900_")) { - String clipNameNext = clipName.replace("1900_", "1908_"); - scheduledStart = getScheduledStart(clipNameNext, recordDate); - rundown = octopusAPI.getRundown(scheduledStart); - if (rundown == null) { - Calendar calendar = CalendarUtils.createCalendar(scheduledStart); - int dow = calendar.get(Calendar.DAY_OF_WEEK); - if (dow == Calendar.SATURDAY || dow == Calendar.SUNDAY) { - logger.info(systemMarker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, de a hétvégi kivétel miatt archiválható.", clipName, - scheduledStart); - return result; - } else { - logger.error(systemMarker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, ezért nem archiválható.", clipName, scheduledStart); - return null; + /* + if (clipName.startsWith("1900_")) { + String clipNameNext = clipName.replace("1900_", "1908_"); + scheduledStart = getScheduledStart(clipNameNext, recordDate); + rundown = octopusAPI.getRundown(scheduledStart); + if (rundown == null) { + Calendar calendar = CalendarUtils.createCalendar(scheduledStart); + int dow = calendar.get(Calendar.DAY_OF_WEEK); + if (dow == Calendar.SATURDAY || dow == Calendar.SUNDAY) { + logger.info(systemMarker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, de a hétvégi kivétel miatt archiválható.", clipName, + scheduledStart); + return result; + } else { + logger.error(systemMarker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, ezért nem archiválható.", clipName, scheduledStart); + return null; + } + } + + RundownArchive item2 = null; + + try { + item2 = processRundow(rundown, clipName, duration); + } catch (Exception e) { + logger.catching(e); + logger.error(systemMarker, "A '{}' anyag metaadatainak transzformálása sikertelen, ezért az nem archiválható. A rendszer hibaüzenete: {}", + e.getMessage()); + return null; + } + + result.setItemTitle(result.getItemTitle() + " + NAPIAKT"); + StoryArchive storyArchive = result.getStoryArchives().get(0); + StoryArchive storyArchive2 = item2.getStoryArchives().get(0); + storyArchive.setMediaDesc(storyArchive.getMediaDesc() + "\r\n\r\n****** NAPIAKT ******\r\n\r\n" + storyArchive2.getMediaDesc()); } - } - - RundownArchive item2 = null; - - try { - item2 = processRundow(rundown, clipName, duration); - } catch (Exception e) { - logger.catching(e); - logger.error(systemMarker, "A '{}' anyag metaadatainak transzformálása sikertelen, ezért az nem archiválható. A rendszer hibaüzenete: {}", - e.getMessage()); - return null; - } - - result.setItemTitle(result.getItemTitle() + " + NAPIAKT"); - StoryArchive storyArchive = result.getStoryArchives().get(0); - StoryArchive storyArchive2 = item2.getStoryArchives().get(0); - storyArchive.setMediaDesc(storyArchive.getMediaDesc() + "\r\n\r\n****** NAPIAKT ******\r\n\r\n" + storyArchive2.getMediaDesc()); - } - + */ return result; } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java index a891452b..71ad952e 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java @@ -2,6 +2,8 @@ package user.jobengine.server.steps; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.attribute.BasicFileAttributes; import java.sql.Timestamp; import java.util.Date; import java.util.List; @@ -92,7 +94,7 @@ public class TSMBackupStep extends JobStep { "Az '{}' állomány .catched jelző állománya nem törölhető. Az újabb archiválási kísérlethez annak kézi eltávolítása szükséges!", sourceMediaFile.getName()); } else { - saveMetadata(mediaCubeMedia, sourceFileName, existingMediaId); + saveMetadata(mediaCubeMedia, sourceMediaFile, existingMediaId); logger.info(marker, "Az '{}' archiválása sikeres.", sourceFileName); if (killDateDays > 0) EscortFiles.createUNCKillDate(sourceMediaFile.getParent(), sourceFileName, killDateDays, marker); @@ -111,11 +113,11 @@ public class TSMBackupStep extends JobStep { return null; } - private void saveMetadata(Media mediaCubeMedia, String sourceFileName, long existingMediaId) { + private void saveMetadata(Media mediaCubeMedia, File sourceFile, long existingMediaId) { if (existingMediaId == 0) { - MediaFile mediaFile = manager.createMediaFile(sourceFileName, fileType, tsmStore, mediaCubeMedia); - mediaFile.setHouseId(sourceFileName); + MediaFile mediaFile = manager.createMediaFile(sourceFile.getName(), fileType, tsmStore, mediaCubeMedia); + mediaFile.setHouseId(sourceFile.getName()); mediaFile.add(); } else { Media existingMedia = manager.getMedia(existingMediaId); @@ -130,7 +132,15 @@ public class TSMBackupStep extends JobStep { } } mediaCubeMedia.setPersister(manager); - mediaCubeMedia.setArchived(new Timestamp(new Date().getTime())); + + try { + BasicFileAttributes attr = Files.readAttributes(sourceFile.toPath(), BasicFileAttributes.class); + mediaCubeMedia.setArchived(new Timestamp(attr.creationTime().toMillis())); + } catch (IOException e) { + logger.catching(e); + mediaCubeMedia.setArchived(new Timestamp(new Date().getTime())); + } + mediaCubeMedia.modify(); }