|
@@ -53,17 +53,35 @@ import org.yaml.snakeyaml.Yaml;
|
|
|
*/
|
|
|
@SuppressWarnings("CallToPrintStackTrace")
|
|
|
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();
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * convenience object
|
|
|
+ */
|
|
|
+ public static final Yaml y = new Yaml();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * COnstant to get the config file path
|
|
|
+ */
|
|
|
public static final String CONFIGPATH = IZPLApi.APPDIR + File.separator + "config" + File.separator + "config.yml";
|
|
|
- public static final Yaml y = new Yaml();
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Constants for the different UImodes
|
|
|
+ */
|
|
|
public static final int UIMODE_NONE=0,UIMODE_OLD=1,UIMODE_NEW=2;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Reference to the configuration holder Object
|
|
|
+ */
|
|
|
+ public static Configuration CONFIG;
|
|
|
+
|
|
|
+ private static PluginManager p = new PluginManager();
|
|
|
+ private static Logger l;
|
|
|
+
|
|
|
private static boolean loadedVLC = false;
|
|
|
private static PLServer ps = null;
|
|
|
private static boolean issueDetected = false;
|
|
|
- public static Configuration CONFIG;
|
|
|
+
|
|
|
private static CommandLineStatus stts;
|
|
|
private static FirstRunScreen frs;
|
|
|
|
|
@@ -72,6 +90,7 @@ public class Main extends javax.swing.JFrame
|
|
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Gefruzel::Main">
|
|
|
/**
|
|
|
+ * Main entrypoint where the Program starts
|
|
|
* @param args the command line arguments
|
|
|
*/
|
|
|
@SuppressWarnings(
|
|
@@ -130,7 +149,7 @@ public class Main extends javax.swing.JFrame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void logStart()
|
|
|
+ private static void logStart()
|
|
|
{
|
|
|
if(l==null)
|
|
|
l=LogManager.getLogger(Main.class.getName());
|
|
@@ -140,12 +159,8 @@ public class Main extends javax.swing.JFrame
|
|
|
Runtime.getRuntime().addShutdownHook(new Shitdown());
|
|
|
}
|
|
|
|
|
|
- public static void setupLogging(boolean verbose)
|
|
|
+ static void setupLogging(boolean verbose)
|
|
|
{
|
|
|
- //if(!cl.hasOption("verbose")&&!(System.getProperty("log4j.configurationFile")==null))
|
|
|
- //{
|
|
|
- // System.setProperty("log4j.configurationFile", "file:///"+jarschiv+"!log4j2NonVerbose.xml");
|
|
|
- //}
|
|
|
l=LogManager.getLogger(Main.class.getName());
|
|
|
LoggerContext cx = (LoggerContext) LogManager.getContext(false);
|
|
|
org.apache.logging.log4j.core.config.Configuration config = cx.getConfiguration();
|
|
@@ -169,6 +184,17 @@ public class Main extends javax.swing.JFrame
|
|
|
|
|
|
|
|
|
// </editor-fold>
|
|
|
+ /**
|
|
|
+ * Internal method used by the MEnu UI to resume initializing
|
|
|
+ * @param pFfilemode
|
|
|
+ * @param pStatemode
|
|
|
+ * @param pFile iZpl-file to load
|
|
|
+ * @param pForcePregen Switch that tells iZpl to pregenerate a Playlist instead of using the normal mode
|
|
|
+ * @param pBurnDisc switch for the currently unused Disk burn mode
|
|
|
+ * @param pLoadConfigMode switch to show the config UI
|
|
|
+ * @param pFeatureMode switch to enable loading of featurePlugin
|
|
|
+ * @param pFeaturePluginID ID of the featureplugin that gets used
|
|
|
+ */
|
|
|
public static void UIMain(boolean pFfilemode,boolean pStatemode,String pFile,boolean pForcePregen,
|
|
|
boolean pBurnDisc,boolean pLoadConfigMode,boolean pFeatureMode,String pFeaturePluginID)
|
|
|
{
|
|
@@ -191,7 +217,7 @@ public class Main extends javax.swing.JFrame
|
|
|
mainProcessing();
|
|
|
}
|
|
|
|
|
|
- public static void spawnUI()
|
|
|
+ static void spawnUI()
|
|
|
{
|
|
|
p.pluginInitCore(); //sorgt dafür dass plugins bereits registriert sind
|
|
|
EventQueue.invokeLater(()->{
|
|
@@ -249,7 +275,7 @@ public class Main extends javax.swing.JFrame
|
|
|
l.info("Initializing the plugins now. This may take a while");
|
|
|
p.initializePlugins(stts);
|
|
|
l.info("Plugins initialized");
|
|
|
- //TODO: GUI-Editor zum Erzeugen von iZpl-S
|
|
|
+ //TODO: GUI-Editor zum Erzeugen von iZpl-S; TODO: preserve other comments in M3u
|
|
|
mainProcessingStage2();
|
|
|
}
|
|
|
|
|
@@ -375,7 +401,7 @@ public class Main extends javax.swing.JFrame
|
|
|
|
|
|
private static void startup()
|
|
|
{
|
|
|
- String time = "";
|
|
|
+ String time = "";//throw new CodeStatusError("404");
|
|
|
|
|
|
time = new Date(System.currentTimeMillis()).toString();
|
|
|
l.info("IZPL-Core:initialized at:" + time);
|
|
@@ -401,7 +427,7 @@ public class Main extends javax.swing.JFrame
|
|
|
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);
|
|
|
|
|
@@ -564,7 +590,10 @@ public class Main extends javax.swing.JFrame
|
|
|
l.trace("usegui=" + stts.useGUI);
|
|
|
ps = new PLServer(pp, !stts.useGUI);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * Triggers a save of the state then exiting the program
|
|
|
+ * @param isShittyPlayer parameter that tells if the Program detected a player incompatible with the pregeneration mode
|
|
|
+ */
|
|
|
public static void checkpointedExit(boolean isShittyPlayer)
|
|
|
{
|
|
|
l.trace("<<<");
|
|
@@ -579,7 +608,9 @@ public class Main extends javax.swing.JFrame
|
|
|
}
|
|
|
quickQuit();
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * Convenience method that cleans up the temporary data and then exits
|
|
|
+ */
|
|
|
public static void quickQuit()
|
|
|
{
|
|
|
TFile killme = new TFile(IZPLApi.TEMPDIR);
|
|
@@ -626,45 +657,75 @@ public class Main extends javax.swing.JFrame
|
|
|
pack();
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
|
|
- public Main()
|
|
|
+ Main()
|
|
|
{
|
|
|
initComponents();
|
|
|
}
|
|
|
+
|
|
|
+ //V--nothing to see here
|
|
|
+
|
|
|
+ //^--evil line doesnt need any code :P
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static PLServer getPLServer()
|
|
|
{
|
|
|
return ps;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static void gotAIssue()
|
|
|
{
|
|
|
gotAIssue(true);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static void gotAIssue(boolean issue)
|
|
|
{
|
|
|
issueDetected = issue;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static Image getPlayListIcon()
|
|
|
{
|
|
|
return playListIcon;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static boolean isFilemode()
|
|
|
{
|
|
|
return stts.filemode;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static boolean isStatefile()
|
|
|
{
|
|
|
return stts.statefile;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static CommandLineStatus getStts()
|
|
|
{
|
|
|
return stts;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- //V--nothing to see here
|
|
|
|
|
|
- //^--evil line doesnt need any code :P
|
|
|
+ /**
|
|
|
+ * Internal method for the API
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public static PluginManager getPluginManager()
|
|
|
{
|
|
|
return p;
|
|
@@ -713,6 +774,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, fix related to a error message,
|
|
|
+ * V0.8.0.0 Stream support, fix related to a error message, Refactors and code documentation
|
|
|
*/
|
|
|
}
|