From b097b14c2566ba3957f87fb58d95d7d5de475e4c Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Wed, 17 Jul 2019 12:03:51 +0200
Subject: [PATCH] - disabled metadata extraction (with ffprobe)

---
 ...nicalMetadataExtractorMediaConchPlugin.xml |  2 +
 ...icalMetadataExtractorMediaConchPlugin.java | 62 +++++++++----------
 2 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/PLUGIN-INF/metadata_SLUBTechnicalMetadataExtractorMediaConchPlugin.xml b/PLUGIN-INF/metadata_SLUBTechnicalMetadataExtractorMediaConchPlugin.xml
index b8794bf..98447ab 100644
--- a/PLUGIN-INF/metadata_SLUBTechnicalMetadataExtractorMediaConchPlugin.xml
+++ b/PLUGIN-INF/metadata_SLUBTechnicalMetadataExtractorMediaConchPlugin.xml
@@ -33,6 +33,7 @@
                             <x_options></x_options>
                           </x_field>
 
+<!--
                           <x_field>
                             <field_name>ffprobe_binary_path</field_name>
                             <label>Path to ffprobe</label>
@@ -44,6 +45,7 @@
                             <css_class>width40</css_class>
                             <x_options></x_options>
                           </x_field>
+-->
                         </x_fields>
 		</fr:x_form>
 	</pl:initParameters>
diff --git a/java/org/slub/rosetta/dps/repository/plugin/SLUBTechnicalMetadataExtractorMediaConchPlugin.java b/java/org/slub/rosetta/dps/repository/plugin/SLUBTechnicalMetadataExtractorMediaConchPlugin.java
index 5c5a3f0..36dea06 100644
--- a/java/org/slub/rosetta/dps/repository/plugin/SLUBTechnicalMetadataExtractorMediaConchPlugin.java
+++ b/java/org/slub/rosetta/dps/repository/plugin/SLUBTechnicalMetadataExtractorMediaConchPlugin.java
@@ -41,7 +41,7 @@ public class SLUBTechnicalMetadataExtractorMediaConchPlugin implements MDExtract
 
     private String mediaconch_binary_path;
     private String mediaconch_profile_path;
-    private String ffprobe_binary_path;
+    //~ private String ffprobe_binary_path;
 
     private List<String> extractionErrors = new ArrayList<String>();
     private List<String> validationLog = new ArrayList<String>();
@@ -63,12 +63,12 @@ public class SLUBTechnicalMetadataExtractorMediaConchPlugin implements MDExtract
     public void initParams(Map<String, String> initp) {
         this.mediaconch_binary_path = initp.get("mediaconch_binary_path").trim();
         this.mediaconch_profile_path = initp.get("mediaconch_profile_path").trim();
-        this.ffprobe_binary_path = initp.get("ffprobe_binary_path").trim();
+        //~ this.ffprobe_binary_path = initp.get("ffprobe_binary_path").trim();
 
         System.out.println("SLUBTechnicalMetadataExtractorMediaConchPlugin instantiated with "
                 + " mediaconch_binary_path=" + mediaconch_binary_path
                 + " mediaconch_profile_path=" + mediaconch_profile_path
-                + " ffprobe_binary_path=" + ffprobe_binary_path
+                //~ + " ffprobe_binary_path=" + ffprobe_binary_path
         );
     }
 
@@ -99,10 +99,10 @@ public class SLUBTechnicalMetadataExtractorMediaConchPlugin implements MDExtract
             //log.error("No mediaconch_config_path defined. Please set the plugin parameter to hold your mediaconch_config_path.");
             throw new Exception("mediaconch_profile_path not found");
         }
-        if (StringUtils.isEmptyString(ffprobe_binary_path)) {
+        //~ if (StringUtils.isEmptyString(ffprobe_binary_path)) {
 
-            throw new Exception("ffprobe_binary_path (part of ffmpeg) not found");
-        }
+            //~ throw new Exception("ffprobe_binary_path (part of ffmpeg) not found");
+        //~ }
 
 
         // mediaconch validation
@@ -140,30 +140,30 @@ public class SLUBTechnicalMetadataExtractorMediaConchPlugin implements MDExtract
            the separator is "="
          */
 
-        try {
-            String execstring = this.ffprobe_binary_path + " -print_format flat -v error -show_format -show_streams -show_entries stream=r_frame_rate" + filePath;
-            System.out.println("executing: " + execstring);
-            Process p = Runtime.getRuntime().exec(execstring);
-            p.waitFor();
-            BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
-            String line=reader.readLine();
-            String response="";
-            while (line != null) {
-                System.out.println(line);
-                parse_ffprobe_flat_output(line.trim());
-                response+=line;
-                line = reader.readLine();
-            }
-            attributes.put("ffprobe-log", response.trim());
-
-        } catch (IOException e) {
-            //log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
-
-
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-
-        }
+        //~ try {
+            //~ String execstring = this.ffprobe_binary_path + " -print_format flat -v error -show_format -show_streams -show_entries stream=r_frame_rate" + filePath;
+            //~ System.out.println("executing: " + execstring);
+            //~ Process p = Runtime.getRuntime().exec(execstring);
+            //~ p.waitFor();
+            //~ BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+            //~ String line=reader.readLine();
+            //~ String response="";
+            //~ while (line != null) {
+                //~ System.out.println(line);
+                //~ parse_ffprobe_flat_output(line.trim());
+                //~ response+=line;
+                //~ line = reader.readLine();
+            //~ }
+            //~ attributes.put("ffprobe-log", response.trim());
+
+        //~ } catch (IOException e) {
+            //~ //log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
+
+
+        //~ } catch (InterruptedException e) {
+            //~ e.printStackTrace();
+
+        //~ }
     }
 
     public String getAgentName()
@@ -381,7 +381,7 @@ public class SLUBTechnicalMetadataExtractorMediaConchPlugin implements MDExtract
         Map<String, String> initp = new HashMap<String, String>();
         initp.put( "mediaconch_binary_path", "/usr/bin/mediaconch");
         initp.put( "mediaconch_profile_path", "/etc/mediaconch/profile.xml");
-        initp.put( "ffprobe_binary_path", "/usr/bin/ffprobe");
+        //~ initp.put( "ffprobe_binary_path", "/usr/bin/ffprobe");
         plugin.initParams( initp );
         System.out.println("Agent: '" + plugin.getAgent() + "'");
         System.out.println();
-- 
GitLab