@Override protected void initFromConfig() { myTranscoderTable.removeAllItems(); for (TranscoderConfig transcoderConfig : myTranscoderConfigs) { addTranscoderConfigTableItem(transcoderConfig); } myTranscodingCacheMaxGiB.setValue(MyTunesRss.CONFIG.getTranscodingCacheMaxGiB(), 1, 1024, "1"); myHttpLiveStreamCacheMaxGiB.setValue( MyTunesRss.CONFIG.getHttpLiveStreamCacheMaxGiB(), 1, 1024, "5"); myVlcEnabled.setValue(MyTunesRss.CONFIG.isVlcEnabled()); myVlcBinary.setValue( MyTunesRss.CONFIG.getVlcExecutable() != null ? MyTunesRss.CONFIG.getVlcExecutable().getAbsolutePath() : ""); setTablePageLengths(); }
@Override protected void writeToConfig() { int maxGiB = myTranscodingCacheMaxGiB.getIntegerValue(1); MyTunesRss.CONFIG.setTranscodingCacheMaxGiB(maxGiB); MyTunesRss.TRANSCODER_CACHE.setMaxSizeBytes((long) maxGiB * 1024L * 1024L * 1024L); maxGiB = myHttpLiveStreamCacheMaxGiB.getIntegerValue(5); MyTunesRss.CONFIG.setHttpLiveStreamCacheMaxGiB(maxGiB); MyTunesRss.HTTP_LIVE_STREAMING_CACHE.setMaxSizeBytes((long) maxGiB * 1024L * 1024L * 1024L); String vlcBinary = myVlcBinary.getStringValue(null); File vlcExecutable = vlcBinary != null ? new File(vlcBinary) : null; if (vlcExecutable != null && vlcExecutable.isDirectory() && SystemUtils.IS_OS_MAC_OSX && "vlc.app".equalsIgnoreCase(vlcExecutable.getName())) { vlcExecutable = new File(vlcExecutable, "Contents/MacOS/VLC"); } MyTunesRss.CONFIG.setVlcExecutable(vlcExecutable); MyTunesRss.CONFIG.setVlcEnabled(myVlcEnabled.booleanValue()); Set<TranscoderConfig> deletedTranscoders = new HashSet<>(); for (TranscoderConfig transcoderConfig : MyTunesRss.CONFIG.getTranscoderConfigs()) { deletedTranscoders.add(transcoderConfig); } for (TranscoderConfig transcoderConfig : myTranscoderConfigs) { deletedTranscoders.remove(transcoderConfig); } for (TranscoderConfig deletedTranscoder : deletedTranscoders) { LOGGER.debug( "Transcoder config \"" + deletedTranscoder.getName() + "\" has been removed, truncating cache."); MyTunesRss.TRANSCODER_CACHE.deleteByPrefix(deletedTranscoder.getCacheFilePrefix()); } MyTunesRss.CONFIG.setTranscoderConfigs(myTranscoderConfigs); MyTunesRss.CONFIG.save(); }
@Override protected boolean beforeReset() { myTranscoderNumberGenerator.set(1); myTranscoderConfigs = new ArrayList<>(); for (TranscoderConfig transcoderConfig : MyTunesRss.CONFIG.getTranscoderConfigs()) { try { myTranscoderConfigs.add((TranscoderConfig) transcoderConfig.clone()); } catch (CloneNotSupportedException e) { throw new RuntimeException("Could not clone transcoder config!", e); } } return true; }
@Override protected boolean beforeSave() { boolean valid = VaadinUtils.isValid( myGraphicsMagickForm, myMainWindowForm, myMyTunesRssComForm, myWebInterfaceForm, myProxyForm, mySmtpForm); if (!valid) { ((MainWindow) VaadinUtils.getApplicationWindow(this)).showError("error.formInvalid"); } else { if (MyTunesRss.CONFIG.isHeadless() != myHeadless.booleanValue()) { ((MainWindow) VaadinUtils.getApplicationWindow(this)) .showWarning("miscConfigPanel.warning.headlessChanged"); } } return valid; }
@Override protected void writeToConfig() { MyTunesRss.CONFIG.setWebLoginMessage(myWebLoginMessage.getStringValue(null)); MyTunesRss.CONFIG.setWebWelcomeMessage(myWebWelcomeMessage.getStringValue(null)); MyTunesRss.CONFIG.setServerBrowserActive(myServerBrowserActive.booleanValue()); MyTunesRss.CONFIG.setOpenIdActive(myOpenIdActive.booleanValue()); MyTunesRss.CONFIG.setProxyHost(myProxyHost.getStringValue(null)); MyTunesRss.CONFIG.setProxyPort(myProxyPort.getIntegerValue(-1)); MyTunesRss.CONFIG.setMailHost(myMailHost.getStringValue(null)); MyTunesRss.CONFIG.setMailPort(myMailPort.getIntegerValue(-1)); MyTunesRss.CONFIG.setSmtpProtocol((SmtpProtocol) mySmtpProtocol.getValue()); MyTunesRss.CONFIG.setMailLogin(myMailLogin.getStringValue(null)); MyTunesRss.CONFIG.setMailPassword(myMailPassword.getStringValue(null)); MyTunesRss.CONFIG.setMailSender(myMailSender.getStringValue(null)); MyTunesRss.CONFIG.setHeadless(myHeadless.booleanValue()); String gmBinary = myGraphicsMagickBinary.getStringValue(null); MyTunesRss.CONFIG.setGmExecutable(gmBinary != null ? new File(gmBinary) : null); MyTunesRss.CONFIG.setGmEnabled(myGraphicsMagickEnabled.booleanValue()); MyTunesRss.CONFIG.save(); }
@Override protected void initFromConfig() { myWebLoginMessage.setValue(MyTunesRss.CONFIG.getWebLoginMessage()); myWebWelcomeMessage.setValue(MyTunesRss.CONFIG.getWebWelcomeMessage()); myServerBrowserActive.setValue(MyTunesRss.CONFIG.isServerBrowserActive()); myOpenIdActive.setValue(MyTunesRss.CONFIG.isOpenIdActive()); myProxyHost.setValue(MyTunesRss.CONFIG.getProxyHost()); myProxyPort.setValue(MyTunesRss.CONFIG.getProxyPort(), 1, 65535, ""); myMailHost.setValue(MyTunesRss.CONFIG.getMailHost()); myMailPort.setValue(MyTunesRss.CONFIG.getMailPort(), 1, 65535, ""); mySmtpProtocol.setValue(MyTunesRss.CONFIG.getSmtpProtocol()); myMailLogin.setValue(MyTunesRss.CONFIG.getMailLogin()); myMailPassword.setValue(MyTunesRss.CONFIG.getMailPassword()); myMailSender.setValue(MyTunesRss.CONFIG.getMailSender()); myHeadless.setValue(MyTunesRss.CONFIG.isHeadless()); myGraphicsMagickEnabled.setValue(MyTunesRss.CONFIG.isGmEnabled()); myGraphicsMagickBinary.setValue( MyTunesRss.CONFIG.getGmExecutable() != null ? MyTunesRss.CONFIG.getGmExecutable().getAbsolutePath() : ""); }
@Override protected void writeToConfig() { MyTunesRss.CONFIG.setAdminEmail(myAdminEmail.getStringValue(null)); MyTunesRss.CONFIG.setNotifyOnDatabaseUpdate((Boolean) myNotifyOnDatabaseUpdate.getValue()); MyTunesRss.CONFIG.setNotifyOnEmailChange((Boolean) myNotifyOnEmailChange.getValue()); MyTunesRss.CONFIG.setNotifyOnInternalError((Boolean) myNotifyOnInternalError.getValue()); MyTunesRss.CONFIG.setNotifyOnLoginFailure((Boolean) myNotifyOnLoginFailure.getValue()); MyTunesRss.CONFIG.setNotifyOnMissingFile((Boolean) myNotifyOnMissingFile.getValue()); MyTunesRss.CONFIG.setNotifyOnPasswordChange((Boolean) myNotifyOnPasswordChange.getValue()); MyTunesRss.CONFIG.setNotifyOnQuotaExceeded((Boolean) myNotifyOnQuotaExceeded.getValue()); MyTunesRss.CONFIG.setNotifyOnTranscodingFailure( (Boolean) myNotifyOnTranscodingFailure.getValue()); MyTunesRss.CONFIG.setNotifyOnWebUpload((Boolean) myNotifyOnWebUpload.getValue()); MyTunesRss.CONFIG.setNotifyOnOutdatedItunesXml( (Boolean) myNotifyOnOutdatedItunesXml.getValue()); MyTunesRss.CONFIG.setNotifyOnSkippedDatabaseUpdate( (Boolean) myNotifyOnSkippedDatabaseUpdate.getValue()); MyTunesRss.CONFIG.save(); }
@Override protected void initFromConfig() { myAdminEmail.setValue(MyTunesRss.CONFIG.getAdminEmail()); myNotifyOnDatabaseUpdate.setValue(MyTunesRss.CONFIG.isNotifyOnDatabaseUpdate()); myNotifyOnEmailChange.setValue(MyTunesRss.CONFIG.isNotifyOnEmailChange()); myNotifyOnInternalError.setValue(MyTunesRss.CONFIG.isNotifyOnInternalError()); myNotifyOnLoginFailure.setValue(MyTunesRss.CONFIG.isNotifyOnLoginFailure()); myNotifyOnMissingFile.setValue(MyTunesRss.CONFIG.isNotifyOnMissingFile()); myNotifyOnPasswordChange.setValue(MyTunesRss.CONFIG.isNotifyOnPasswordChange()); myNotifyOnQuotaExceeded.setValue(MyTunesRss.CONFIG.isNotifyOnQuotaExceeded()); myNotifyOnTranscodingFailure.setValue(MyTunesRss.CONFIG.isNotifyOnTranscodingFailure()); myNotifyOnWebUpload.setValue(MyTunesRss.CONFIG.isNotifyOnWebUpload()); myNotifyOnOutdatedItunesXml.setValue(MyTunesRss.CONFIG.isNotifyOnOutdatedItunesXml()); myNotifyOnSkippedDatabaseUpdate.setValue(MyTunesRss.CONFIG.isNotifyOnSkippedDatabaseUpdate()); }