pull/149/head
FongMi 3 years ago
parent 073f9c7e2e
commit e0fa1cdf4c
  1. 2
      app/src/leanback/res/layout/dialog_buffer.xml
  2. 2
      app/src/main/java/com/fongmi/android/tv/Setting.java
  3. 1
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  4. 2
      app/src/mobile/res/layout/dialog_buffer.xml
  5. 49
      catvod/src/main/java/com/github/catvod/utils/Github.java

@ -14,7 +14,7 @@
android:nextFocusDown="@id/positive"
android:stepSize="1"
android:valueFrom="1"
android:valueTo="120"
android:valueTo="30"
app:thumbColor="@color/blue_500"
app:trackColorActive="@color/blue_500"
app:trackColorInactive="@color/blue_50" />

@ -215,7 +215,7 @@ public class Setting {
}
public static int getBuffer() {
return Math.max(Prefers.getInt("exo_buffer"), 1);
return Math.min(Math.max(Prefers.getInt("exo_buffer"), 1), 30);
}
public static void putBuffer(int buffer) {

@ -489,6 +489,7 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic
Uri uri = Uri.parse(Util.fixUrl(url));
String host = Util.host(uri);
String scheme = Util.scheme(uri);
if (scheme.equals("data")) return false;
return scheme.isEmpty() || scheme.equals("file") ? !Path.exists(url) : host.isEmpty();
}

@ -14,7 +14,7 @@
android:layout_height="wrap_content"
android:stepSize="1"
android:valueFrom="1"
android:valueTo="120"
android:valueTo="30"
app:trackColorInactive="@color/blue_50" />
</LinearLayout>

@ -1,60 +1,15 @@
package com.github.catvod.utils;
import android.text.TextUtils;
import com.github.catvod.net.OkHttp;
import java.io.File;
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.Response;
public class Github {
public static final int TIMEOUT = 5 * 1000;
public static final String A = "https://raw.githubusercontent.com/";
public static final String B = "https://fongmi.cachefly.net/";
public static final String C = "https://ghproxy.com/";
public static final String M = "FongMi/Release/main";
private final OkHttpClient client;
private String proxy;
private static class Loader {
static volatile Github INSTANCE = new Github();
}
private static Github get() {
return Loader.INSTANCE;
}
private Github() {
client = OkHttp.client(TIMEOUT);
check(A);
check(B);
check(C);
}
private void check(String url) {
try {
if (getProxy().length() > 0) return;
Response response = OkHttp.newCall(client, url).execute();
if (response.code() == 200) setProxy(url);
} catch (IOException ignored) {
}
}
private void setProxy(String url) {
this.proxy = url.equals(C) ? url + A + M : url + M;
}
private String getProxy() {
return TextUtils.isEmpty(proxy) ? A + M : proxy;
}
public static final String URL = "https://fongmi.cachefly.net/FongMi/Release/main";
private static String getUrl(String path, String name) {
return get().getProxy() + "/" + path + "/" + name;
return URL + "/" + path + "/" + name;
}
public static String getJson(boolean dev, String name) {

Loading…
Cancel
Save