{\r
"title": "Lebony betöltő",\r
- "active": false,\r
+ "active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"player": {\r
<None Include="Configuration\-configuration-playout-ingest.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
- <None Include="Configuration\configuration-tqc-check.json">\r
+ <None Include="Configuration\-configuration-tqc-check.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
<None Include="Connected Services\packages.config" />\r
<None Include="Configuration\-configuration-sxs.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
- <None Include="Configuration\-configuration-studio.json">\r
+ <None Include="Configuration\configuration-studio.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
</ItemGroup>\r
using MaestroShared.Configuration;\r
using MaestroShared.Metadata;\r
using MaestroShared.Targets;\r
+using MaestroShared.Commons;\r
\r
namespace Maestro {\r
public partial class MaestroForm {\r
return;\r
Cursor = Cursors.WaitCursor;\r
if (movieSegments == null || movieSegments.Count == 0)\r
- QuerySegments();\r
+ movieSegments = QuerySegments();\r
if (movieSegments == null)\r
movieSegments = new BindingList<MovieSegment>();\r
- OpenFile(SelectedSource.FileInfo, true);\r
+ bool readOnly = true;\r
+ if (archiveMetadata == null)\r
+ MsgBox.Error("A metaadatok nem elérhetők, a szegmens definiálás nem engedélyezett.");\r
+ else {\r
+ readOnly = archiveMetadata.ok;\r
+ MsgBox.Warning("Az anyag már el van fogadva, a szegmens módosítás nem kerül mentésre. A szegmensek módosításához vissza kell vonni az anyag elfogadását az adástervező rendszerben.");\r
+ }\r
+ OpenFile(SelectedSource.FileInfo, true, readOnly);\r
UpdateDefineSegmentsStatus();\r
}\r
\r
- private void QuerySegments() {\r
+ private BindingList<MovieSegment> QuerySegments() {\r
+ BindingList<MovieSegment> result = null;\r
List<MovieSegment> storedSegments = GetSegments();\r
if (storedSegments != null && storedSegments.Count > 0)\r
- movieSegments = new BindingList<MovieSegment>(storedSegments);\r
+ result = new BindingList<MovieSegment>(storedSegments);\r
+ return result;\r
}\r
\r
private void UpdateDefineSegmentsStatus() {\r
result.mediaHouseId = actualResult.EpisodeID;\r
result.mediaTitle = !String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle;\r
result.mediaDescription = actualResult.EpisodeDescription;\r
+ result.ok = actualResult.OK;\r
return result;\r
}\r
\r
}\r
}\r
\r
- movieSegments = null;\r
- archiveMetadata = null;\r
+ switch (SelectedMetadata?.Kind) {\r
+ case MetadataType.OctopusStory:\r
+ case MetadataType.OctopusPlaceHolder:\r
+ archiveMetadata = GetArchiveMetadata();\r
+ break;\r
+ case MetadataType.TrafficAD:\r
+ case MetadataType.TrafficMaterial:\r
+ case MetadataType.TrafficPromo:\r
+ archiveMetadata = GetArchiveMetadata();\r
+ movieSegments = null;\r
+ movieSegments = QuerySegments();\r
+ break;\r
+ default:\r
+ movieSegments = null;\r
+ archiveMetadata = null;\r
+ break;\r
+ }\r
\r
UpdateProcessorButtonsEnabled();\r
UpdateDefineSegmentEnabled();\r
if (fileSourceItem == null)\r
return;\r
dgSource.Enabled = false;\r
- OpenFile(fileSourceItem.FileInfo, false);\r
+ OpenFile(fileSourceItem.FileInfo, false, false);\r
dgSource.Enabled = true;\r
}\r
}\r
\r
- private void OpenFile(FileInfo fileInfo, bool segmentEditor) {\r
+ private void OpenFile(FileInfo fileInfo, bool segmentEditor, bool readOnly) {\r
Cursor = Cursors.WaitCursor;\r
try {\r
string[] extensions = Configuration.Player?.Extensions;\r
// You can specify all the values or you can default the Build and Revision Numbers\r
// by using the '*' as shown below:\r
// [assembly: AssemblyVersion("1.0.*")]\r
-[assembly: AssemblyVersion("2.0.6.1")]\r
-[assembly: AssemblyFileVersion("2.0.6.1")]\r
+[assembly: AssemblyVersion("2.0.6.2")]\r
+[assembly: AssemblyFileVersion("2.0.6.2")]\r
public string mediaHouseId { get; set; }\r
public string mediaTitle { get; set; }\r
public string mediaDescription { get; set; }\r
+ public bool ok { get; set; }\r
\r
public override string ToString() {\r
return JsonConvert.SerializeObject(this);\r
\r
private bool DeleteExisting(string currentFile) {\r
bool result = true;\r
- if (FileExists(currentFile) && (Parameters.TargetConfig.DisableFileVersioning || Parameters.TargetConfig.EnableOverride)) {\r
+ if (FileExists(currentFile) && (Parameters.TargetConfig.DisableFileVersioning || Parameters.TargetConfig.EnableOverride || Parameters.ArchiveMetadata.ok)) {\r
if (Parameters.TargetConfig.NexioServer) {\r
Status = REVOKED;\r
ShowNexioFileExistsMessage();\r
result = false;\r
} else {\r
- if (Parameters.TargetConfig.EnableOverride)\r
- DeleteFile(currentFile);\r
+ if (Parameters.TargetConfig.EnableOverride) {\r
+ if (Parameters.ArchiveMetadata.ok) {\r
+ Message = "A célállomány már létezik és el van fogadva, felülírása nem lehetséges.";\r
+ result = false;\r
+ return false;\r
+ } else \r
+ DeleteFile(currentFile);\r
+ }\r
else {\r
- Status = SKIPPED;\r
Message = "A célállomány létezik, felülírása a konfiuráció alapján nem lehetséges.";\r
result = false;\r
+ result = false;\r
}\r
}\r
}\r
public string EpisodeTitle { get; set; }\r
public string EpisodeDescription { get; set; }\r
public string EpisodeID { get; set; }\r
+ public bool OK { get; set; }\r
}\r
\r
public class TrafficAPIMessage : IMessage {\r
EpisodeTitle = data.v_EpTitle,\r
ProgID = data.v_ProgrammeID.ToString(),\r
ProgTitle = data.v_ProgTitle,\r
+ OK = data.v_OkForAir != null && true.Equals(data.v_OkForAir)\r
};\r
}\r
\r
<Loggers>\r
<Root level="INFO">\r
<AppenderRef ref="Console" />\r
-<!-- <AppenderRef ref="MarkeredConsole" /> -->\r
+ <AppenderRef ref="MarkeredConsole" />\r
<!-- <AppenderRef ref="RollingFile" /> -->\r
<!-- <AppenderRef ref="MarkeredMail" /> -->\r
</Root>\r
"executeimmediate": true,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
- {"name": "sourcePath", "value": "\\\\10.10.1.100\\BRAAVOS\\ARCHIVE", "type": "java.lang.String"},\r
- {"name": "userName", "value": "mediacube", "type": "java.lang.String"},\r
- {"name": "password", "value": "Broadca5T", "type": "java.lang.String"}\r
+ {"name": "sourcePath", "value": "o:\\_OLD", "type": "java.lang.String"}\r
]\r
}, \r
{\r
]\r
}, \r
{\r
- "active": true,\r
+ "active": false,\r
"name" : "OCTOPUS adatok teljes szinkronizálása",\r
"template": "sync-octopus.xml",\r
"executeimmediate": true,\r
org.apache.logging.log4j.api;bundle-version="2.8.2"
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.apache.commons.io;version="2.2.0"
<executor className="user.jobengine.server.steps.ArchiveListBuilderStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.CheckTRAFFICMissingMaterialsStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.CheckMORPHEUSMissingMaterialsStep" maxConcurrent="1"/>\r
- <executor className="user.jobengine.server.steps.DeleteMaterialsStep" maxConcurrent="1"/>\r
+ <executor className="user.jobengine.server.steps.CleanupMountedLocationStep" maxConcurrent="10"/>\r
<executor className="user.jobengine.server.steps.DeleteNEXIOMaterialsStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.MetadataTransformStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.SyncOCTOPUSDataStep" maxConcurrent="1"/>\r
<declarations>\r
<parameters>\r
<parameter name="sourcePath" type="java.lang.String"/>\r
- <parameter name="userName" type="java.lang.String"/>\r
- <parameter name="password" type="java.lang.String"/>\r
</parameters>\r
</declarations>\r
<commands>\r
- <calljobstep id="id1" type="user.jobengine.server.steps.DeleteMaterialsStep" weight="1">\r
+ <calljobstep id="id1" type="user.jobengine.server.steps.CleanupMountedLocationStep" weight="1">\r
<inputs>\r
<input>\r
<parameter name="sourcePath" />\r
</input>\r
- <input>\r
- <parameter name="userName" />\r
- </input>\r
- <input>\r
- <parameter name="password" />\r
- </input>\r
</inputs>\r
</calljobstep>\r
</commands>\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.nio.file.DirectoryStream;\r
+import java.nio.file.FileVisitResult;\r
+import java.nio.file.FileVisitor;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+import java.nio.file.SimpleFileVisitor;\r
+import java.nio.file.attribute.BasicFileAttributes;\r
+import java.text.ParseException;\r
+import java.text.SimpleDateFormat;\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.Date;\r
+import java.util.List;\r
+\r
+import org.apache.commons.io.FileUtils;\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class CleanupMountedLocationStep extends JobStep implements FileVisitor<Path> {\r
+\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private static final String PROJECTFOLDER = "PROJECT";\r
+ private static final String DATEFORMAT = "yyyyMMdd";\r
+ private static final String DOT = ".";\r
+ private static final String STATUSFOLDER = ".STATUS";\r
+ private static final String EWC2EXT = ".ewc2";\r
+ private static final String CATCHEDEXT = ".catched";\r
+ private static final String KILLDATEEXT = ".killdate";\r
+ private static final String JSONEXT = ".json";\r
+\r
+ private static boolean isEmpty(final Path directory) throws IOException {\r
+ try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(directory)) {\r
+ final int[] count = { 0 };\r
+ final int[] specialCount = { 0 };\r
+ dirStream.forEach(p -> {\r
+ count[0]++;\r
+ if (p.getFileName().toString().toLowerCase().equals(PROJECTFOLDER.toLowerCase()))\r
+ specialCount[0]++;\r
+ if (p.getFileName().toString().toLowerCase().equals(STATUSFOLDER.toLowerCase()))\r
+ specialCount[0]++;\r
+\r
+ });\r
+ if (specialCount[0] == count[0])\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ final int[] allCount = { 0 };\r
+ final int[] currentCount = { 0 };\r
+\r
+ private Path sourcePath;\r
+ private SimpleDateFormat dateFormat;\r
+\r
+ private Date checkExpiration(List<Path> killDateFiles) {\r
+ Date killDate = null;\r
+ for (Path killDateFile : killDateFiles) {\r
+ Date currentKillDate = getKillDate(killDateFile);\r
+ if (currentKillDate == null)\r
+ continue;\r
+ if ((killDate != null && currentKillDate.after(killDate)) || killDate == null)\r
+ killDate = currentKillDate;\r
+ }\r
+ return new Date().after(killDate) ? killDate : null;\r
+ }\r
+\r
+ @StepEntry\r
+ public Object[] execute(String sourceFolder, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+ sourcePath = Paths.get(sourceFolder);\r
+ DirectoryStream<Path> directoryStream = null;\r
+ if (StringUtils.isBlank(sourcePath.toString())) {\r
+ logger.error(getMarker(), "A folyamat 'sourcePath' bemeneti paramétere üres.");\r
+ throw new NullPointerException("System is not configured properly, 'sourceFolder' input parameter missing.");\r
+ }\r
+\r
+ if (!sourcePath.toFile().exists() || !sourcePath.toFile().isDirectory()) {\r
+ logger.error(getMarker(), "A {} mappa nem létezik.", sourceFolder);\r
+ throw new NullPointerException(String.format("Directory %s not exists.", sourceFolder));\r
+ }\r
+ try {\r
+ setProgress(1);\r
+ dateFormat = new SimpleDateFormat(DATEFORMAT);\r
+ Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() {\r
+ @Override\r
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {\r
+ allCount[0]++;\r
+ return super.visitFile(file, attrs);\r
+ }\r
+ });\r
+ Files.walkFileTree(sourcePath, this);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(getMarker(), "Az '{}' mappa elérése sikertelen. A rendszer hibaüzenete: {}", sourcePath, e.getMessage());\r
+ throw e;\r
+ } finally {\r
+ if (directoryStream != null) {\r
+ try {\r
+ directoryStream.close();\r
+ } catch (IOException e) {\r
+ }\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ private Date getKillDate(Path killDateFile) {\r
+ String fileName = killDateFile.getFileName().toString();\r
+ int end = fileName.lastIndexOf(DOT);\r
+ if (end < 1)\r
+ return null;\r
+ int start = fileName.lastIndexOf(DOT, end - 1);\r
+ if (start < 0)\r
+ return null;\r
+ String strKillDate = fileName.substring(start + 1, end);\r
+ Date result = null;\r
+ if (StringUtils.isNumeric(strKillDate)) {\r
+ try {\r
+ result = dateFormat.parse(strKillDate);\r
+ } catch (ParseException e) {\r
+ logger.error(getMarker(), "A {} fájl 'killdate' állománya hibás formátumú, a {} karaktersorozat nem konvertálható dátummá.", fileName,\r
+ strKillDate);\r
+ return null;\r
+ }\r
+ } else\r
+ logger.error(getMarker(), "A {} fájl 'killdate' állománya hibás formátumú, az dátum helyett ez áll: '{}'.", fileName, strKillDate);\r
+ return result;\r
+ }\r
+\r
+ private List<Path> getKillDateFiles(Path filePath) {\r
+ String killDateFilePattern = String.format("%s.*%s", filePath.getFileName().toString(), KILLDATEEXT);\r
+ List<Path> result = new ArrayList<>();\r
+ Path statusPath = Paths.get(filePath.getParent().toString(), STATUSFOLDER);\r
+ File statusPathFile = statusPath.toFile();\r
+ if (statusPathFile.exists() && statusPathFile.isDirectory()) {\r
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(statusPath, killDateFilePattern)) {\r
+ stream.forEach(p -> result.add(p));\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ }\r
+ }\r
+ Collections.sort(result);\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {\r
+ if (!dir.equals(sourcePath) && isEmpty(dir)) {\r
+ if (!removeExistingSpecialDirectory(dir, PROJECTFOLDER))\r
+ return FileVisitResult.CONTINUE;\r
+ if (!removeExistingSpecialDirectory(dir, STATUSFOLDER))\r
+ return FileVisitResult.CONTINUE;\r
+ if (removeFile(dir))\r
+ logger.info(getMarker(), "A {} üres mappa törlése sikeres.", dir);\r
+\r
+ }\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+\r
+ private void processPathItem(Path filePath) {\r
+ currentCount[0]++;\r
+\r
+ setProgress(currentCount[0] * 100 / allCount[0]);\r
+\r
+ logger.debug("Checking {}", filePath);\r
+ List<Path> killDateFiles = getKillDateFiles(filePath);\r
+ if (killDateFiles.size() == 0)\r
+ return;\r
+\r
+ if (killDateFiles.size() != 1)\r
+ logger.warn(getMarker(), "A {} fájlhoz több 'killdate' állomány található, a legújabb dátum határozza meg a törlés időpontját.", filePath);\r
+\r
+ Date killDate = checkExpiration(killDateFiles);\r
+ if (killDate == null)\r
+ return;\r
+\r
+ if (removeFiles(filePath, killDateFiles))\r
+ logger.info(getMarker(), "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján sikeresen törlődtek.", filePath.getFileName(),\r
+ dateFormat.format(killDate));\r
+ else\r
+ logger.warn(getMarker(), "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján csak részlegesen vagy egyáltalán nem törlődtek.",\r
+ filePath.getFileName(), dateFormat.format(killDate));\r
+ }\r
+\r
+ private boolean removeExistingSpecialDirectory(Path dir, String folderName) throws IOException {\r
+ File projectPath = Paths.get(dir.toString(), folderName).toFile();\r
+ if (projectPath.exists() && projectPath.isDirectory()) {\r
+ FileUtils.deleteDirectory(projectPath);\r
+ if (projectPath.exists()) {\r
+ logger.warn(getMarker(), "A {} alatti {} mappa törlése nem sikerült.", dir, folderName);\r
+ return false;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+\r
+ private boolean removeFile(Path filePath) {\r
+ boolean result = false;\r
+ try {\r
+ //logger.error("REMOVE {}", filePath);\r
+ File file = filePath.toFile();\r
+ if (file.exists())\r
+ result = file.delete();\r
+ } catch (Exception e) {\r
+ logger.error(getMarker(), "A {} fájl nem törölhető. A rendszer hibaüzenete: {}", filePath, e.getMessage());\r
+ }\r
+ return result;\r
+ }\r
+\r
+ private boolean removeFiles(Path filePath, List<Path> killDateFiles) {\r
+ if (!removeFile(filePath))\r
+ return false;\r
+\r
+ removeFile(Paths.get(filePath.toString() + EWC2EXT));\r
+ removeFile(Paths.get(Paths.get(filePath.getParent().toString(), STATUSFOLDER, filePath.getFileName().toString()) + CATCHEDEXT));\r
+ removeFile(Paths.get(Paths.get(filePath.getParent().toString(), STATUSFOLDER, filePath.getFileName().toString()) + JSONEXT));\r
+\r
+ boolean result = true;\r
+ for (Path killDateFile : killDateFiles) {\r
+ if (removeFile(killDateFile))\r
+ result = false;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {\r
+ processPathItem(file);\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult visitFileFailed(Path file, IOException e) throws IOException {\r
+ logger.error(getMarker(), "A {} fájl nem érhető el. A rendszer hibaüzenete: {}", file.toString(), e.getMessage());\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+}\r
logger.error(getMarker(), "A folyamat 'sourceFolder' bemeneti paramétere üres.");\r
throw new NullPointerException("System is not configured properly, 'sourceFolder' input parameter missing.");\r
}\r
+\r
IItemManager manager = jobEngine.getItemManager();\r
sourceUri = manager.createStoreUri(RemoteStoreProtocol.SMB, sourceFolder);\r
sourceUri.setUserName(userName);\r
logger.debug("clipEventPerformed clip: {} {}", evt.getClip().getId(), fileName);\r
//cache???\r
\r
- HashMap<String, BasicDBObject> clipsForId = new HashMap<String, BasicDBObject>();\r
- Map<String, BasicDBObject> clipsForXID = loadClipsFromMongo(clipsForId);\r
- saveClipIntoMongo(jsClip, clipsForXID, clipsForId);\r
+ // HashMap<String, BasicDBObject> clipsForId = new HashMap<String, BasicDBObject>();\r
+ // Map<String, BasicDBObject> clipsForXID = loadClipsFromMongo(clipsForId);\r
+ saveClipIntoMongo(jsClip);\r
} else {\r
logger.debug("clipEventPerformed clip: {}", evt.getClip() == null ? "null" : evt.getClip().getId());\r
}\r
*/\r
private void copyClipsIntoMongo() throws Exception {\r
logger.info("Starting initial NEXIO metadata import.");\r
- Map<String, BasicDBObject> emptyMap = new HashMap<String, BasicDBObject>();\r
+ // Map<String, BasicDBObject> emptyMap = new HashMap<String, BasicDBObject>();\r
Iterator<Clip> clips = controller.getMediabase().getClips();\r
while (clips.hasNext()) {\r
Clip clip = null;\r
int duration = jsonClip.getInt(DURATION);\r
if (fileName != null && !"".equals(fileName)) {\r
logger.debug("Found NEXIO clip: {} duration: {} agency: {}", fileName, duration, agency);\r
- this.saveClipIntoMongo(jsonClip, emptyMap, emptyMap);\r
+ this.saveClipIntoMongo(jsonClip);\r
} else {\r
logger.debug("Found NEXIO clip: {} XID IS MISSING!!", clip.getId());\r
}\r
}\r
\r
/*\r
- \r
+\r
int c = connection.read(buffer, 0, 2);\r
//2 bytes hosszan az idokozben hozzaadott id-k szamossaga\r
if (c < 2) {\r
throw new ProtocolException("c, 2, 2");\r
}\r
//MSB, LSB\r
- \r
+\r
return nofIds;\r
*/\r
return ret;\r
progressListenerList.remove(IProgressEventListener.class, listener);\r
}\r
\r
- private void saveClipIntoMongo(BasicDBObject clip, Map<String, BasicDBObject> clipsForXID, Map<String, BasicDBObject> clipsForID) {\r
+ private void saveClipIntoMongo(BasicDBObject clip) {\r
DBCollection collection = db.getCollection(CLIP_COLLECTION_NAME);\r
String xid = clip.getString(LONGNAMEID);\r
String id = clip.getString(ID);\r
\r
- BasicDBObject clipForXID = clipsForXID.get(xid);\r
- BasicDBObject clipForID = clipsForID.get(id);\r
+ BasicDBObject clipForXID = (BasicDBObject) collection.findOne(new BasicDBObject(LONGNAMEID, xid));\r
+ BasicDBObject clipForID = (BasicDBObject) collection.findOne(new BasicDBObject(ID, id));\r
\r
//rename-nel a clipForXID null lesz de a clipForID nem ezert nem kell create\r
if (clipForXID == null && clipForID == null) {\r
FOLDER_COLLECTION = IOctopusAPI.FOLDER_COLLECTION + _TMP;\r
STORY_COLLECTION = IOctopusAPI.STORY_COLLECTION + _TMP;\r
\r
- logger.info("Fetch rundowns");\r
+ // ResteasyWebTarget target = webTarget.path(RUNDOWN);\r
+ // Builder result = target.request().header(OCTOPUS_DEVICE_ID, apiUser).header(OCTOPUS_DEVICE_NAME, apiPwd);\r
+ // Response r = result.get();\r
+ // String x = r.readEntity(String.class);\r
+ // logger.info(x);\r
+ // return;\r
\r
- ResteasyWebTarget target = webTarget.path(RUNDOWN);\r
- Builder result = target.request().header(OCTOPUS_DEVICE_ID, apiUser).header(OCTOPUS_DEVICE_NAME, apiPwd);\r
- Response r = result.get();\r
- String x = r.readEntity(String.class);\r
- logger.info(x);\r
- return;\r
- // BasicDBList rundowns = queryRundowns();\r
- // logger.info("Fetch rundown story references");\r
- // storyRundowns = buildRundownReferences(rundowns);\r
- // logger.info("Fetch story folders");\r
- // BasicDBList storyFolders = queryStoryFolders();\r
- // logger.info("Fetch folder story references");\r
- // storyStoryFolders = buildFolderReferences(storyFolders);\r
- //\r
- // if (rundowns == null || rundowns.size() == 0) {\r
- // progressEvent.setProgress(50);\r
- // fireProgressEvent(progressEvent);\r
- // } else {\r
- // logger.info("Process rundowns");\r
- // storeRundowns(rundowns, null);\r
- // }\r
- //\r
- // if (storyFolders == null || storyFolders.size() == 0) {\r
- // progressEvent.setProgress(100);\r
- // fireProgressEvent(progressEvent);\r
- // } else {\r
- // logger.info("Process story folders");\r
- // storeStoryFolders(storyFolders, null);\r
- // }\r
- // setLastUpdateTime(new Date());\r
- // logger.info("Activate");\r
- // db.getCollection(RUNDOWN_COLLECTION).rename(IOctopusAPI.RUNDOWN_COLLECTION, true);\r
- // db.getCollection(FOLDER_COLLECTION).rename(IOctopusAPI.FOLDER_COLLECTION, true);\r
- // db.getCollection(STORY_COLLECTION).rename(IOctopusAPI.STORY_COLLECTION, true);\r
+ BasicDBList rundowns = null;\r
+ BasicDBList storyFolders = null;\r
+\r
+ rundowns = queryBuildRefRundowns();\r
+ storyFolders = queryBuildRefFolders();\r
+\r
+ if (rundowns == null || rundowns.size() == 0) {\r
+ progressEvent.setProgress(50);\r
+ fireProgressEvent(progressEvent);\r
+ } else {\r
+ logger.info("Process rundowns");\r
+ storeRundowns(rundowns, null);\r
+ }\r
+\r
+ if (storyFolders == null || storyFolders.size() == 0) {\r
+ progressEvent.setProgress(100);\r
+ fireProgressEvent(progressEvent);\r
+ } else {\r
+ logger.info("Process story folders");\r
+ storeStoryFolders(storyFolders, null);\r
+ }\r
+ setLastUpdateTime(new Date());\r
+ logger.info("Activate");\r
+\r
+ // db.getCollection(IOctopusAPI.RUNDOWN_COLLECTION).drop();\r
+ db.getCollection(RUNDOWN_COLLECTION).rename(IOctopusAPI.RUNDOWN_COLLECTION, true);\r
+\r
+ // db.getCollection(IOctopusAPI.FOLDER_COLLECTION).drop();\r
+ db.getCollection(FOLDER_COLLECTION).rename(IOctopusAPI.FOLDER_COLLECTION, true);\r
+\r
+ // db.getCollection(IOctopusAPI.STORY_COLLECTION).drop();\r
+ db.getCollection(STORY_COLLECTION).rename(IOctopusAPI.STORY_COLLECTION, true);\r
\r
} catch (Exception e) {\r
logger.catching(e);\r
return scriptContent;\r
}\r
\r
- // private boolean isModified(Date date, BasicDBObject object, String name) {\r
- // Date actualModifiedString = toDate(object, name);\r
- // if (actualModifiedString == null)\r
- // logger.trace(ACTUAL_MODIFIED_STRING_IS_NULL);\r
- // int result = date.compareTo(actualModifiedString);\r
- // return result <= 0;\r
- // }\r
-\r
private String extractCustomColumnValue(String columnName, BasicDBObject story) {\r
List<BasicDBObject> customColumns = NoSQLUtils.asList(story, IOctopusAPI.CUSTOM_COLUMNS);\r
if (customColumns == null)\r
return result;\r
}\r
\r
+ // private boolean isModified(Date date, BasicDBObject object, String name) {\r
+ // Date actualModifiedString = toDate(object, name);\r
+ // if (actualModifiedString == null)\r
+ // logger.trace(ACTUAL_MODIFIED_STRING_IS_NULL);\r
+ // int result = date.compareTo(actualModifiedString);\r
+ // return result <= 0;\r
+ // }\r
+\r
private String extractScriptContent(BasicDBObject story) {\r
BasicDBObject script = NoSQLUtils.asDBObject(story, IOctopusAPI.SCRIPT);\r
if (script == null || script.isEmpty())\r
return result;\r
}\r
\r
+ private BasicDBList queryBuildRefFolders() {\r
+ BasicDBList storyFolders;\r
+ logger.info("Fetch story folders");\r
+ storyFolders = queryStoryFolders();\r
+ logger.info("Fetch folder story references");\r
+ storyStoryFolders = buildFolderReferences(storyFolders);\r
+ return storyFolders;\r
+ }\r
+\r
+ private BasicDBList queryBuildRefRundowns() {\r
+ BasicDBList rundowns;\r
+ logger.info("Fetch rundowns");\r
+ rundowns = queryRundowns();\r
+ logger.info("Fetch rundown story references");\r
+ storyRundowns = buildRundownReferences(rundowns);\r
+ return rundowns;\r
+ }\r
+\r
private BasicDBObject queryRundown(long id) {\r
logger.trace(ENTER);\r
BasicDBObject result = null;\r
<image src="/img/mediacube_logo_v2_50x50.png">\r
<!-- <custom-attributes org.zkoss.zul.image.preload="true" /> -->\r
</image>\r
- <label style="color:#e3e3e3;font-size:20px;font-weight:bold">MediaCube v2.1.5.2</label>\r
+ <label style="color:#e3e3e3;font-size:20px;font-weight:bold">MediaCube v2.1.5.3</label>\r
</div>\r
</west>\r
<center border="0">\r
@Override
public void addToRunQueue(IJobRuntime jobRuntime) {
try {
- logger.info("{} ading to run queue", jobRuntime);
+ logger.debug("{} adding to run queue", jobRuntime);
runQueue.put(jobRuntime);
} catch (Exception e) {
logger.error(e.getMessage(), e);
public void cleanup() {\r
}\r
\r
+ public IJobRuntime getJobRuntime() {\r
+ return jobRuntime;\r
+ }\r
+\r
protected Marker getMarker() {\r
Marker parentMarker = MarkerManager.getMarker("MEDIACUBE");\r
Marker result = MarkerManager.getMarker(getRuntimeName());\r
}\r
return result;\r
}\r
+\r
+ protected void setProgress(int progress) {\r
+ jobRuntime.incrementProgress(progress);\r
+ }\r
}\r