mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-10 11:06:47 +01:00
fix submitting for other locales
This commit is contained in:
parent
bd9a324afa
commit
3a676d364b
@ -1,5 +1,9 @@
|
|||||||
package pl.jakubweg.requests;
|
package pl.jakubweg.requests;
|
||||||
|
|
||||||
|
import static pl.jakubweg.SponsorBlockUtils.timeWithoutSegments;
|
||||||
|
import static pl.jakubweg.SponsorBlockUtils.videoHasSegments;
|
||||||
|
import static pl.jakubweg.StringRef.str;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -18,6 +22,7 @@ import java.net.HttpURLConnection;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import pl.jakubweg.SponsorBlockSettings;
|
import pl.jakubweg.SponsorBlockSettings;
|
||||||
import pl.jakubweg.SponsorBlockUtils;
|
import pl.jakubweg.SponsorBlockUtils;
|
||||||
@ -25,12 +30,8 @@ import pl.jakubweg.SponsorBlockUtils.VoteOption;
|
|||||||
import pl.jakubweg.objects.SponsorSegment;
|
import pl.jakubweg.objects.SponsorSegment;
|
||||||
import pl.jakubweg.objects.UserStats;
|
import pl.jakubweg.objects.UserStats;
|
||||||
|
|
||||||
import static pl.jakubweg.SponsorBlockUtils.timeWithoutSegments;
|
|
||||||
import static pl.jakubweg.SponsorBlockUtils.videoHasSegments;
|
|
||||||
import static pl.jakubweg.StringRef.str;
|
|
||||||
|
|
||||||
public class Requester {
|
public class Requester {
|
||||||
private static final String SPONSORBLOCK_API_URL = "https://sponsor.ajay.app/api/";
|
private static final String SPONSORBLOCK_API_URL = "http://10.0.2.2/api/";
|
||||||
private static final String TIME_TEMPLATE = "%.3f";
|
private static final String TIME_TEMPLATE = "%.3f";
|
||||||
|
|
||||||
private Requester() {}
|
private Requester() {}
|
||||||
@ -73,8 +74,8 @@ public class Requester {
|
|||||||
|
|
||||||
public static void submitSegments(String videoId, String uuid, float startTime, float endTime, String category, Runnable toastRunnable) {
|
public static void submitSegments(String videoId, String uuid, float startTime, float endTime, String category, Runnable toastRunnable) {
|
||||||
try {
|
try {
|
||||||
String start = String.format(TIME_TEMPLATE, startTime);
|
String start = String.format(Locale.US, TIME_TEMPLATE, startTime);
|
||||||
String end = String.format(TIME_TEMPLATE, endTime);
|
String end = String.format(Locale.US, TIME_TEMPLATE, endTime);
|
||||||
HttpURLConnection connection = getConnectionFromRoute(Route.SUBMIT_SEGMENTS, videoId, uuid, start, end, category);
|
HttpURLConnection connection = getConnectionFromRoute(Route.SUBMIT_SEGMENTS, videoId, uuid, start, end, category);
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package pl.jakubweg.requests;
|
package pl.jakubweg.requests;
|
||||||
|
|
||||||
import pl.jakubweg.SponsorBlockUtils;
|
import static pl.jakubweg.requests.Route.Method.GET;
|
||||||
|
import static pl.jakubweg.requests.Route.Method.POST;
|
||||||
|
|
||||||
import static pl.jakubweg.requests.Route.Method.*;
|
import pl.jakubweg.SponsorBlockUtils;
|
||||||
|
|
||||||
public class Route {
|
public class Route {
|
||||||
public static final Route GET_SEGMENTS = new Route(GET, "skipSegments?videoID={video_id}&categories={categories}");
|
public static final Route GET_SEGMENTS = new Route(GET, "skipSegments?videoID={video_id}&categories={categories}");
|
||||||
@ -53,10 +54,6 @@ public class Route {
|
|||||||
this.compiledRoute = compiledRoute;
|
this.compiledRoute = compiledRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Route getBaseRoute() {
|
|
||||||
return baseRoute;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCompiledRoute() {
|
public String getCompiledRoute() {
|
||||||
return compiledRoute;
|
return compiledRoute;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user