Change casing and extract constant
Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
This commit is contained in:
@@ -131,6 +131,8 @@ public class SettingsService {
|
|||||||
private static final String KEY_DATABASE_MYSQL_VARCHAR_MAXLENGTH = "DatabaseMysqlMaxlength";
|
private static final String KEY_DATABASE_MYSQL_VARCHAR_MAXLENGTH = "DatabaseMysqlMaxlength";
|
||||||
private static final String KEY_DATABASE_USERTABLE_QUOTE = "DatabaseUsertableQuote";
|
private static final String KEY_DATABASE_USERTABLE_QUOTE = "DatabaseUsertableQuote";
|
||||||
|
|
||||||
|
private static final String KEY_UPNP_PORT = "UPNP_PORT";
|
||||||
|
|
||||||
// Default values.
|
// Default values.
|
||||||
private static final String DEFAULT_JWT_KEY = null;
|
private static final String DEFAULT_JWT_KEY = null;
|
||||||
private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)";
|
private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)";
|
||||||
@@ -289,9 +291,9 @@ public class SettingsService {
|
|||||||
public static String getDefaultJDBCUrl() {
|
public static String getDefaultJDBCUrl() {
|
||||||
return "jdbc:hsqldb:file:" + getAirsonicHome().getPath() + "/db/" + getFileSystemAppName();
|
return "jdbc:hsqldb:file:" + getAirsonicHome().getPath() + "/db/" + getFileSystemAppName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getDefaultUPnpPort() {
|
public static int getDefaultUPnPPort() {
|
||||||
return Optional.ofNullable(System.getProperty("UPNP_PORT")).map(x -> Integer.parseInt(x)).orElse(DEFAULT_UPNP_PORT);
|
return Optional.ofNullable(System.getProperty(KEY_UPNP_PORT)).map(x -> Integer.parseInt(x)).orElse(DEFAULT_UPNP_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getLogFile() {
|
public static File getLogFile() {
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ public class UPnPService {
|
|||||||
try {
|
try {
|
||||||
LOG.info("Starting UPnP service...");
|
LOG.info("Starting UPnP service...");
|
||||||
createService();
|
createService();
|
||||||
LOG.info("Successfully started UPnP service on port {}!", SettingsService.getDefaultUPnpPort());
|
LOG.info("Successfully started UPnP service on port {}!", SettingsService.getDefaultUPnPPort());
|
||||||
} catch (Throwable x) {
|
} catch (Throwable x) {
|
||||||
LOG.error("Failed to start UPnP service: " + x, x);
|
LOG.error("Failed to start UPnP service: " + x, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void createService() {
|
private synchronized void createService() {
|
||||||
upnpService = new UpnpServiceImpl(new DefaultUpnpServiceConfiguration(SettingsService.getDefaultUPnpPort()));
|
upnpService = new UpnpServiceImpl(new DefaultUpnpServiceConfiguration(SettingsService.getDefaultUPnPPort()));
|
||||||
|
|
||||||
// Asynch search for other devices (most importantly UPnP-enabled routers for port-mapping)
|
// Asynch search for other devices (most importantly UPnP-enabled routers for port-mapping)
|
||||||
upnpService.getControlPoint().search();
|
upnpService.getControlPoint().search();
|
||||||
|
|||||||
Reference in New Issue
Block a user