mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 21:29:00 +00:00

Look, this will make the git history look funny, but trimming unnecessary depth from the source tree is a very necessary sanity-preserving measure when dealing with a super-modularized codebase like this one. While it makes the project configuration a bit less conventional, it will save you several clicks every time you jump between modules. Which you'll do a lot, because it's *modul*ar. The src/main/java convention makes a lot of sense for a non-modular project though. This ain't that.
70 lines
2.1 KiB
Java
70 lines
2.1 KiB
Java
package nu.marginalia.mqapi.converting;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import nu.marginalia.storage.model.FileStorageId;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
@AllArgsConstructor
|
|
public class ConvertRequest {
|
|
public final ConvertAction action;
|
|
public final String inputSource;
|
|
public final FileStorageId crawlStorage;
|
|
public final FileStorageId processedDataStorage;
|
|
public final String baseUrl;
|
|
|
|
public Path getInputPath() {
|
|
if (inputSource == null)
|
|
return null;
|
|
|
|
return Path.of(inputSource);
|
|
}
|
|
|
|
public static ConvertRequest forCrawlData(FileStorageId sourceId, FileStorageId destId) {
|
|
return new ConvertRequest(
|
|
ConvertAction.ConvertCrawlData,
|
|
null,
|
|
sourceId,
|
|
destId,
|
|
null
|
|
);
|
|
}
|
|
|
|
public static ConvertRequest forEncyclopedia(Path sourcePath, String baseUrl, FileStorageId destId) {
|
|
return new ConvertRequest(ConvertAction.SideloadEncyclopedia,
|
|
sourcePath.toString(),
|
|
null,
|
|
destId,
|
|
baseUrl);
|
|
}
|
|
|
|
public static ConvertRequest forDirtree(Path sourcePath, FileStorageId destId) {
|
|
return new ConvertRequest(ConvertAction.SideloadDirtree,
|
|
sourcePath.toString(),
|
|
null,
|
|
destId,
|
|
null);
|
|
}
|
|
public static ConvertRequest forWarc(Path sourcePath, FileStorageId destId) {
|
|
return new ConvertRequest(ConvertAction.SideloadWarc,
|
|
sourcePath.toString(),
|
|
null,
|
|
destId,
|
|
null);
|
|
}
|
|
public static ConvertRequest forReddit(Path sourcePath, FileStorageId destId) {
|
|
return new ConvertRequest(ConvertAction.SideloadReddit,
|
|
sourcePath.toString(),
|
|
null,
|
|
destId,
|
|
null);
|
|
}
|
|
public static ConvertRequest forStackexchange(Path sourcePath, FileStorageId destId) {
|
|
return new ConvertRequest(ConvertAction.SideloadStackexchange,
|
|
sourcePath.toString(),
|
|
null,
|
|
destId,
|
|
null);
|
|
}
|
|
}
|