From 2dd7a5b331b57db5c7aa5bef9540e3e198848060 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 01 Apr 2021 14:04:54 +0000
Subject: [PATCH] weiterspielen (erste Fassung fertig)

---
 src/de/uhilger/avdirektor/OMXLogLeser.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/de/uhilger/avdirektor/OMXLogLeser.java b/src/de/uhilger/avdirektor/OMXLogLeser.java
index 4db7bb4..91ff199 100644
--- a/src/de/uhilger/avdirektor/OMXLogLeser.java
+++ b/src/de/uhilger/avdirektor/OMXLogLeser.java
@@ -29,6 +29,16 @@
   private static final long MILLIS = (long) 1000;
   
   private static final long MINSEC = (long) 60;
+  
+  
+  public String logDirLesen(File logDir) throws IOException, FileNotFoundException, ParseException {
+    Blocks blocks = new Blocks();
+    File[] files = logDir.listFiles();
+    for(File file : files) {
+      lesen(file, blocks);
+    }
+    return blocks.getTimeString();
+  }
       
   /**
    * 
@@ -42,12 +52,13 @@
    * 
    * 
    * @param logfile
+   * @param blocks
    * @return  die Spieldauer als String im Format H:MM:SS
    * @throws FileNotFoundException
    * @throws IOException
    * @throws ParseException 
    */
-  public String lesen(File logfile) throws FileNotFoundException, IOException, ParseException {    
+  public void lesen(File logfile, Blocks blocks) throws FileNotFoundException, IOException, ParseException {    
     boolean inPause = false;
     logger.info("Starting to parse log..");
     Date parseStart = new Date();
@@ -58,7 +69,7 @@
     ++lineCount;
     String lastLine = "";
     String line = r.readLine();
-    Blocks blocks = new Blocks();
+    //Blocks blocks = new Blocks();
     Block currentBlock = new Block();
     while(line != null) {
       ++lineCount;
@@ -88,7 +99,7 @@
     logger.log(Level.INFO, 
             "{0} lines parsed in {1} seconds and {2} milliseconds.", 
             new Object[]{lineCount, timeSeconds, restMillis});
-    return blocks.getTimeString();
+    //return blocks.getTimeString();
   }
   
   class Block {

--
Gitblit v1.9.3