fix live setting bug

pull/142/head
于俊 1 year ago
parent 51003577bd
commit 69eab36df9
  1. 16
      app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java
  2. 23
      app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java

@ -220,7 +220,7 @@ public class ApiConfig {
if (response.body() == null) {
result = "";
}else {
result=response.body().string();
result = FindResult(response.body().string(), TempKey);
if (liveApiUrl.startsWith("clan")) {
result = clanContentFix(clanToAddress(liveApiUrl), result);
}
@ -248,7 +248,7 @@ public class ApiConfig {
// String finalApiUrl = apiUrl;
String configUrl=configUrl(apiUrl);
String configKey = TempKey;
// String configKey = TempKey;
OkGo.<String>get(configUrl)
.headers("User-Agent", userAgent)
.headers("Accept", requestAccept)
@ -286,7 +286,7 @@ public class ApiConfig {
if (response.body() == null) {
result = "";
} else {
result = FindResult(response.body().string(), configKey);
result = FindResult(response.body().string(), TempKey);
}
if (apiUrl.startsWith("clan")) {
@ -614,6 +614,7 @@ public class ApiConfig {
initLiveSettings();
if(infoJson.has("lives")){
JsonArray lives_groups=infoJson.get("lives").getAsJsonArray();
int live_group_index=Hawk.get(HawkConfig.LIVE_GROUP_INDEX,0);
if(live_group_index>lives_groups.size()-1)Hawk.put(HawkConfig.LIVE_GROUP_INDEX,0);
Hawk.put(HawkConfig.LIVE_GROUP_LIST,lives_groups);
@ -759,10 +760,13 @@ public class ApiConfig {
String type= livesOBJ.get("type").getAsString();
if(type.equals("0")){
url = livesOBJ.get("url").getAsString();
if(url.startsWith("http")){
url = Base64.encodeToString(url.getBytes("UTF-8"), Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP);
if(!url.startsWith("http://127.0.0.1")){
if(url.startsWith("http")){
url = Base64.encodeToString(url.getBytes("UTF-8"), Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP);
}
url ="http://127.0.0.1:9978/proxy?do=live&type=txt&ext="+url;
}
url ="http://127.0.0.1:9978/proxy?do=live&type=txt&ext="+url;
LOG.i("echo-url:"+url);
}else {
return;
}

@ -1523,10 +1523,17 @@ public class LivePlayActivity extends BaseActivity {
if(position==Hawk.get(HawkConfig.LIVE_GROUP_INDEX, 0))break;
JsonArray live_groups=Hawk.get(HawkConfig.LIVE_GROUP_LIST,new JsonArray());
JsonObject livesOBJ = live_groups.get(position).getAsJsonObject();
String type= livesOBJ.get("type").getAsString();
if(!type.equals("0")){
Toast.makeText(App.getInstance(), "暂不支持该直播类型", Toast.LENGTH_SHORT).show();
break;
if(livesOBJ.has("type")){
String type= livesOBJ.get("type").getAsString();
if(!type.equals("0")){
Toast.makeText(App.getInstance(), "暂不支持该直播类型", Toast.LENGTH_SHORT).show();
break;
}
}else {
if(!livesOBJ.has("channels")){
Toast.makeText(App.getInstance(), "暂不支持该直播类型", Toast.LENGTH_SHORT).show();
break;
}
}
liveSettingItemAdapter.selectItem(position, true, true);
Hawk.put(HawkConfig.LIVE_GROUP_INDEX, position);
@ -1579,9 +1586,11 @@ public class LivePlayActivity extends BaseActivity {
Uri parsedUrl = Uri.parse(url);
url = new String(Base64.decode(parsedUrl.getQueryParameter("ext"), Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP), "UTF-8");
} catch (Throwable th) {
Toast.makeText(App.getInstance(), "直播文件错误", Toast.LENGTH_SHORT).show();
finish();
return;
if(!url.startsWith("http://127.0.0.1")){
Toast.makeText(App.getInstance(), "直播文件错误", Toast.LENGTH_SHORT).show();
finish();
return;
}
}
showLoading();

Loading…
Cancel
Save