git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 4 Sep 2020 22:06:37 +0000 (22:06 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 4 Sep 2020 22:06:37 +0000 (22:06 +0000)
server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java
server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java

index a8d2a1e99db262e10581226254c5507c7a79c775..622fd8dc136a14ccf0b4b6633d29cc9b7ba14cdc 100644 (file)
@@ -274,4 +274,11 @@ public class SmallTests {
                System.out.println(p1.toFile().exists());\r
                System.out.println(Files.isSymbolicLink(p1));\r
        }\r
+\r
+       @Test\r
+       public void test93() throws Exception {\r
+               String mc = "2020-09-02T07:54:31.659+0200";\r
+               String mexio = "2020-09-03T17:52:59.098+0200";\r
+               System.out.println(mc.compareTo(mexio));\r
+       }\r
 }\r
index 895be243a9d611e0e5d42c2c1243341fb51dcae5..c4a97867f4e31b0ad261e9a94465da6495519611 100644 (file)
@@ -30,39 +30,43 @@ public class NEXIOArchiveCheckerStep extends JobStep {
        private boolean check(Timestamp modified, Timestamp created, int duration, Media media, int videoFormat, int lastModifiedHours) {\r
                String title = media.getTitle();\r
 \r
+               //formatum\r
                if (!(videoFormat == 3 || videoFormat == 19)) {\r
                        logger.info(getMarker(), "{} unsupported video format", videoFormat);\r
                        return false;\r
                }\r
 \r
+               //utolso modositas a mosthoz kepest\r
+               //The result of this method can be a negative period if the end is before the start.\r
                long modifiedHours = Duration.between(modified.toInstant(), Instant.now()).toHours();\r
+               if (modifiedHours < 0) {\r
+                       logger.info(getMarker(), "{} modification time greather than now", title);\r
+                       return false;\r
+               }\r
                if (modifiedHours < lastModifiedHours) {\r
                        logger.info(getMarker(), "{} modification time is too cloose for now", title);\r
                        return false;\r
                }\r
 \r
-               //              long count = executeQuery(\r
-               //                              "select count(*) from job where related = ? and NAME = 'Visszatöltés' and STATUS='FINISHED' and HOURS_BETWEEN(?, finished) = 0", title,\r
-               //                              created);\r
-               //\r
-               //              if (count > 0) {\r
-               //                      logger.info(getMarker(), "{} has record date and TSM restore too close", title);\r
-               //                      return true;\r
-               //              }\r
-\r
+               //utolso modositas\r
                MediaFile mediaFile = getManager().getSystemMediaFile(media);\r
                boolean isModified = true;\r
-               if (mediaFile != null)\r
-                       isModified = df.format(mediaFile.getLastModified()).compareTo(df.format(modified)) < 0;\r
+               if (mediaFile == null) {\r
+                       logger.info(getMarker(), "{} system media file not available", title);\r
+                       return false;\r
+               }\r
 \r
+               String mcMod = df.format(mediaFile.getLastModified());\r
+               String nexioMod = df.format(modified);\r
+               isModified = mcMod.compareTo(nexioMod) < 0;\r
                if (isModified) {\r
-                       logger.info(getMarker(), "{} has different last modification time {} < {}", title, media.getModified(), modified);\r
+                       logger.info(getMarker(), "{} modification time: MC {} < NEXIO {}", title, mcMod, nexioMod);\r
                        return true;\r
                }\r
 \r
                boolean isLengthChanged = media.getLength() > 0 && Math.abs(media.getLength() - duration) > 3;\r
                if (isLengthChanged) {\r
-                       logger.info(getMarker(), "{} has different length {} != {}", title, media.getLength(), duration);\r
+                       logger.info(getMarker(), "{} length: MC {} != NEXIO {}", title, media.getLength(), duration);\r
                        return true;\r
                }\r
 \r
@@ -106,47 +110,6 @@ public class NEXIOArchiveCheckerStep extends JobStep {
                return null;\r
        }\r
 \r
-       //      public long executeQuery(String query, String title, Timestamp created) {\r
-       //              long count = 0;\r
-       //\r
-       //              DefaultContext context = getManager().getDbContext();\r
-       //              Connection connection = context.getConnection();\r
-       //\r
-       //              ResultSet rs = null;\r
-       //              PreparedStatement st = null;\r
-       //              try {\r
-       //                      st = connection.prepareStatement(query);\r
-       //                      st.setString(1, title);\r
-       //                      st.setTimestamp(2, created);\r
-       //                      rs = st.executeQuery();\r
-       //                      if (rs.next()) {\r
-       //                              count = rs.getLong(1);\r
-       //                      }\r
-       //\r
-       //                      connection.commit();\r
-       //              } catch (Exception e) {\r
-       //                      logger.catching(e);\r
-       //                      try {\r
-       //                              connection.rollback();\r
-       //                      } catch (Exception e1) {\r
-       //                      }\r
-       //              } finally {\r
-       //                      try {\r
-       //                              if (rs != null)\r
-       //                                      rs.close();\r
-       //                      } catch (Exception e1) {\r
-       //                      }\r
-       //                      try {\r
-       //                              if (st != null)\r
-       //                                      st.close();\r
-       //                      } catch (Exception e1) {\r
-       //                      }\r
-       //\r
-       //                      getManager().putDbContext(context);\r
-       //              }\r
-       //              return count;\r
-       //      }\r
-\r
        private void processClips(String storeName, StoreUri sourceStoreUri, StoreUri targetStoreUri, String outputPath, Iterator<Clip> clips,\r
                        int lastModifiedHours) throws ClipNotFoundException, IOException, ProtocolException {\r
                int processed = 0;\r
@@ -165,8 +128,13 @@ public class NEXIOArchiveCheckerStep extends JobStep {
                                Timestamp modified = null;\r
                                int frames = 0;\r
                                int videoFormat = 0;\r
-                               title = clip.getXid().get();\r
                                frames = clip.getDuration();\r
+\r
+                               //ures clip\r
+                               if (frames == 1)\r
+                                       continue;\r
+\r
+                               title = clip.getXid().get();\r
                                created = Timestamp.from(clip.getRecordDateTimestamp().toInstant());\r
                                modified = Timestamp.from(clip.getModifiedTimestamp().toInstant());\r
                                videoFormat = clip.getVideoFormat();\r