ソースを参照

added VLC dependency & progress on the Interface

LH 10 年 前
コミット
e5ab9adc18

+ 18 - 3
iZpl/build.gradle

@@ -4,13 +4,14 @@ apply plugin: 'java'
 apply plugin: 'application'
 
 version = 'SNAPSHOT'
-mainClassName = 'de.nplusc.izc.iZpl.Builder'
+mainClassName = 'de.nplusc.izc.iZpl.Utils.VlcInterface'
+//'de.nplusc.izc.iZpl.Builder'
 
 jar{
 	manifest{
 		attributes 'Implementation-Title': 'iZPlaylist',
 					'Implementation-Version': 'SNAPSHOT',
-					'Main-Class': 'de.nplusc.izc.iZpl.Builder'
+					'Main-Class': 'de.nplusc.izc.iZpl.Utils.VlcInterface'
 					
 	}
 }
@@ -18,7 +19,13 @@ jar{
 repositories{
 	jcenter()
 }
-
+sourceSets{
+	main{
+		resources{
+			exclude '**/*.xcf'
+		}
+	}
+}
 dependencies{
 	compile fileTree(dir: 'lib', include: '*.jar')
 	compile "commons-io:commons-io:2.+"
@@ -27,6 +34,14 @@ dependencies{
 	compile "commons-net:commons-net:3.3"
 	compile 'uk.co.caprica:vlcj:3.0.1'
 	compile 'com.googlecode.mp4parser:isoparser:1.0-RC-1'
+	compile 'de.schlichtherle.truezip:truezip-file:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-driver-zip:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-driver-file:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-driver-tar:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-kernel:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-path:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-driver-tzp:7.7.7'
+	compile 'de.schlichtherle.truezip:truezip-driver-http:7.7.7'
 	compile(project(':ToolKit')) {
         transitive = false
     }

+ 4 - 1
iZpl/src/main/java/de/nplusc/izc/iZpl/Builder.java

@@ -75,7 +75,10 @@ public class Builder extends javax.swing.JFrame
     public static boolean issueDetected = false;
     
     
-    
+    public static PLServer getPLServer()
+    {
+        return ps;
+    }
     
     public static void main(final String args2[])
     {

+ 41 - 5
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/iZplGUIBackend.java

@@ -4,6 +4,8 @@
  */
 package de.nplusc.izc.iZpl.GUI;
 
+import de.nplusc.izc.iZpl.Utils.PlayerInterface;
+import de.nplusc.izc.iZpl.Utils.VlcInterface;
 import java.awt.Image;
 
 /**
@@ -12,22 +14,56 @@ import java.awt.Image;
  */
 public class iZplGUIBackend
 {
-    public void seek(int secs)
+    private static PlayerInterface access;
+    
+    public static final int MODE_VLC_EMBEDDED=0;
+    public static final int MODE_VLC_TELNET=1;
+    public static final int MODE_PLUGIN=2;
+    
+    public static void initBackend(int mode,String...ExtraParams)
+    {
+        if(mode==MODE_VLC_EMBEDDED)
+        {
+            VlcInterface.initializeInterfaceEmbedded();
+            access = VlcInterface.getAPI();
+        }
+        else
+        {
+            throw new UnsupportedOperationException("Not yet usable");
+        }
+    }
+    
+    public static void skipTitle()
+    {
+        access.skipTitle();
+    }
+    
+    public static void play()
     {
         
     }
     
-    public int getPlayPosition()
+    public static void pause()
+    {
+        
+    }
+    
+    public static void seek(int secs)
+    {
+        access.seek(secs);
+    }
+    
+    public static int getPlayPosition()
     {
-        return 0;
+       return access.getPosition();
     }
     
-    public String getFilePath()
+    public static String getFilePath()
     {
         return "";
     }
     
-    public Image getCoverImage()
+    public static Image getCoverImage()
     {
         return null;
     }

+ 52 - 23
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/iZplGUIDefault.form

@@ -23,23 +23,37 @@
   <Layout>
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
-          <Group type="102" alignment="1" attributes="0">
+          <Group type="102" attributes="0">
               <Group type="103" groupAlignment="0" attributes="0">
                   <Group type="102" attributes="0">
-                      <EmptySpace pref="127" max="32767" attributes="0"/>
-                      <Component id="jButton3" min="-2" max="-2" attributes="0"/>
                       <EmptySpace max="-2" attributes="0"/>
-                      <Component id="jButton2" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Component id="jButton1" min="-2" pref="109" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Group type="102" alignment="1" attributes="0">
+                              <Group type="103" groupAlignment="0" attributes="0">
+                                  <Group type="102" attributes="0">
+                                      <EmptySpace min="0" pref="117" max="32767" attributes="0"/>
+                                      <Component id="btnShowList" min="-2" max="-2" attributes="0"/>
+                                      <EmptySpace max="-2" attributes="0"/>
+                                      <Component id="btnSkip" min="-2" max="-2" attributes="0"/>
+                                  </Group>
+                                  <Component id="lblTrackName" max="32767" attributes="0"/>
+                              </Group>
+                              <EmptySpace max="-2" attributes="0"/>
+                              <Component id="btnPlayPause" min="-2" pref="123" max="-2" attributes="0"/>
+                          </Group>
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="pnlCoverPicture" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                          </Group>
+                      </Group>
                   </Group>
-                  <Component id="jSlider1" max="32767" attributes="0"/>
+                  <Component id="seekBar" max="32767" attributes="0"/>
               </Group>
-              <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
           </Group>
           <Group type="102" alignment="0" attributes="0">
               <EmptySpace max="-2" attributes="0"/>
-              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
+              <Component id="lblStatus" min="-2" pref="367" max="-2" attributes="0"/>
               <EmptySpace max="32767" attributes="0"/>
           </Group>
       </Group>
@@ -48,46 +62,51 @@
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
               <EmptySpace max="-2" attributes="0"/>
-              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="32767" attributes="0"/>
-              <Group type="103" groupAlignment="0" attributes="0">
-                  <Group type="103" alignment="1" groupAlignment="3" attributes="0">
-                      <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
+              <Component id="pnlCoverPicture" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="separate" pref="30" max="32767" attributes="0"/>
+              <Group type="103" groupAlignment="0" max="-2" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <Component id="lblTrackName" max="32767" attributes="0"/>
+                      <EmptySpace type="separate" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="btnSkip" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="btnShowList" alignment="3" min="-2" max="-2" attributes="0"/>
+                      </Group>
                   </Group>
                   <Group type="102" alignment="1" attributes="0">
-                      <Component id="jButton1" min="-2" pref="58" max="-2" attributes="0"/>
+                      <Component id="btnPlayPause" min="-2" pref="58" max="-2" attributes="0"/>
                       <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
                   </Group>
               </Group>
-              <Component id="jSlider1" min="-2" max="-2" attributes="0"/>
+              <Component id="seekBar" min="-2" max="-2" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
+              <Component id="lblStatus" min="-2" pref="25" max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
   </Layout>
   <SubComponents>
-    <Component class="javax.swing.JSlider" name="jSlider1">
+    <Component class="javax.swing.JSlider" name="seekBar">
     </Component>
-    <Component class="javax.swing.JButton" name="jButton1">
+    <Component class="javax.swing.JButton" name="btnPlayPause">
       <Properties>
         <Property name="text" type="java.lang.String" value="Play"/>
       </Properties>
       <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPlayPauseActionPerformed"/>
       </Events>
     </Component>
-    <Component class="javax.swing.JButton" name="jButton2">
+    <Component class="javax.swing.JButton" name="btnSkip">
       <Properties>
         <Property name="text" type="java.lang.String" value="Skip"/>
       </Properties>
     </Component>
-    <Component class="javax.swing.JButton" name="jButton3">
+    <Component class="javax.swing.JButton" name="btnShowList">
       <Properties>
         <Property name="text" type="java.lang.String" value="Show List"/>
       </Properties>
     </Component>
-    <Container class="javax.swing.JPanel" name="jPanel1">
+    <Container class="javax.swing.JPanel" name="pnlCoverPicture">
 
       <Layout>
         <DimensionLayout dim="0">
@@ -102,5 +121,15 @@
         </DimensionLayout>
       </Layout>
     </Container>
+    <Component class="javax.swing.JLabel" name="lblTrackName">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="No Track loaded"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="lblStatus">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="--:--/--:--"/>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>

+ 78 - 44
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/iZplGUIDefault.java

@@ -11,6 +11,8 @@ package de.nplusc.izc.iZpl.GUI;
 public class iZplGUIDefault extends javax.swing.JFrame
 {
 
+    private boolean backendReady=false;
+    
     /**
      * Creates new form iZplGUIDefault
      */
@@ -30,82 +32,112 @@ public class iZplGUIDefault extends javax.swing.JFrame
     private void initComponents()
     {
 
-        jSlider1 = new javax.swing.JSlider();
-        jButton1 = new javax.swing.JButton();
-        jButton2 = new javax.swing.JButton();
-        jButton3 = new javax.swing.JButton();
-        jPanel1 = new javax.swing.JPanel();
+        seekBar = new javax.swing.JSlider();
+        btnPlayPause = new javax.swing.JButton();
+        btnSkip = new javax.swing.JButton();
+        btnShowList = new javax.swing.JButton();
+        pnlCoverPicture = new javax.swing.JPanel();
+        lblTrackName = new javax.swing.JLabel();
+        lblStatus = new javax.swing.JLabel();
 
         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
-        jButton1.setText("Play");
-        jButton1.addActionListener(new java.awt.event.ActionListener()
+        btnPlayPause.setText("Play");
+        btnPlayPause.addActionListener(new java.awt.event.ActionListener()
         {
             public void actionPerformed(java.awt.event.ActionEvent evt)
             {
-                jButton1ActionPerformed(evt);
+                btnPlayPauseActionPerformed(evt);
             }
         });
 
-        jButton2.setText("Skip");
+        btnSkip.setText("Skip");
 
-        jButton3.setText("Show List");
+        btnShowList.setText("Show List");
 
-        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
-        jPanel1.setLayout(jPanel1Layout);
-        jPanel1Layout.setHorizontalGroup(
-            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+        javax.swing.GroupLayout pnlCoverPictureLayout = new javax.swing.GroupLayout(pnlCoverPicture);
+        pnlCoverPicture.setLayout(pnlCoverPictureLayout);
+        pnlCoverPictureLayout.setHorizontalGroup(
+            pnlCoverPictureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGap(0, 186, Short.MAX_VALUE)
         );
-        jPanel1Layout.setVerticalGroup(
-            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+        pnlCoverPictureLayout.setVerticalGroup(
+            pnlCoverPictureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGap(0, 171, Short.MAX_VALUE)
         );
 
+        lblTrackName.setText("No Track loaded");
+
+        lblStatus.setText("--:--/--:--");
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
         getContentPane().setLayout(layout);
         layout.setHorizontalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+            .addGroup(layout.createSequentialGroup()
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(layout.createSequentialGroup()
-                        .addContainerGap(127, Short.MAX_VALUE)
-                        .addComponent(jButton3)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(jButton2)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
-                    .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-                .addGap(24, 24, 24))
+                        .addContainerGap()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                                    .addGroup(layout.createSequentialGroup()
+                                        .addGap(0, 117, Short.MAX_VALUE)
+                                        .addComponent(btnShowList)
+                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                        .addComponent(btnSkip))
+                                    .addComponent(lblTrackName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                .addComponent(btnPlayPause, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(pnlCoverPicture, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addGap(0, 0, Short.MAX_VALUE))))
+                    .addComponent(seekBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                .addContainerGap())
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 367, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
         );
         layout.setVerticalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                        .addComponent(jButton2)
-                        .addComponent(jButton3))
+                .addComponent(pnlCoverPicture, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addGap(18, 30, Short.MAX_VALUE)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
-                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addComponent(lblTrackName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                        .addGap(18, 18, 18)
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                            .addComponent(btnSkip)
+                            .addComponent(btnShowList)))
+                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                        .addComponent(btnPlayPause, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                         .addGap(2, 2, 2)))
-                .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap())
+                .addComponent(seekBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
         );
 
         pack();
     }// </editor-fold>//GEN-END:initComponents
 
-    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
-    {//GEN-HEADEREND:event_jButton1ActionPerformed
-        // TODO add your handling code here:
-    }//GEN-LAST:event_jButton1ActionPerformed
+    private void btnPlayPauseActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnPlayPauseActionPerformed
+    {//GEN-HEADEREND:event_btnPlayPauseActionPerformed
+        if(!backendReady)
+        {
+            btnPlayPause.setEnabled(false);
+            new Thread(() ->
+            {
+                iZplGUIBackend.initBackend(iZplGUIBackend.MODE_VLC_EMBEDDED);
+                backendReady=true;
+                iZplGUIBackend.skipTitle();
+                        
+                btnPlayPause.setEnabled(true);
+            }).start();
+        }
+    }//GEN-LAST:event_btnPlayPauseActionPerformed
 
     /**
      * @param args the command line arguments
@@ -156,10 +188,12 @@ public class iZplGUIDefault extends javax.swing.JFrame
         });
     }
     // Variables declaration - do not modify//GEN-BEGIN:variables
-    private javax.swing.JButton jButton1;
-    private javax.swing.JButton jButton2;
-    private javax.swing.JButton jButton3;
-    private javax.swing.JPanel jPanel1;
-    private javax.swing.JSlider jSlider1;
+    private javax.swing.JButton btnPlayPause;
+    private javax.swing.JButton btnShowList;
+    private javax.swing.JButton btnSkip;
+    private javax.swing.JLabel lblStatus;
+    private javax.swing.JLabel lblTrackName;
+    private javax.swing.JPanel pnlCoverPicture;
+    private javax.swing.JSlider seekBar;
     // End of variables declaration//GEN-END:variables
 }

+ 9 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/MultiPlayListItem.java

@@ -177,5 +177,14 @@ public class MultiPlayListItem implements PlayListItem
         return false;
     }
     
+    public SinglePlayListItem[] getSinglePlayListElements()
+    {
+        ArrayList l = new ArrayList<>();
+        for (int i = 0; i < path.size(); i++)
+        {
+            l.add(new SinglePlayListItem(path.get(i), title.get(i), 1));
+        }
+        return (SinglePlayListItem[]) l.toArray(new SinglePlayListItem[]{});
+    }
     
 }

+ 16 - 9
iZpl/src/main/java/de/nplusc/izc/iZpl/PlProcessorV2.java

@@ -26,7 +26,7 @@ public class PlProcessorV2 implements HttpHandler
     private HashMap<String,PlayListItem> pool;
     private String path;
     private List<String> availEtrs;
-    private String forced="";
+    private PlayListItem forced=null;
 
     /* public PlProcessor(String PlPath)
     {
@@ -89,12 +89,12 @@ public class PlProcessorV2 implements HttpHandler
     {
         path=PlPath;
         reloadLists();
-        forced="";
+        forced=null;
     }
     
     public void forceNext(String hmid)
     {
-        forced=pool.get(hmid).getM3UElement();
+        forced=pool.get(hmid);
     }
     private static Yaml yp = new Yaml();
     public void reloadLists()
@@ -193,20 +193,19 @@ public class PlProcessorV2 implements HttpHandler
         time = new Date(System.currentTimeMillis()).toString();
         System.out.println("IZPL-HAndler:Answered Request at:"+time);
     }
-    
     public boolean resetted;
-    public String getBlock()
+    public PlayListItem getBlockRaw()
     {
         System.out.println("Forced=\""+forced+"\"");
-        String response = "";
-        if(forced.equals(""))
+        PlayListItem response = null;
+        if(forced==null)
         {
             System.out.println("Normal handling");
             double rm = Math.random();//Zufallsselektor
             int selection = (int) (rm*availEtrs.size());
             PlayListItem pli = pool.get(availEtrs.get(selection));
             availEtrs.remove(selection);//vom Cache streichen damit RNG es nicht mehr wählen kann
-            response = pli.getM3UElement();
+            response = pli;
             pli.setCountPlayed(pli.getCountPlayed()+1);
             resetted=false;
             if(availEtrs.size()<1)
@@ -223,8 +222,16 @@ public class PlProcessorV2 implements HttpHandler
         else
         {
             response=forced;
-            forced="";
+            forced=null;
         }
+        return response;
+    }
+    
+    
+    
+    public String getBlock()
+    {
+        String response = getBlockRaw().getM3UElement();
         response=response.replaceAll("\\\n\\\n", "\\\n");
         return response;
     }

+ 9 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/PlayerInterface.java

@@ -6,14 +6,23 @@
 
 package de.nplusc.izc.iZpl.Utils;
 
+import de.nplusc.izc.iZpl.PlayListItem;
+
+
 /**
  *
  * @author iZc <nplusc.de>
  */
 public interface PlayerInterface
 {
+    
+    public void setTitleToPlay(PlayListItem i);
     public int getLengthInSeconds();
     public int getPosition();
     public void seek(int sekunde);
     public void skipTitle();
+    public void play();
+    public void pause();
+    
+    public PlayListItem getCurrentTitle();
 }

+ 347 - 17
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/VlcInterface.java

@@ -5,32 +5,96 @@
  */
 package de.nplusc.izc.iZpl.Utils;
 
-import de.nplusc.izc.tools.IOtools.NativeUtils;
+import com.sun.jna.Native;
+import com.sun.jna.NativeLibrary;
+import de.nplusc.izc.iZpl.Builder;
+import de.nplusc.izc.iZpl.MultiPlayListItem;
+import de.nplusc.izc.iZpl.PlayListItem;
+import de.nplusc.izc.iZpl.SinglePlayListItem;
+import de.nplusc.izc.tools.baseTools.Detectors;
+import de.schlichtherle.truezip.file.TFile;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
 import java.util.Arrays;
+import uk.co.caprica.vlcj.binding.LibVlc;
+import uk.co.caprica.vlcj.binding.internal.libvlc_media_t;
+import uk.co.caprica.vlcj.player.MediaPlayer;
+import uk.co.caprica.vlcj.player.MediaPlayerEventListener;
+import uk.co.caprica.vlcj.player.MediaPlayerFactory;
+import uk.co.caprica.vlcj.runtime.RuntimeUtil;
 
 /**
  *
  * @author inge
  */
-public class VlcInterface implements PlayerInterface
+public class VlcInterface implements PlayerInterface , MediaPlayerEventListener
 {
-    private VlcInterface instance;
     
-    private VlcInterface ()
+    private static VlcInterface instance=null;
+    private InternalInterface adapter=null;
+    private PlayListItem currentTrack;
+    private boolean isInMultiItem;
+    private SinglePlayListItem[] multiItemStorage = null;
+    private int multiIndex=0;
+    private boolean isPlaying;
+    private VlcInterface (String vlcpath)
     {
-        
+        this(vlcpath,false);
     }
     
     private VlcInterface (String vlcpath,boolean bundledVersion)
     {
-        
+        if(bundledVersion)
+        {
+            String[] osmetadata = Detectors.getSystemClassification();
+            System.out.println(Arrays.toString(osmetadata));
+            if(osmetadata[0].equals("windows"))
+            {
+                String jarschiv = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
+                File target = new File(new File(jarschiv).getParent()+"\\vlcbinaries");
+                if(!target.exists())
+                {
+                    TFile zippo = new TFile(jarschiv+"\\vlc\\vlc-2.1.5-"+osmetadata[0]+"-"+osmetadata[1]+".zip");
+                    try
+                    {
+                        zippo.cp_rp(target);
+                        TFile jarschcrap = new TFile(jarschiv+"\\vlc\\");
+                        jarschcrap.rm_r();//removal of the embedded VLC data after connecting to the System
+                    }
+                    catch (IOException ex)
+                    {
+                        ex.printStackTrace();
+                    }
+                   
+                }
+                NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), target.getPath());
+                Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
+                adapter=new VlcJIterface(vlcpath,this);
+            }
+            else throw new UnsupportedOperationException("ERROR! invalid OSType detected, embedded VLC doesnt work here");
+            
+        }
     }
     
     
+    public static void initializeInterfaceEmbedded()
+    {
+        initializeInterface(null, true);
+    }
+    
+    public static void initializeInterface(String vlcpath, boolean embedded)
+    {
+        if (instance == null)
+        {
+            instance = new VlcInterface(vlcpath, embedded);
+        }
+    }
+    
+    public static VlcInterface getAPI()
+    {
+        return instance;
+    }
+        
     public int getLengthInSeconds()
     {
         return 0;
@@ -41,43 +105,296 @@ public class VlcInterface implements PlayerInterface
     }
     public void seek(int sekunde)
     {
-        
+        adapter.seek(sekunde);
     }
     
     public void skipTitle()
     {
-        
+        if(isInMultiItem)
+        {
+            if(multiIndex==multiItemStorage.length-1)
+            {
+                isInMultiItem=false;
+            }
+            currentTrack=multiItemStorage[multiIndex++];
+            adapter.addTitle(((SinglePlayListItem)currentTrack).getPath());
+        }
+        else
+        {
+            adapter.skipTitle();
+        }
+    }
+    
+
+    
+    @Override
+    public void setTitleToPlay(PlayListItem i)
+    {
+        isPlaying=true;
+        if(i instanceof SinglePlayListItem)
+        {
+            currentTrack = i;
+            adapter.addTitle(((SinglePlayListItem)i).getPath());
+        }
+        else
+        {
+            isInMultiItem=true;
+            multiIndex=0;
+            multiItemStorage = ((MultiPlayListItem)i).getSinglePlayListElements();
+            currentTrack=multiItemStorage[0];
+            adapter.addTitle(multiItemStorage[0].getPath());
+            multiIndex++;
+        }
+    }
+
+    @Override
+    public PlayListItem getCurrentTitle()
+    {
+       return currentTrack;
     }
     
-    private class VlcJIterface
+    @Override
+    public void play()
+    {
+        if(!isPlaying)
+        {
+            adapter.play();
+        }
+    }
+
+    @Override
+    public void pause()
     {
-        public VlcJIterface(String vlcpath)
+        if(isPlaying)
         {
+            adapter.pause();
+        }
+    }
+
+
+    @Override
+    public void mediaChanged(MediaPlayer mp, libvlc_media_t l, String string)
+    {     
+    }
+
+    @Override
+    public void opening(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void buffering(MediaPlayer mp, float f)
+    {
+    }
+
+    @Override
+    public void playing(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void paused(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void stopped(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void forward(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void backward(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void finished(MediaPlayer mp)
+    {
+        if(isInMultiItem)
+        {
+            skipTitle();
             
         }
+        else
+        {
+            PlayListItem next = Builder.getPLServer().ppp.getBlockRaw();
+            setTitleToPlay(next);
+        }
         
+        //TODO CODE
+    }
+    
+    @Override
+    public void timeChanged(MediaPlayer mp, long l)
+    {
+    }
+
+    @Override
+    public void positionChanged(MediaPlayer mp, float f)
+    {
+    }
+
+    @Override
+    public void seekableChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void pausableChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void titleChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void snapshotTaken(MediaPlayer mp, String string)
+    {
+    }
+
+    @Override
+    public void lengthChanged(MediaPlayer mp, long l)
+    {
+    }
+
+    @Override
+    public void videoOutput(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void error(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void mediaMetaChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void mediaSubItemAdded(MediaPlayer mp, libvlc_media_t l)
+    {
+    }
+
+    @Override
+    public void mediaDurationChanged(MediaPlayer mp, long l)
+    {
+    }
+
+    @Override
+    public void mediaParsedChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void mediaFreed(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void mediaStateChanged(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void newMedia(MediaPlayer mp)
+    {
+    }
+
+    @Override
+    public void subItemPlayed(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void subItemFinished(MediaPlayer mp, int i)
+    {
+    }
+
+    @Override
+    public void endOfSubItems(MediaPlayer mp)
+    {
+    }
+
+
+    
+    
+    private interface InternalInterface
+    {
+        public void addTitle(String vlcpath);
+        public int getLengthInSeconds();
+        public int getPosition();
+        public void seek(int sekunde);
+        public void skipTitle();
+        public void play();
+        public void pause();
+    }
+    
+    private class VlcJIterface implements InternalInterface
+    {
+        private VlcInterface parent;
+        private MediaPlayer mpaccess;
+        private MediaPlayerFactory f;
+        public VlcJIterface(String vlcpath,VlcInterface parent)
+        {
+            this.parent=parent;
+            f= new MediaPlayerFactory("--no-video-title-show");
+            mpaccess = f.newHeadlessMediaPlayer();
+            mpaccess.addMediaPlayerEventListener(parent);
+        }
         
+        public void addTitle(String path)
+        {
+            mpaccess.stop();
+            mpaccess.playMedia(path);
+        }
         public int getLengthInSeconds()
         {
-            return 0;
+            return (int) (Math.ceil(mpaccess.getLength()/1000f));
         }
         public int getPosition()
         {
-            return 0;
+            return (int) (Math.ceil((mpaccess.getLength()/1000f)*mpaccess.getPosition()));
         }
         public void seek(int sekunde)
         {
-
+            mpaccess.setPosition(((float)sekunde)/((float)getLengthInSeconds()));
         }
 
+        @Override
         public void skipTitle()
         {
+            parent.finished(mpaccess);//über bande spielen
+        }
+
+        @Override
+        public void play()
+        {
+            mpaccess.play();
+        }
 
+        @Override
+        public void pause()
+        {
+           mpaccess.pause();
         }
     }
     
-    private class VlcTelnetIterface
+    private class VlcTelnetInterface implements InternalInterface
     {
+        public void addTitle(String path)
+        {
+            
+        }
+        
         public int getLengthInSeconds()
         {
             return 0;
@@ -95,6 +412,18 @@ public class VlcInterface implements PlayerInterface
         {
 
         }
+
+        @Override
+        public void play()
+        {
+            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        }
+
+        @Override
+        public void pause()
+        {
+            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        }
     }
     
     
@@ -102,7 +431,8 @@ public class VlcInterface implements PlayerInterface
     
     public static void main(String[] args)
     {
-        System.out.println(Arrays.toString(getVlcVersionFromExe("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")));
+        //System.out.println(Arrays.toString(getVlcVersionFromExe("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")));
+        initializeInterfaceEmbedded();
     }
     
     

+ 0 - 1
iZpl/src/main/resources/rsrc/skindef.izmeta

@@ -30,7 +30,6 @@ elementData:
 
 
 
-
 elementPositions:
 #Top left corners of the elements
   scrollbarstart: [820, 40] #Slider (always same height as the table; recommended to be placed left or right of it)

BIN
iZpl/src/main/resources/vlc/vlc-2.1.5-windows-x64.zip


BIN
iZpl/src/main/resources/vlc/vlc-2.1.5-windows-x86.zip