Browse Source

0.7.0.0 refactoring done, also fixed the rightclick-close-window-bug on
skinned UI, & changed the editor to save with relative paths instead of
absolute ones

LH 10 years ago
parent
commit
2e4817dd11
34 changed files with 1020 additions and 89 deletions
  1. 2 0
      Readme.txt
  2. 0 2
      build.gradle
  3. 10 0
      iZpl-server/build.gradle
  4. 3 0
      iZpl/build.gradle
  5. 21 4
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/IZPLApi.java
  6. 3 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlayListEditAPI.java
  7. 2 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlaybackPlugin.java
  8. 31 18
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/PluginManager.java
  9. 0 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/MultiPlayListItem.java
  10. 0 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java
  11. 0 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListItem.java
  12. 0 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/SinglePlayListItem.java
  13. 5 2
      iZpl/src/main/java/de/nplusc/izc/iZpl/CommandLineStatus.java
  14. 11 5
      iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/IZplGUISkinnable.java
  15. 3 35
      iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java
  16. 14 3
      iZpl/src/main/java/de/nplusc/izc/iZpl/PlProcessorV2.java
  17. 3 3
      iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/VlcInterface.java
  18. 0 0
      iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java
  19. 3 3
      iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/Editor.java
  20. 2 2
      iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUICommon.java
  21. 3 3
      iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUIFileWise.java
  22. 1 1
      iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/PLIWrapper.java
  23. 2 2
      iZplPlugins/GameRadio/src/main/java/de/nplusc/izc/izpl/plugins/gameradio/RadioManager.java
  24. 1 1
      iZplPlugins/ITunes/src/main/java/de/nplusc/izpl/plugins/itunes/ITunesAPI.java
  25. 3 3
      iZplPlugins/WMP/src/main/java/de/nplusc/izc/izpl/plugins/wmp/WMPNAtive.java
  26. 1 1
      iZplPlugins/foobar2000_others/src/main/java/de/nplusc/izpl/plugins/FooBar2k/WMPNAtive.java
  27. 11 0
      izpl-shared/build.gradle
  28. 27 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/InvalidPlayListFileException.java
  29. 219 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/MultiPlayListItem.java
  30. 107 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java
  31. 34 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListItem.java
  32. 159 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/SinglePlayListItem.java
  33. 338 0
      izpl-shared/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java
  34. 1 1
      settings.gradle

+ 2 - 0
Readme.txt

@@ -10,6 +10,8 @@ iZplaylist:
     Folder: iZpl
     Description: Playlist-Management with priorities. allows to interlink with VLC via different methods by default.
     OSes: Windows
+    to compile run gradlew iZpl:dZ in the root folder.
+    Output is in iZpl/build/distributions 
 iZPlaylist-Plugins:
     Folder: izplplugins
     Remark: Cntains only submodules

+ 0 - 2
build.gradle

@@ -6,8 +6,6 @@ buildscript {
   }
 }
 
-
-
 allprojects {
 	repositories{
 		jcenter()

+ 10 - 0
iZpl-server/build.gradle

@@ -0,0 +1,10 @@
+apply plugin: 'war'
+
+
+
+dependencies{
+
+    compile(project(':izpl-shared')) {
+        transitive = false
+    }
+}

+ 3 - 0
iZpl/build.gradle

@@ -96,4 +96,7 @@ dependencies{
     compile(project(':ToolKit')) {
         transitive = false
     }
+    compile(project(':izpl-shared')) {
+        transitive = false
+    }
 }

+ 21 - 4
iZpl/src/main/java/de/nplusc/izc/iZpl/API/IZPLApi.java

@@ -17,11 +17,17 @@
 
 package de.nplusc.izc.iZpl.API;
 
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.API.shared.PlayListFile;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import de.nplusc.izc.iZpl.Main;
-import de.nplusc.izc.iZpl.Utils.PLFileIO;
+import de.nplusc.izc.iZpl.Utils.shared.PLFileIO;
 import java.awt.Image;
 import java.io.File;
 import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 /**
  *
@@ -44,6 +50,8 @@ public class IZPLApi
     
     public static final String TEMPDIR = System.getenv("temp")+File.separator+"izpl-workdata";
     
+    private static final Logger l = LogManager.getLogger();
+    
     /**
      * Checks whether the Program runs in fully new UI mode or in the old Mode where only the managing UI is loaded
      * @return true when the program is in the new UI mode
@@ -165,9 +173,18 @@ public class IZPLApi
         return System.console()!=null;
     }
    
-    public static List<SinglePlayListItem> readPlayList(String path) throws InvalidPlayListFileException
-    {
-        return PLFileIO.readSingleList(path);
+    public static List<SinglePlayListItem> readPlayList(String path) 
+    {
+        try
+        {
+            return PLFileIO.readSingleList(path);
+        }
+        catch (InvalidPlayListFileException ex)
+        {
+            l.error("Invalid PlaylistFIle @{}",path);
+            quickQuitWithoutSaving();
+            return null;
+        }
     }
     
     

+ 3 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlayListEditAPI.java

@@ -4,6 +4,9 @@
  */
 package de.nplusc.izc.iZpl.API;
 
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.MultiPlayListItem;
 import de.nplusc.izc.iZpl.Main;
 import java.util.ArrayList;
 import java.util.Arrays;

+ 2 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlaybackPlugin.java

@@ -16,6 +16,8 @@
  */
 package de.nplusc.izc.iZpl.API;
 
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+
 /**
  *
  * @author iZc <nplusc.de>

+ 31 - 18
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PluginManager.java

@@ -16,6 +16,7 @@
  */
 package de.nplusc.izc.iZpl.API;
 
+import de.nplusc.izc.iZpl.CommandLineStatus;
 import de.nplusc.izc.iZpl.GUI.IZplGUIDefault;
 import de.nplusc.izc.iZpl.GUI.IZplGUISkinnable;
 import de.nplusc.izc.iZpl.Main;
@@ -53,39 +54,48 @@ public class PluginManager
     private final List<UIPlugin> registeredUIs = new ArrayList<>();
     private PlaybackPlugin selectedPlaybackPlugin;
 
-    private static final List<String> detectedSkins = new ArrayList<>();
+    private static final List<String> detectedSkins = new ArrayList<>();//X
     
-    private boolean allowPluginLoad=false;
+    private boolean allowPluginLoad=false;//X
     
-    private static boolean firstrunmode = false;
+    private boolean firstrunmode = false;//X
     
-    private static boolean updateInit=false;
+    private boolean updateInit=false;//X
     
     
-    private UIPlugin selectedUIPlugin;
+    private UIPlugin selectedUIPlugin;//X
     
-    private boolean featurePluginMode;  //X
-    private String featurePluginID; //X
-    private String pluginParameter; //X
+    private boolean featurePluginMode; //X
+    private String featurePluginID=null; //X
+    private String pluginParameter=null; //X
     
     
-    private String selectedSkinPath;
-    private boolean skinParameterSet = false;
+    private String selectedSkinPath=null; //X
+    private boolean skinParameterSet = false;//X
     
-    private FeaturePlugin selectedFeaturePlugin;
+    private FeaturePlugin selectedFeaturePlugin;//X
     
-    private static final Yaml y = new Yaml();
+    private static final Yaml y = new Yaml(); //X
     
-    private boolean pluginsAlreadyLoaded=false;
+    private boolean pluginsAlreadyLoaded=false; //X
     
-    private int uimodestate=Main.UIMODE_NONE;
+    private int uimodestate=Main.UIMODE_NONE; //X
     
     @SuppressWarnings("element-type-mismatch")
-    public void initializePlugins()
+    public void initializePlugins(CommandLineStatus stts)
     {
-         
+        selectedSkinPath=stts.selectedSkinPath;
+        uimodestate=stts.uimodestate;
+        featurePluginID=stts.featurePluginID;
+        pluginParameter=stts.pluginParameter;
+        skinParameterSet=stts.skinParameterSet;
+        featurePluginMode=stts.featurePluginMode;
+        updateInit=stts.updateInit;
+        firstrunmode=stts.firstrunmode;
+        allowPluginLoad=stts.allowPluginLoad;
+        
         new File(IZPLApi.PLUGINPATH).mkdirs();
-        if(!detectedSkins.contains(selectedSkinPath))
+        if(selectedSkinPath!=null&&!selectedSkinPath.equals("")&&!detectedSkins.contains(selectedSkinPath))
         {
             Main.CONFIG.setSkinSelected("default");
             skinParameterSet=true;
@@ -103,7 +113,10 @@ public class PluginManager
         }
         if(!allowPluginLoad)
             IZPLApi.quickQuitWithoutSaving();
-
+        if(selectedSkinPath==null||selectedSkinPath.equals(""))
+        {
+            selectedSkinPath=Main.CONFIG.getSkinSelected();
+        }
         if (selectedSkinPath.equals("default"))
         {
             selectedSkinPath = IZPLApi.DEFAULT_SKIN_PATH;

+ 0 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/MultiPlayListItem.java → iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/MultiPlayListItem.java


+ 0 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlayListFile.java → iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java


+ 0 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PlayListItem.java → iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListItem.java


+ 0 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/SinglePlayListItem.java → iZpl/src/main/java/de/nplusc/izc/iZpl/API/shared/SinglePlayListItem.java


+ 5 - 2
iZpl/src/main/java/de/nplusc/izc/iZpl/CommandLineStatus.java

@@ -48,8 +48,11 @@ public class CommandLineStatus
     public final String selectedSkinPath;
     public  final int uimodestate;
     
-    public CommandLineStatus(boolean filemode, boolean statefile, boolean verboseMode, boolean useGUI, String file_path, boolean burnDisc, boolean forcePregen, boolean featurePluginMode, String featurePluginID, 
-            String pluginParameter, boolean loadConfigMode, boolean menumode, boolean firstrunmode, boolean updateInit, boolean allowPluginLoad,boolean skinParameterSet,String selectedSkinPath,int uimodestate)
+    public CommandLineStatus(boolean filemode, boolean statefile, boolean verboseMode, boolean useGUI, 
+            String file_path, boolean burnDisc, boolean forcePregen, boolean featurePluginMode, 
+            String featurePluginID, 
+            String pluginParameter, boolean loadConfigMode, boolean menumode, boolean firstrunmode, boolean updateInit, boolean allowPluginLoad,boolean skinParameterSet,
+            String selectedSkinPath,int uimodestate)
     {
         this.filemode = filemode;
         this.statefile = statefile;

+ 11 - 5
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/IZplGUISkinnable.java

@@ -36,9 +36,6 @@ import java.awt.Graphics2D;
 import java.awt.Image;
 import java.awt.Point;
 import java.awt.Polygon;
-import java.awt.Window;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
@@ -46,7 +43,6 @@ import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -464,7 +460,9 @@ public class IZplGUISkinnable extends JFrame implements SkinnableUIPlugin, Mouse
         bdir=IZPLApi.getSkinPath();
         try
         {
-            TFileInputStream is = new TFileInputStream(new TFile(bdir+File.separator+"izpl.izskin"));
+            String sfp = bdir+File.separator+"izpl.izskin";
+            l.trace(sfp);
+            TFileInputStream is = new TFileInputStream(new TFile(sfp));
             sf = (IZSkinFile) new Yaml().load(is);
             is.close();
 
@@ -496,6 +494,14 @@ public class IZplGUISkinnable extends JFrame implements SkinnableUIPlugin, Mouse
     @SuppressWarnings("empty-statement")
     public void initializeUI()
     {
+        addWindowListener(new WindowAdapter()
+        {
+            @Override
+            public void windowClosing(WindowEvent e)
+            {
+                IZPLApi.shutdownWithSave();
+            }
+        });
         setIconImage(IZPLApi.getProgramIcon());
         @SuppressWarnings("null")
         HashMap<String, String> ed = sf.getElementData();

+ 3 - 35
iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java

@@ -55,23 +55,15 @@ import org.yaml.snakeyaml.Yaml;
 public class Main extends javax.swing.JFrame
 {
     private static PluginManager p = new PluginManager();
-    
-    
     private static Logger l;
-    
     private static final String jarschiv = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
     public static final String CONFIGPATH = IZPLApi.APPDIR + File.separator + "config" + File.separator + "config.yml";
     public static final Yaml y = new Yaml();
-    
     public static final int UIMODE_NONE=0,UIMODE_OLD=1,UIMODE_NEW=2;
-    //private static int uimodestate=UIMODE_NONE;
     private static boolean loadedVLC = false;
     private static PLServer ps = null;
-
     private static boolean issueDetected = false;
     public static Configuration CONFIG;
-    // ../config/config.yml
-    
     private static CommandLineStatus stts;
     private static FirstRunScreen frs;
     
@@ -107,9 +99,9 @@ public class Main extends javax.swing.JFrame
             }
             else
             {
-                CommandLineStatus stts = CommandLineParsing.processCommandLine(args);
+                stts = CommandLineParsing.processCommandLine(args);
                 logStart();
-                
+                l.trace(stts==null);
                 mainProcessing();
             }
         }
@@ -164,7 +156,6 @@ public class Main extends javax.swing.JFrame
     public static void UIMain(boolean pFfilemode,boolean pStatemode,String pFile,boolean pForcePregen,
             boolean pBurnDisc,boolean pLoadConfigMode,boolean pFeatureMode,String pFeaturePluginID)
     {
-        
         boolean menumode=false;//hardwired da man vom menü wieder raus will
         boolean filemode=pFfilemode;
         boolean statefile = pStatemode;
@@ -194,7 +185,6 @@ public class Main extends javax.swing.JFrame
         });
     }
 
-
     private static void mainProcessing()
     {
         /* Set the Nimbus look and feel */
@@ -246,7 +236,7 @@ public class Main extends javax.swing.JFrame
         }
         p.detectSkins();
         l.info("Initializing the plugins now. This may take a while");
-        p.initializePlugins();
+        p.initializePlugins(stts);
         l.info("Plugins initialized");
             //TODO:  GUI-Editor zum Erzeugen von iZpl-S
 
@@ -373,12 +363,7 @@ public class Main extends javax.swing.JFrame
             }
         });
     }
-    
-    
-    
 
-    
-    
     private static void startup()
     {
         String time = "";
@@ -531,7 +516,6 @@ public class Main extends javax.swing.JFrame
     {
         String tpath = stts.file_path;
         boolean sym = true;
-        boolean newPPP = false;
         int redirs = 0;
         int max_redirs = 10;//Loopstopper!!!
         while (sym)
@@ -554,10 +538,6 @@ public class Main extends javax.swing.JFrame
                 sym = true;//näxxter lauf.....
                 l.info("Symlink>> Dest=" + tpath);
             }
-            if (new String(magix).equals("!!de.nplusc.izc.iZpl.PlProcessorV2"))
-            {
-                newPPP = true;
-            }
         }
 
         FileReader plf = new FileReader(tpath);
@@ -583,8 +563,6 @@ public class Main extends javax.swing.JFrame
         l.trace("<<<");
         String time = new Date(System.currentTimeMillis()).toString();
         l.info("IZPL-Core:Checkpoint erstellen:" + time);
-        //muss nen StateSaver hier reintoasten....; done...
-        //statefile immer gleich genannt wie originaldatei; ermöglicht mehrere states...
         if (!(stts.forcePregen || isShittyPlayer))
         {
             String pp = y.dump(ps.ppp);
@@ -641,32 +619,22 @@ public class Main extends javax.swing.JFrame
         pack();
     }// </editor-fold>//GEN-END:initComponents
 
-    /**
-     * Creates new form Builder
-     */
     public Main()
     {
         initComponents();
     }
-    
     public static PLServer getPLServer()
     {
         return ps;
     }
-    
-
     public static void gotAIssue()
     {
         gotAIssue(true);
     }
-
-    
     public static void gotAIssue(boolean issue)
     {
         issueDetected = issue;
     }
-
-
     public static Image getPlayListIcon()
     {
         return playListIcon;

+ 14 - 3
iZpl/src/main/java/de/nplusc/izc/iZpl/PlProcessorV2.java

@@ -17,11 +17,12 @@
 
 package de.nplusc.izc.iZpl;
 
-import de.nplusc.izc.iZpl.API.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import com.sun.net.httpserver.Headers;
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpHandler;
-import de.nplusc.izc.iZpl.Utils.PLFileIO;
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.Utils.shared.PLFileIO;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
@@ -129,7 +130,17 @@ public class PlProcessorV2 implements HttpHandler
     public void reloadLists(boolean reload)
     {
         availEtrs = new ArrayList<>();//cache flush and reinit...
-        List<PlayListItem> inp = PLFileIO.parseFullList(path);
+        List<PlayListItem> inp;
+        try
+        {
+            inp = PLFileIO.parseFullList(path);
+        }
+        catch (InvalidPlayListFileException ex)
+        {
+            l.error("invalid playlist file");
+            Main.quickQuit();
+            return;
+        }
         if(!reload)
         {
             pool=new HashMap<>();

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

@@ -21,9 +21,9 @@ import com.sun.jna.NativeLibrary;
 import de.nplusc.izc.iZpl.API.IZPLApi;
 import de.nplusc.izc.iZpl.API.PlaybackPlugin;
 import de.nplusc.izc.iZpl.API.UIPlugin;
-import de.nplusc.izc.iZpl.API.MultiPlayListItem;
-import de.nplusc.izc.iZpl.API.PlayListItem;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.MultiPlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.baseTools.Detectors;
 import de.schlichtherle.truezip.file.TFile;
 import java.awt.Image;

+ 0 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/PLFileIO.java → iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java


+ 3 - 3
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/Editor.java

@@ -19,9 +19,9 @@ package de.nplusc.izc.izpl.plugins.editor;
 
 import de.nplusc.izc.iZpl.API.FeaturePlugin;
 import de.nplusc.izc.iZpl.API.IZPLApi;
-import de.nplusc.izc.iZpl.API.InvalidPlayListFileException;
-import de.nplusc.izc.iZpl.API.PlayListFile;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.API.shared.PlayListFile;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.baseTools.Tools;
 import de.schlichtherle.truezip.file.TFile;
 import java.awt.EventQueue;

+ 2 - 2
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUICommon.java

@@ -17,8 +17,8 @@
 
 package de.nplusc.izc.izpl.plugins.editor;
 
-import de.nplusc.izc.iZpl.API.PlayListFile;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListFile;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.IOtools.FileTK;
 import java.util.Collection;
 import java.util.HashMap;

+ 3 - 3
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUIFileWise.java

@@ -18,9 +18,9 @@
 package de.nplusc.izc.izpl.plugins.editor;
 
 import de.nplusc.izc.iZpl.API.IZPLApi;
-import de.nplusc.izc.iZpl.API.InvalidPlayListFileException;
-import de.nplusc.izc.iZpl.API.PlayListFile;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.API.shared.PlayListFile;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.IOtools.FileTK;
 import de.nplusc.izc.tools.baseTools.Tools;
 import java.io.File;

+ 1 - 1
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/PLIWrapper.java

@@ -17,7 +17,7 @@
 
 package de.nplusc.izc.izpl.plugins.editor;
 
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.IOtools.FileTK;
 
 /**

+ 2 - 2
iZplPlugins/GameRadio/src/main/java/de/nplusc/izc/izpl/plugins/gameradio/RadioManager.java

@@ -19,9 +19,9 @@ package de.nplusc.izc.izpl.plugins.gameradio;
 
 import de.nplusc.izc.iZpl.API.FeaturePlugin;
 import de.nplusc.izc.iZpl.API.IZPLApi;
-import de.nplusc.izc.iZpl.API.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import de.nplusc.izc.iZpl.API.ProgressWindow;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.tools.IOtools.FileTK;
 import de.nplusc.izc.tools.WinToolz.Commands;
 import de.nplusc.izc.tools.baseTools.Detectors;

+ 1 - 1
iZplPlugins/ITunes/src/main/java/de/nplusc/izpl/plugins/itunes/ITunesAPI.java

@@ -17,7 +17,7 @@
 
 package de.nplusc.izpl.plugins.itunes;
 
-import de.nplusc.izc.iZpl.API.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import de.nplusc.izc.iZpl.API.PlaybackPlugin;
 import java.io.File;
 /**

+ 3 - 3
iZplPlugins/WMP/src/main/java/de/nplusc/izc/izpl/plugins/wmp/WMPNAtive.java

@@ -7,10 +7,10 @@
 package de.nplusc.izc.izpl.plugins.wmp;
 
 import de.nplusc.izc.iZpl.API.IZPLApi;
-import de.nplusc.izc.iZpl.API.MultiPlayListItem;
-import de.nplusc.izc.iZpl.API.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.MultiPlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import de.nplusc.izc.iZpl.API.PlaybackPlugin;
-import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
 import de.nplusc.izc.izpl.plugins.wmp.api2.ClassFactory;
 import de.nplusc.izc.izpl.plugins.wmp.api2.IWMPPlayer4;
 import de.nplusc.izc.izpl.plugins.wmp.api2.events._WMPOCXEvents;

+ 1 - 1
iZplPlugins/foobar2000_others/src/main/java/de/nplusc/izpl/plugins/FooBar2k/WMPNAtive.java

@@ -17,7 +17,7 @@
 
 package de.nplusc.izpl.plugins.FooBar2k;
 
-import de.nplusc.izc.iZpl.API.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
 import de.nplusc.izc.iZpl.API.PlaybackPlugin;
 /**
  *

+ 11 - 0
izpl-shared/build.gradle

@@ -0,0 +1,11 @@
+apply plugin: 'java'
+
+
+dependencies{
+    compile fileTree(dir: 'lib', include: '*.jar')
+    compile "org.yaml:snakeyaml:1.14"
+	compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-iostreams', version: '2.1'
+    compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.1'
+}

+ 27 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/InvalidPlayListFileException.java

@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package de.nplusc.izc.iZpl.API.shared;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class InvalidPlayListFileException extends Exception
+{
+    
+}

+ 219 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/MultiPlayListItem.java

@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.API.shared;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *
+ * @author LH
+ */
+public class MultiPlayListItem implements PlayListItem
+{
+    private List<PlayListItem> containedElements=new ArrayList<>();
+    
+    private int playcount,countPlayed;
+    private String src="";
+    
+    public MultiPlayListItem(){};
+    
+    
+    public MultiPlayListItem(String[] path, String[] Title, int playcount)
+    {
+        for (int i = 0; i < Title.length; i++)
+        {
+            String t = Title[i];
+            String p = path[i];
+            containedElements.add(new SinglePlayListItem(p, t, 1));
+        }
+        this.playcount = playcount;
+        countPlayed=0; //noch nie gespielt als default; bei reload wird anderweitig verglichen :P
+    }
+
+    public List<PlayListItem> getItems()
+    {
+        return containedElements;
+    }
+    
+    public void setItems(List<PlayListItem>p)
+    {
+        containedElements=p;
+    }
+
+    public void addItem(PlayListItem e)
+    {
+        containedElements.add(e);
+    }
+    
+    public void removeElement(int i)
+    {
+        containedElements.remove(i);
+    }
+    
+    
+    public String getPath(int i)
+    {
+        PlayListItem it = containedElements.get(i);
+        if(it instanceof SinglePlayListItem)
+        {
+            return ((SinglePlayListItem)it).getPath();
+        }
+        return "";
+    }
+
+    
+    public int getElemCount()
+    {
+        return containedElements.size();
+    }
+   /* public void setPath(String path, int i)
+    {
+        this.
+        this.path.add(i, path);
+    }*/
+
+    public String getTitle(int i)
+    {
+        PlayListItem it = containedElements.get(i);
+        if(it instanceof SinglePlayListItem)
+        {
+            return ((SinglePlayListItem)it).getTitle();
+        }
+        return "";
+    }
+        
+    
+    public void addTitle(String ppath,String ptitle)
+    {
+        containedElements.add(new SinglePlayListItem(ppath, ptitle, 1));
+    }
+
+    @Override
+    public int getTargetPlaycount()
+    {
+        return playcount;
+    }
+
+    @Override
+    public void setTargetPlaycount(int playcount)
+    {
+        this.playcount = playcount;
+    }
+
+    @Override
+    public int getCountPlayed()
+    {
+        return countPlayed;
+    }
+
+    @Override
+    public void setCountPlayed(int countPlayed)
+    {
+        this.countPlayed = countPlayed;
+    }
+    
+    @Override
+    public String getM3UElement()
+    {
+        String sret = "";
+        for (PlayListItem playListItem : containedElements)
+        {
+            sret+=playListItem.getM3UElement();
+        }
+        return sret;
+    }
+
+
+    @Override
+    public int hashCode()
+    {
+        int hash = 7;
+        hash = 47 * hash + Objects.hashCode(containedElements);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        final MultiPlayListItem other = (MultiPlayListItem) obj;
+        if (!containedElements.equals(other.containedElements))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    public String getSrc()
+    {
+        return src;
+    }
+
+    public void setSrc(String src)
+    {
+        this.src = src;
+    }
+
+    @Override
+    public boolean isIncludeElement()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean noexpandoninclude()
+    {
+        return false;
+    }
+    
+    public SinglePlayListItem[] getSinglePlayListElements()
+    {
+        ArrayList<SinglePlayListItem> l = new ArrayList<>();
+        for (PlayListItem playListItem : containedElements)
+        {
+            if(playListItem instanceof SinglePlayListItem)
+            {
+                l.add((SinglePlayListItem) playListItem);
+            }
+            else
+            {
+                if(playListItem instanceof MultiPlayListItem)
+                {
+                    l.addAll(Arrays.asList(((MultiPlayListItem)playListItem).getSinglePlayListElements()));
+                }
+            }
+        }
+        return (SinglePlayListItem[]) l.toArray(new SinglePlayListItem[]{});
+    }
+
+    @Override
+    public int getGID()
+    {
+       return 0;
+    }
+    
+}

+ 107 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java

@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package de.nplusc.izc.iZpl.API.shared;
+
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class PlayListFile
+{
+    private List<SinglePlayListItem> entries;
+    
+    private int calculatedBasePriority=1;
+
+    public int getCalculatedBasePriority()
+    {
+        return calculatedBasePriority;
+    }
+
+    public void setCalculatedBasePriority(int calculatedBasePriority)
+    {
+        this.calculatedBasePriority = calculatedBasePriority;
+    }
+    
+    
+    public List<SinglePlayListItem> getEntries()
+    {
+        return entries;
+    }
+
+    public void setEntries(List<SinglePlayListItem> entries)
+    {
+        this.entries = entries;
+    }
+
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+    private String path;
+
+    @Override
+    public int hashCode()
+    {
+        int hash = 3;
+        //hash = 41 * hash + Objects.hashCode(this.entries);// fickdich, du funkst beim rumfuhrwerken an den daten beim edit rein
+        hash = 41 * hash + Objects.hashCode(this.path);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        final PlayListFile other = (PlayListFile) obj;
+        if (!Objects.equals(this.entries, other.entries))
+        {
+            return false;
+        }
+        if (!Objects.equals(this.path, other.path))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "PlayListFile{" + "calculatedBasePriority=" + calculatedBasePriority + ", path=" + path + '}';
+    }
+    
+    
+    
+    
+}

+ 34 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListItem.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.API.shared;
+
+/**
+ *
+ * @author LH
+ */
+public interface PlayListItem
+{
+    public String getM3UElement();// erzeugt den M3U-Code zum aujsgeben an den VauEllCeh-er
+    public int getTargetPlaycount(); 
+    public void setTargetPlaycount(int playcount);
+    public int getCountPlayed();
+    public void setCountPlayed(int countPlayed);
+    public boolean isIncludeElement(); //erweiterung um daten durchzuschleusen für die TreeView
+    public boolean noexpandoninclude();
+    public int getGID();
+    
+}

+ 159 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/SinglePlayListItem.java

@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.API.shared;
+
+import java.util.Objects;
+
+/**
+ *
+ * @author LH
+ */
+public class SinglePlayListItem implements PlayListItem
+{
+    private String path,Title;
+    private int targetplaycount,countPlayed;
+    private boolean include,noexpandoninclude;
+    private int gid=0;
+    public SinglePlayListItem()
+    {
+    targetplaycount=1;
+    Title="";
+    path="";
+    countPlayed=0;
+    };
+    
+    public SinglePlayListItem(String path, String Title, int playcount)
+    {
+        this(path, Title, playcount, false,false);
+    }
+    
+    public SinglePlayListItem(String path, String Title, int playcount,boolean isInclude,boolean noexpandoninclude)
+    {
+        this.path = path;
+        this.Title = Title;
+        this.targetplaycount = playcount;
+        countPlayed=0; //noch nie gespielt als default; bei reload wird anderweitig verglichen :P
+        include=isInclude;
+        this.noexpandoninclude=noexpandoninclude;
+    }
+
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    public String getTitle()
+    {
+        return Title;
+    }
+
+    public void setTitle(String Title)
+    {
+        this.Title = Title;
+    }
+
+    public int getTargetPlaycount()
+    {
+        return targetplaycount;
+    }
+
+
+
+    public void setTargetPlaycount(int playcount)
+    {
+        this.targetplaycount = playcount;
+    }
+
+    public int getCountPlayed()
+    {
+        return countPlayed;
+    }
+
+    public void setCountPlayed(int countPlayed)
+    {
+        this.countPlayed = countPlayed;
+    }
+    
+    @Override
+    public String getM3UElement()
+    {
+        return "\n"+Title+"\n"+path;
+    }
+        @Override
+    public int hashCode()
+    {
+        int hash = 3;
+        hash = 23 * hash + Objects.hashCode(this.path);
+        hash = 23 * hash + Objects.hashCode(this.Title);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        final SinglePlayListItem other = (SinglePlayListItem) obj;
+        if (!Objects.equals(this.path, other.path))
+        {
+            return false;
+        }
+        return Objects.equals(this.Title, other.Title);
+    }
+
+    @Override
+    public boolean isIncludeElement()
+    {
+        return include;
+    }
+
+    @Override
+    public boolean noexpandoninclude()
+    {
+        return noexpandoninclude;
+    }
+    
+    public void setIncludeElements(boolean isInclude,boolean noExpand)
+    {
+        include=isInclude;
+        noexpandoninclude=noExpand;
+    }
+    
+    
+    public void setGID(int pgid)
+    {
+        gid=pgid;
+    }
+    
+    
+    @Override
+    public int getGID()
+    {
+        return gid;
+    }
+}

+ 338 - 0
izpl-shared/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java

@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package de.nplusc.izc.iZpl.Utils.shared;
+
+import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
+import de.nplusc.izc.iZpl.API.shared.MultiPlayListItem;
+import de.nplusc.izc.iZpl.API.shared.PlayListFile;
+import de.nplusc.izc.iZpl.API.shared.PlayListItem;
+import de.nplusc.izc.iZpl.API.shared.SinglePlayListItem;
+//import de.nplusc.izc.iZpl.Main;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class PLFileIO
+{
+    //Formatdefinition //basiert aufne verpackte #extm3u
+    /*
+    * #EXTM3U
+    * #iZPl
+    * #EXTINFO.......//Die VLC-Daten
+    * #IZPL:PrioMultiplier|GroupID (IDS !=0 sind Verbunden. 0er immer einzeln)
+    * /Pfad/zu/File1.mp3
+    * //Defaultet zu 1,0 falls nicht gefunden
+    * #IZPL:INCLUDE|PrioMultiplier|Expand//INCLUDE sagt dass hier ne referenzierte IZPL liegt Expand sagt Liste kann aufgeteilt werden
+    * /Pfad/zu/andererListe.iZpl //prioMultiplier bei include mutipliziert Multiopliers des Includes
+    * #IZPL:INCLUDE|PrioMultiplier|NoExpand //NoExpand sagt dass File Als ein Block behandelt werden muss (Includes innerhalb werden auch beachtet aber keine multiplizierungen eingebaut
+    * /Pfad/zu/UnsplittbarerListe.iZpl
+    */
+    
+    
+    private static Yaml y = new Yaml();
+    private static final Logger l = LogManager.getLogger();
+    public static List<SinglePlayListItem> readSingleList(String path) throws InvalidPlayListFileException
+    {
+        String plbd = new File(path).getParent()+File.separator;
+        l.trace("Location:{}",new File(path).getAbsolutePath());
+        try
+        {
+            boolean syntaxError=false;
+            BufferedReader fr = new BufferedReader(new FileReader(path));
+
+            if(!(fr.readLine().equalsIgnoreCase("#EXTM3U")))
+            {
+                l.error("Not a valid izpl or M3u-file");
+                return new ArrayList<>();
+            }
+            if(!fr.readLine().startsWith("#IZPL"))
+            {
+                l.info("plain M3u detected");
+            }
+            int lne=3;
+            ArrayList<SinglePlayListItem> returndata = new ArrayList<>();
+            String ln = fr.readLine();
+            boolean extinf=false;
+            SinglePlayListItem itm = new SinglePlayListItem();
+            while(ln!=null)
+            {
+                if(!ln.trim().equals(""))
+                {
+                    l.trace(ln);
+                    if(ln.startsWith("#IZPL"))
+                    {
+                        String[] meta = ln.split(":")[1].split("\\|");
+                        if(meta[0].equalsIgnoreCase("include"))
+                        {
+                            if(meta.length==3)
+                            {
+                                if(meta[2].equalsIgnoreCase("expand"))
+                                {
+                                    itm.setIncludeElements(true, false);
+                                }
+                                else
+                                {
+                                    if(meta[2].equalsIgnoreCase("noexpand"))
+                                    {
+                                         itm.setIncludeElements(true, true);
+                                    }
+                                    else
+                                    {
+                                        syntaxError=true;
+                                        l.error("Syntax error on line {} of file {}: {}",lne,path,"Include-Block haben nur Expand oder NoExpand als dritten block");
+                                        continue;
+                                    }
+                                }
+                                try
+                                {
+                                    int pr = Integer.valueOf(meta[1]);
+                                    if(pr<1)
+                                    {
+                                        throw new NumberFormatException();
+                                    }
+                                    itm.setTargetPlaycount(pr);
+                                }
+                                catch(NumberFormatException x)
+                                {
+                                    syntaxError=true;
+                                    l.error("Syntax error on line {} of file {}: {}",lne,path,"der 2. block bei Include muss eine positive Ganzzahl sein");
+                                    itm.setTargetPlaycount(1);
+                                }
+                            }
+                            else
+                            {
+                                syntaxError=true;
+                                l.error("Syntax error on line {} of file {}: {}",lne,path,"Include-Block braucht 2 weitere blöcke um korrekt zu sein");
+                            }
+                        }
+                        else
+                        {
+                            if(meta.length==2)
+                            {
+                                try
+                                {
+                                    int pr = Integer.valueOf(meta[0]);
+                                    if (pr < 1)
+                                    {
+                                        throw new NumberFormatException();
+                                    }
+                                    itm.setTargetPlaycount(pr);
+                                }
+                                catch (NumberFormatException x)
+                                {
+                                    syntaxError = true;
+                                    l.error("Syntax error on line {} of file {}: {}", lne, path, "Block1 muss eine Ganzzahl > 0 sein");
+                                    itm.setTargetPlaycount(1);
+                                }
+                                try
+                                {
+                                    l.trace(meta[1]);
+                                    int gid = Integer.valueOf(meta[1].trim());
+                                    if (gid < 0)
+                                    {
+                                        l.trace("NULL0");
+                                        throw new NumberFormatException();
+                                    }
+                                    itm.setGID(gid); 
+                                }
+                                catch (NumberFormatException x)
+                                {
+                                    syntaxError = true;
+                                    l.error("Syntax error on line {} of file {}: {}", lne, path, "Block2 muss eine Ganzzahl >=0 sein");
+                                    itm.setGID(0);
+                                }
+                            }
+                            else
+                            {
+                                syntaxError=true;
+                                l.error("Syntax error on line {} of file {}: {}",lne,path,"Could not determine Metadata block type");
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if(ln.startsWith("#EXTINF"))
+                        {
+                            extinf=true;
+                            itm.setTitle(ln);
+                        }
+                        else
+                        {
+                            if(!ln.startsWith("#"))
+                            {
+                                if(!extinf)
+                                {
+                                    itm.setTitle("#EXTINF,0,"+new File(ln).getName());
+                                }
+                                if(!(ln.substring(1).startsWith(":")||ln.startsWith(File.separator)))
+                                {
+                                    ln=plbd+ln;//relative pfade absolutisieren
+                                }
+                                itm.setPath(ln);
+                                returndata.add(itm);
+                                itm=new SinglePlayListItem();
+                                extinf=false;
+                            }
+                        }
+                    }
+                }
+                lne++;
+                ln=fr.readLine();
+            }
+            if(syntaxError)
+            {
+                throw new InvalidPlayListFileException();
+            }
+            return returndata;
+        }
+        catch (IOException ex)
+        {
+            return new ArrayList<>();
+        }
+    }
+    
+    public static List<PlayListItem> parseFullList(String path) throws InvalidPlayListFileException
+    {
+        return parseFullList(path, 40);
+    }
+    
+    
+    public static List<PlayListItem> parseFullList(String path,int rd) throws InvalidPlayListFileException
+    {
+        
+    HashMap<Integer,MultiPlayListItem> groups = new HashMap<>();
+    List<PlayListItem> result = new ArrayList<>();
+
+        List<SinglePlayListItem> rootList = readSingleList(path);
+        l.trace(y.dump(rootList));
+        for (SinglePlayListItem re : rootList)
+        {
+            if(re.isIncludeElement())
+            {
+                if(re.noexpandoninclude())
+                {
+                    MultiPlayListItem m = processNoExpandInclude(re.getPath(),rd);
+                    if(m!=null)
+                    {
+                        m.setTargetPlaycount(re.getTargetPlaycount());
+                        result.add(m);
+                    }
+                }
+                else
+                {
+                    List<PlayListItem> temp = parseFullList(re.getPath(),rd-1);
+                    temp.forEach((ple)->ple.setTargetPlaycount(ple.getTargetPlaycount()*re.getTargetPlaycount()));
+                    result.addAll(temp);
+                }
+            }
+            else
+            {
+                int gid=re.getGID();
+                if(gid==0)
+                {
+                    result.add(re);
+                }
+                else
+                {
+                    if(!groups.containsKey(gid))
+                    {
+                        groups.put(gid,new MultiPlayListItem());
+                    }
+                    MultiPlayListItem gt = groups.get(gid);
+                    gt.addItem(re);
+                }
+            }
+        }
+        return result;
+    }
+    
+    private static MultiPlayListItem processNoExpandInclude(String path,int rd) throws InvalidPlayListFileException
+    {
+        MultiPlayListItem mi = new MultiPlayListItem();
+        if(rd<0)
+        {
+            return null;
+        }
+        rd--;
+        List<SinglePlayListItem> raw = readSingleList(path);
+        for (SinglePlayListItem spi : raw)
+        {
+            if(spi.isIncludeElement())
+            {
+                mi.addItem(processNoExpandInclude(spi.getPath(), rd));
+            }
+            else
+            {
+                mi.addItem(spi);
+            }
+        }
+        return mi;
+    }
+    
+    public static void writePLFile(PlayListFile f)
+    {
+        Path p =  new File(f.getPath()).getParentFile().toPath();
+        try
+        {
+            String fp = f.getPath();
+            String pld = "#EXTM3U\n#IZPL\n";
+            for (SinglePlayListItem pli : f.getEntries())
+            {
+                String pathOfFile = p.relativize(new File(pli.getPath()).toPath()).toString();
+                
+                
+                if(pli.isIncludeElement())
+                {
+                    pld+="#IZPL:INCLUDE|"+pli.getTargetPlaycount()+"|"+(pli.noexpandoninclude()?"NOEXPAND":"EXPAND")+"\n"+pathOfFile+"\n";
+                }
+                else
+                {
+                    pld+=pli.getTitle()+"\n"+"#IZPL:"+pli.getTargetPlaycount()+"|"+pli.getGID()+"\n"+pathOfFile+"\n";
+                }
+            }
+            RandomAccessFile file = new RandomAccessFile(fp, "rw");
+            file.setLength(0);
+            file.write(pld.getBytes());
+        }
+        catch (IOException ex)
+        {
+            ex.printStackTrace();
+        }
+    }
+    
+    
+    
+    private PLFileIO()
+    {
+    }
+    
+    
+}

+ 1 - 1
settings.gradle

@@ -1,3 +1,3 @@
 include 'ToolKit','iZpl',  'IZSetup','WPCMgr','UpidTK', 'izstreamer', 'LogBlockHeatMapper','iZlaunch',
 'iZpaqSFX','MazeViewer','TWPUtil',"iZplPlugins:WMP","iZplPlugins:foobar2000_others","iZplPlugins:itunes","iZplPlugins:GameRadio",
-"iZplPlugins:Editor"
+"iZplPlugins:Editor","izpl-shared","iZpl-server"