forked from j62/ctbrec
Add migration of old pp settings to new pp steps
This commit is contained in:
parent
bccdf47a2e
commit
26b73322cc
|
@ -26,7 +26,10 @@ import com.squareup.moshi.Moshi;
|
|||
import ctbrec.io.FileJsonAdapter;
|
||||
import ctbrec.io.ModelJsonAdapter;
|
||||
import ctbrec.io.PostProcessorJsonAdapter;
|
||||
import ctbrec.recorder.postprocessing.DeleteTooShort;
|
||||
import ctbrec.recorder.postprocessing.PostProcessor;
|
||||
import ctbrec.recorder.postprocessing.RemoveKeepFile;
|
||||
import ctbrec.recorder.postprocessing.Script;
|
||||
import ctbrec.sites.Site;
|
||||
|
||||
public class Config {
|
||||
|
@ -95,10 +98,36 @@ public class Config {
|
|||
for (Site site : sites) {
|
||||
site.setEnabled(!settings.disabledSites.contains(site.getName()));
|
||||
}
|
||||
|
||||
migrateOldSettings();
|
||||
}
|
||||
|
||||
private void migrateOldSettings() {
|
||||
// 3.8.0 from maxResolution only to resolution range
|
||||
if(settings.minimumResolution == settings.maximumResolution && settings.minimumResolution == 0) {
|
||||
settings.minimumResolution = 0;
|
||||
settings.maximumResolution = 8640;
|
||||
}
|
||||
|
||||
// 3.10.0
|
||||
if (StringUtil.isNotBlank(settings.postProcessing)) {
|
||||
Script script = new Script();
|
||||
script.getConfig().put(Script.SCRIPT_EXECUTABLE, settings.postProcessing);
|
||||
script.getConfig().put(Script.SCRIPT_PARAMS, "${absoluteParentPath} ${absolutePath} ${modelName} ${siteName} ${epochSecond}");
|
||||
settings.postProcessors.add(script);
|
||||
settings.postProcessing = null;
|
||||
}
|
||||
if (settings.minimumLengthInSeconds > 0) {
|
||||
DeleteTooShort deleteTooShort = new DeleteTooShort();
|
||||
deleteTooShort.getConfig().put(DeleteTooShort.MIN_LEN_IN_SECS, Integer.toString(settings.minimumLengthInSeconds));
|
||||
settings.postProcessors.add(deleteTooShort);
|
||||
settings.minimumLengthInSeconds = 0;
|
||||
}
|
||||
if (settings.removeRecordingAfterPostProcessing) {
|
||||
RemoveKeepFile removeKeepFile = new RemoveKeepFile();
|
||||
settings.postProcessors.add(removeKeepFile);
|
||||
settings.removeRecordingAfterPostProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void makeBackup(File source) {
|
||||
|
|
|
@ -85,6 +85,7 @@ public class Settings {
|
|||
public String mfcModelsTableSortType = "";
|
||||
public String mfcPassword = "";
|
||||
public String mfcUsername = "";
|
||||
public int minimumLengthInSeconds = 0;
|
||||
public long minimumSpaceLeftInBytes = 0;
|
||||
public Map<String, String> modelNotes = new HashMap<>();
|
||||
public List<Model> models = new ArrayList<>();
|
||||
|
@ -93,6 +94,7 @@ public class Settings {
|
|||
public boolean onlineCheckSkipsPausedModels = false;
|
||||
public int overviewUpdateIntervalInSecs = 10;
|
||||
public String password = ""; // chaturbate password TODO maybe rename this onetime
|
||||
public String postProcessing = "";
|
||||
public int postProcessingThreads = 2;
|
||||
public List<PostProcessor> postProcessors = new ArrayList<>();
|
||||
public String proxyHost;
|
||||
|
@ -111,6 +113,7 @@ public class Settings {
|
|||
public String recordingsSortColumn = "";
|
||||
public String recordingsSortType = "";
|
||||
public boolean recordSingleFile = false;
|
||||
public boolean removeRecordingAfterPostProcessing = false;
|
||||
public boolean requireAuthentication = false;
|
||||
public String servletContext = "";
|
||||
public boolean showPlayerStarting = false;
|
||||
|
|
Loading…
Reference in New Issue