diff --git a/app/src/main/java/com/fongmi/android/tv/player/extractor/JianPian.java b/app/src/main/java/com/fongmi/android/tv/player/extractor/JianPian.java index 1924801a0..c97208cb3 100644 --- a/app/src/main/java/com/fongmi/android/tv/player/extractor/JianPian.java +++ b/app/src/main/java/com/fongmi/android/tv/player/extractor/JianPian.java @@ -2,7 +2,6 @@ package com.fongmi.android.tv.player.extractor; import android.net.Uri; -import com.fongmi.android.tv.App; import com.fongmi.android.tv.BuildConfig; import com.fongmi.android.tv.player.Source; import com.fongmi.android.tv.utils.Github; @@ -26,10 +25,10 @@ public class JianPian implements Source.Extractor { private void init() throws Exception { if (p2p != null) return; - File file = Path.so("p2p-jp-" + BuildConfig.FLAVOR_abi); + File file = Path.so("jpa_" + BuildConfig.FLAVOR_abi); String path = Github.get().getReleasePath("/other/jniLibs/" + file.getName()); if (!file.exists()) Path.write(file, OkHttp.newCall(path).execute().body().bytes()); - p2p = new P2PClass(App.get(), file.getAbsolutePath()); + p2p = new P2PClass(file.getAbsolutePath()); } @Override diff --git a/catvod/src/main/java/com/github/catvod/utils/Path.java b/catvod/src/main/java/com/github/catvod/utils/Path.java index 8ba0e6e82..5751bcfe2 100644 --- a/catvod/src/main/java/com/github/catvod/utils/Path.java +++ b/catvod/src/main/java/com/github/catvod/utils/Path.java @@ -42,14 +42,6 @@ public class Path { return root().getAbsolutePath(); } - public static String cachePath() { - return cache().getAbsolutePath(); - } - - public static String filesPath() { - return files().getAbsolutePath(); - } - public static File so() { return check(new File(files() + File.separator + "so")); } @@ -58,6 +50,10 @@ public class Path { return check(new File(cache() + File.separator + "js")); } + public static File py() { + return check(new File(cache() + File.separator + "py")); + } + public static File jar() { return check(new File(cache() + File.separator + "jar")); } @@ -70,6 +66,10 @@ public class Path { return check(new File(cache() + File.separator + "exo")); } + public static File jpa() { + return check(new File(cache() + File.separator + "jpa")); + } + public static File thunder() { return check(new File(cache() + File.separator + "thunder")); } diff --git a/jianpian/build.gradle b/jianpian/build.gradle index 6b02e8dc7..a3fd7cbb8 100644 --- a/jianpian/build.gradle +++ b/jianpian/build.gradle @@ -11,4 +11,8 @@ android { //noinspection ChromeOsAbiSupport ndk { abiFilters "armeabi-v7a" } } +} + +dependencies { + implementation project(':catvod') } \ No newline at end of file diff --git a/jianpian/src/main/java/com/p2p/P2PClass.java b/jianpian/src/main/java/com/p2p/P2PClass.java index 485eb77e2..0077f6dac 100644 --- a/jianpian/src/main/java/com/p2p/P2PClass.java +++ b/jianpian/src/main/java/com/p2p/P2PClass.java @@ -1,27 +1,14 @@ package com.p2p; -import android.content.Context; - -import java.io.File; +import com.github.catvod.utils.Path; public class P2PClass { public int port; - public P2PClass(Context context, String lib) { + public P2PClass(String lib) { System.load(lib); - init(context); - } - - private void init(Context context) { - try { - String path = context.getCacheDir().getAbsolutePath(); - File file = new File(path + File.separator + "jpali"); - if (!file.exists()) file.mkdirs(); - port = P2Pdoxstarthttpd("TEST3E63BAAECDAA79BEAA91853490A69F08".getBytes(), path.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } + this.port = P2Pdoxstarthttpd("TEST3E63BAAECDAA79BEAA91853490A69F08".getBytes(), Path.jpa().getAbsolutePath().getBytes()); } public int P2Pdoxstarthttpd(byte[] bArr, byte[] bArr2) { diff --git a/pyramid/src/main/java/com/undcover/freedom/pyramid/Loader.java b/pyramid/src/main/java/com/undcover/freedom/pyramid/Loader.java index 47a7272a7..4ec426607 100644 --- a/pyramid/src/main/java/com/undcover/freedom/pyramid/Loader.java +++ b/pyramid/src/main/java/com/undcover/freedom/pyramid/Loader.java @@ -7,6 +7,7 @@ import androidx.annotation.Keep; import com.chaquo.python.PyObject; import com.chaquo.python.Python; import com.chaquo.python.android.AndroidPlatform; +import com.github.catvod.utils.Path; public class Loader { @@ -16,8 +17,8 @@ public class Loader { @Keep private void init(Context context) { if (!Python.isStarted()) Python.start(new AndroidPlatform(context)); - cache = context.getCacheDir().getAbsolutePath() + "/plugin/"; app = Python.getInstance().getModule("app"); + cache = Path.py().getAbsolutePath(); } @Keep diff --git a/pyramid/src/main/python/app.py b/pyramid/src/main/python/app.py index 132d7b89a..ad5d33b2c 100644 --- a/pyramid/src/main/python/app.py +++ b/pyramid/src/main/python/app.py @@ -30,8 +30,7 @@ def download_file(name, ext): def init_py(path, name, ext): - create_file(path) - py_name = path + name + '.py' + py_name = path + '/' + name + '.py' download_file(py_name, ext) return SourceFileLoader(name, py_name).load_module().Spider()