pull/589/head
FongMi 8 months ago
parent 2ce9b3636a
commit a36567a1b2
  1. BIN
      app/libs/tvbus-release.aar
  2. 26
      app/src/main/java/com/fongmi/android/tv/player/extractor/TVBus.java
  3. 22
      tvbus/src/main/java/com/tvbus/engine/TVCore.java

Binary file not shown.

@ -30,30 +30,26 @@ public class TVBus implements Source.Extractor, Listener {
}
private void init(Core core) {
App.get().setHook(core.getHook());
tvcore = new TVCore(getPath(core.getSo())).listener(this);
tvcore.auth(core.getAuth()).name(core.getName()).pass(core.getPass());
tvcore.domain(core.getDomain()).broker(core.getBroker()).serv(0).play(8902).mode(1);
tvcore.init();
}
private String getPath(String url) {
try {
File file = new File(Path.so(), Uri.parse(url).getLastPathSegment());
if (file.length() < 10240) Path.write(file, OkHttp.newCall(url).execute().body().bytes());
return file.getAbsolutePath();
} catch (Exception e) {
e.printStackTrace();
return "";
App.get().setHook(core.getHook());
tvcore = new TVCore(getPath(core.getSo())).listener(this).auth(core.getAuth()).name(core.getName()).pass(core.getPass()).domain(core.getDomain()).broker(core.getBroker()).serv(0).play(8902).mode(1).init();
} catch (Exception ignored) {
} finally {
App.get().setHook(null);
}
}
private String getPath(String url) throws Exception {
File file = new File(Path.so(), Uri.parse(url).getLastPathSegment());
if (file.length() < 10240) Path.write(file, OkHttp.newCall(url).execute().body().bytes());
return file.getAbsolutePath();
}
@Override
public String fetch(String url) throws Exception {
Core c = LiveConfig.get().getHome().getCore();
if (core != null && !core.equals(c)) change();
if (tvcore == null) init(core = c);
App.get().setHook(null);
tvcore.start(url);
onWait();
onCheck();

@ -6,14 +6,11 @@ import com.github.catvod.Init;
public class TVCore {
private long handle;
private final long handle;
public TVCore(String so) {
try {
System.load(so);
handle = initialise();
} catch (Throwable ignored) {
}
System.load(so);
handle = initialise();
}
public TVCore listener(Listener listener) {
@ -54,7 +51,7 @@ public class TVCore {
public TVCore auth(String str) {
try {
if (str.length() > 0) setAuthUrl(handle, str);
if (!str.isEmpty()) setAuthUrl(handle, str);
return this;
} catch (Throwable ignored) {
return this;
@ -63,7 +60,7 @@ public class TVCore {
public TVCore domain(String str) {
try {
if (str.length() > 0) setDomainSuffix(handle, str);
if (!str.isEmpty()) setDomainSuffix(handle, str);
return this;
} catch (Throwable ignored) {
return this;
@ -72,7 +69,7 @@ public class TVCore {
public TVCore broker(String str) {
try {
if (str.length() > 0) setMKBroker(handle, str);
if (!str.isEmpty()) setMKBroker(handle, str);
return this;
} catch (Throwable ignored) {
return this;
@ -81,7 +78,7 @@ public class TVCore {
public TVCore name(String str) {
try {
if (str.length() > 0) setUsername(handle, str);
if (!str.isEmpty()) setUsername(handle, str);
return this;
} catch (Throwable ignored) {
return this;
@ -90,15 +87,16 @@ public class TVCore {
public TVCore pass(String str) {
try {
if (str.length() > 0) setPassword(handle, str);
if (!str.isEmpty()) setPassword(handle, str);
return this;
} catch (Throwable ignored) {
return this;
}
}
public void init() {
public TVCore init() {
new Thread(this::start).start();
return this;
}
private void start() {

Loading…
Cancel
Save