71 lines
1.3 KiB
Java
71 lines
1.3 KiB
Java
package com.jens.rhasspy.intentlauncher;
|
|
|
|
public class Starter
|
|
{
|
|
public static void main(String[] args)
|
|
{
|
|
if(!Settings.readSettings())
|
|
{
|
|
System.out.println("Settings could not be loaded.");
|
|
System.exit(1);
|
|
}
|
|
|
|
if(args.length == 0)
|
|
{
|
|
// Start daemon
|
|
RhasspyIntentWorker server = new RhasspyIntentWorker();
|
|
Thread t = new Thread(server);
|
|
t.start();
|
|
|
|
/*
|
|
* We just need to stay alive here. The thread just opened will do the actual work.
|
|
*/
|
|
/*while(true)
|
|
{
|
|
try
|
|
{
|
|
Thread.sleep(5000);
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
|
|
}
|
|
}*/
|
|
}
|
|
else
|
|
{
|
|
// for(int i=0; i<args.length; i++)
|
|
// System.out.println("Args " + String.valueOf(i) + ": " + args[i]);
|
|
|
|
switch(args[0])
|
|
{
|
|
case "-testEmailNotification":
|
|
testEmailNotification();
|
|
break;
|
|
case "-getVersion":
|
|
System.out.println(Settings.programVersion);
|
|
break;
|
|
default:
|
|
System.out.println("Unknown parameters.");
|
|
System.exit(1);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void testEmailNotification()
|
|
{
|
|
Settings.readSettings();
|
|
|
|
if(Miscellaneous.notifyAdminViaEmail("Test notification from " + Settings.programName + ".", true, 1))
|
|
{
|
|
System.out.println("Mail notification successfull.");
|
|
System.exit(0);
|
|
}
|
|
else
|
|
{
|
|
System.out.println("Mail notification failed.");
|
|
}
|
|
|
|
System.exit(7);
|
|
}
|
|
} |