Przeglądaj źródła

FixXx for gradle file (dependency cleanup) & progress on some refactoring
of the Playlist managment

LH 9 lat temu
rodzic
commit
595a4eebc8

+ 3 - 3
build.gradle

@@ -13,9 +13,9 @@ allprojects {
 		maven {
 			url "https://repository.apache.org/content/repositories/snapshots"
 		}
-		maven {
-			url "http://4thline.org/m2"
-		}
+		//maven {
+		//	url "http://4thline.org/m2"
+		//}
 		
 		maven { url "http://repo.gradle.org/gradle/libs-releases-local" }
 	}

+ 26 - 16
iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java

@@ -107,7 +107,25 @@ public class Main extends javax.swing.JFrame
         }
         catch (ParseException ex)
         {
-            l.error(ex.getMessage());
+            String msg = ex.getMessage();
+            System.err.println("Failed to parse the commandline");
+            if(msg!=null)
+            {
+                 System.err.println(msg);
+            }
+            else
+            {
+                 System.err.println("No further details given");
+            }
+            
+            try
+            {
+                CommandLineParsing.processCommandLine(new String[]{});
+            }
+            catch (ParseException ex1)
+            {
+                ex1.printStackTrace();
+            }
             System.exit(0);
         }
     }
@@ -212,8 +230,6 @@ public class Main extends javax.swing.JFrame
             spawnUI();
             return;
         }
-        
-        
         if (stts.firstrunmode)
         {
             java.awt.EventQueue.invokeLater(() ->
@@ -223,9 +239,6 @@ public class Main extends javax.swing.JFrame
                 frs.setVisible(true);
             });
         }
-        
-        
-        
         l.info("Loading the configs now");
         loadConfigs();
         if (CONFIG.isStandaloneMode())
@@ -237,7 +250,6 @@ public class Main extends javax.swing.JFrame
         p.initializePlugins(stts);
         l.info("Plugins initialized");
             //TODO:  GUI-Editor zum Erzeugen von iZpl-S
-
         mainProcessingStage2();
     }
 
@@ -348,7 +360,6 @@ public class Main extends javax.swing.JFrame
                 if (stts.burnDisc)
                 {
                     BurnMe.InitializeBurnDisc(stts.file_path);
-                    //quickQuit();
                 }
                 if (stts.firstrunmode || stts.loadConfigMode)
                 {
@@ -384,15 +395,13 @@ public class Main extends javax.swing.JFrame
         {
             isShittyPlayer = true;
         }
-
         try
         {
-
             l.trace("fpl|" + stts.forcePregen + "|shitmp|" + isShittyPlayer + "|a1|" + stts.file_path + "|vp|" + vlcpath);
             if (
                     (stts.filemode && !(stts.forcePregen || isShittyPlayer))                      ||
                     (stts.featurePluginMode&&p.getSelectedFeaturePlugin().requiresLoadedPlayList()))
-            {
+            {  //throw new CodeStatusError("404");
                 l.trace("usegui=" + stts.useGUI);
                 l.trace("featurePlugin=" + stts.featurePluginMode);
                 
@@ -652,6 +661,10 @@ public class Main extends javax.swing.JFrame
         return stts;
     }
 
+    
+    //V--nothing to see here
+    
+    //^--evil line doesnt need any code :P
     public static PluginManager getPluginManager()
     {
         return p;
@@ -659,10 +672,7 @@ public class Main extends javax.swing.JFrame
     
     
     //</editor-fold>
-    
-    //V--nothing to see here
-    
-    //^--evil line doesnt need any code :P
+
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private static javax.swing.JProgressBar pload;
     // End of variables declaration//GEN-END:variables
@@ -703,6 +713,6 @@ public class Main extends javax.swing.JFrame
      * V0.6.0.0 Editor basics, Bugfixxes & rewrite of the Reader code whic resides now in PLFileIO.java 
      * V0.7.0.0 Refactor of the main class to shrink it
      * V0.7.1.0 Fixes
-     * V0.8.0.0 Stream support & 
+     * V0.8.0.0 Stream support, fix related to a error message,
      */
 }

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

@@ -27,6 +27,10 @@ import java.util.Objects;
  */
 public class MultiPlayListItem implements PlayListItem
 {
+    
+    private String[] prefix;
+    private String[] innerComments;
+    
     private List<PlayListItem> containedElements=new ArrayList<>();
     
     private int playcount,countPlayed;
@@ -215,5 +219,17 @@ public class MultiPlayListItem implements PlayListItem
     {
        return 0;
     }
+
+    @Override
+    public String[] getPrefix()
+    {
+        return prefix;
+    }
+
+    @Override
+    public String[] getInnerCommentLines()
+    {
+        return innerComments;
+    }
     
 }

+ 4 - 1
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListFile.java

@@ -100,7 +100,10 @@ public class PlayListFile
         return "PlayListFile{" + "calculatedBasePriority=" + calculatedBasePriority + ", path=" + path + '}';
     }
     
-    
+    public String[] getSuffix()
+    {
+        return new String[]{};
+    }
     
     
 }

+ 2 - 1
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/PlayListItem.java

@@ -30,5 +30,6 @@ public interface PlayListItem
     public boolean isIncludeElement(); //erweiterung um daten durchzuschleusen für die TreeView
     public boolean noexpandoninclude();
     public int getGID();
-    
+    public String[] getPrefix();
+    public String[] getInnerCommentLines();
 }

+ 15 - 2
izpl-shared/src/main/java/de/nplusc/izc/iZpl/API/shared/RawPlayListFile.java

@@ -24,6 +24,8 @@ import java.util.List;
  */
 public class RawPlayListFile
 {
+    private String[] suffix;
+    
     private String rootPath;
     private List<SinglePlayListItem> data;
 
@@ -31,8 +33,16 @@ public class RawPlayListFile
     {
         this.rootPath = rootPath;
         this.data = data;
+        suffix = new String[]{};
     }
-
+    
+    public RawPlayListFile(String rootPath, List<SinglePlayListItem> data,String[] suffix)
+    {
+        this.rootPath = rootPath;
+        this.data = data;
+        this.suffix=suffix;
+    }
+    
     public String getRootPath()
     {
         return rootPath;
@@ -42,5 +52,8 @@ public class RawPlayListFile
     {
         return data;
     }
-    
+    public String[] getSuffix()
+    {
+        return suffix;
+    }
 }

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

@@ -24,6 +24,8 @@ import java.util.Objects;
  */
 public class SinglePlayListItem implements PlayListItem
 {
+    private String[] prefix;
+    private String[] innerComments;
     private String path,Title;
     private int targetplaycount,countPlayed;
     private boolean include,noexpandoninclude;
@@ -61,6 +63,15 @@ public class SinglePlayListItem implements PlayListItem
         this.path = path;
     }
 
+    public void setPrefix(String[] prefix)
+    {
+        this.prefix = prefix;
+    }
+    
+    public void setInlineCOmmentLines(String[] lines)
+    {
+        innerComments = lines;
+    }
     public String getTitle()
     {
         return Title;
@@ -156,4 +167,17 @@ public class SinglePlayListItem implements PlayListItem
     {
         return gid;
     }
+    @Override
+    public String[] getPrefix()
+    {
+        return prefix;
+    }
+
+    @Override
+    public String[] getInnerCommentLines()
+    {
+        return innerComments;
+    }
+    
+    
 }

+ 26 - 1
izpl-shared/src/main/java/de/nplusc/izc/iZpl/Utils/shared/PLFileIO.java

@@ -73,6 +73,7 @@ public class PLFileIO
 
             if(!(fr.readLine().equalsIgnoreCase("#EXTM3U")))
             {
+                //TODO redirect to external lib for converting to iZpl
                 l.error("Not a valid izpl or M3u-file");
                 return new RawPlayListFile("", new ArrayList<SinglePlayListItem>());
             }
@@ -110,6 +111,10 @@ public class PLFileIO
             
             boolean extinf=false;
             SinglePlayListItem itm = new SinglePlayListItem();
+            boolean encounteredParseableLine=false;
+            ArrayList<String> itmprefix = new ArrayList<>();
+            ArrayList<String> itmsuffix = new ArrayList<>();
+            ArrayList<String> tail = new ArrayList<>();
             while(ln!=null)
             {
                 if(!ln.trim().equals(""))
@@ -117,6 +122,7 @@ public class PLFileIO
                     l.trace(ln);
                     if(ln.startsWith("#IZPL"))
                     {
+                        encounteredParseableLine=true;
                         String[] meta = ln.split(":")[1].split("\\|");
                         if(meta[0].equalsIgnoreCase("include"))
                         {
@@ -211,6 +217,7 @@ public class PLFileIO
                         {
                             extinf=true;
                             itm.setTitle(ln);
+                            encounteredParseableLine=true;
                         }
                         else
                         {
@@ -225,9 +232,27 @@ public class PLFileIO
                                     ln=plbd+ln;//relative pfade absolutisieren
                                 }
                                 itm.setPath(ln);
+                                itm.setPrefix(itmprefix.toArray(new String[]{}));
+                                itm.setInlineCOmmentLines(itmprefix.toArray(new String[]{}));
                                 returndata.add(itm);
                                 itm=new SinglePlayListItem();
                                 extinf=false;
+                                itmprefix.clear();
+                                itmsuffix.clear();
+                                tail.clear();
+                            }
+                            else
+                            {
+                                if(encounteredParseableLine)
+                                {
+                                    tail.add(ln);
+                                    itmsuffix.add(ln);
+                                }
+                                else
+                                {
+                                    tail.add(ln);
+                                    itmprefix.add(ln);
+                                }
                             }
                         }
                     }
@@ -240,7 +265,7 @@ public class PLFileIO
                 throw new InvalidPlayListFileException();
             }
             fr.close();
-            return new RawPlayListFile(rootDir,returndata);
+            return new RawPlayListFile(rootDir,returndata,tail.toArray(new String[]{}));
         }
         catch (IOException ex)
         {