mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Moved ActionResult#message to top of toJson() for easier reading
Change Recording settings to accept an output file instead of directory and filename
This commit is contained in:
@@ -100,8 +100,8 @@ public class ActionResult<T> {
|
||||
public JsonObject toJson() {
|
||||
JsonObject map = new JsonObject();
|
||||
map.addProperty("success", success);
|
||||
map.add("content", gson.toJsonTree(content));
|
||||
map.addProperty("message", message);
|
||||
map.add("content", gson.toJsonTree(content));
|
||||
map.add("previous", hasPrevious() ? previous.toJson() : null);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,7 @@ public class RecorderListener implements LiveRecorder {
|
||||
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
var path = settings.getOutputPath() + File.separator + settings.getOutputFileName();
|
||||
var file = new File(path);
|
||||
var file = settings.getOutputFile();
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
|
||||
@@ -113,10 +112,9 @@ public class RecorderListener implements LiveRecorder {
|
||||
|
||||
var recordingStartedEvent = new TikTokLiveRecorderStartedEvent(downloadData);
|
||||
liveClient.publishEvent(recordingStartedEvent);
|
||||
if (recordingStartedEvent.isCanceled()) {
|
||||
if (recordingStartedEvent.isCanceled())
|
||||
liveClient.getLogger().info("Recording cancelled");
|
||||
return;
|
||||
}
|
||||
else
|
||||
liveDownloadThread.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.github.jwdeveloper.tiktok.extension.recorder.impl.enums.LiveFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Getter
|
||||
@@ -36,8 +37,7 @@ public class RecorderSettings {
|
||||
private String ffmpegPath;
|
||||
private String quality;
|
||||
private String format;
|
||||
private String outputPath;
|
||||
private String outputFileName;
|
||||
private File outputFile;
|
||||
private Function<String,DownloadData> prepareDownloadData;
|
||||
private boolean startOnConnected;
|
||||
private boolean stopOnDisconnect = true;
|
||||
|
||||
Reference in New Issue
Block a user