[leanback] support translate vod search

pull/123/head
FongMi 3 years ago
parent 67c784bdc2
commit 4a5dc8b324
  1. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VodActivity.java
  2. 2
      app/src/main/java/com/fongmi/android/tv/bean/Class.java
  3. 2
      app/src/main/java/com/fongmi/android/tv/bean/Epg.java
  4. 2
      app/src/main/java/com/fongmi/android/tv/bean/Filter.java
  5. 2
      app/src/main/java/com/fongmi/android/tv/bean/Sub.java
  6. 16
      app/src/main/java/com/fongmi/android/tv/bean/Vod.java
  7. 5
      app/src/main/java/com/fongmi/android/tv/model/SiteViewModel.java
  8. 34
      app/src/main/java/com/fongmi/android/tv/utils/Trans.java
  9. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/fragment/VodFragment.java

@ -102,7 +102,7 @@ public class VodActivity extends BaseActivity {
private List<Class> getTypes(Result result) {
List<Class> types = new ArrayList<>();
for (String cate : getSite().getCategories()) for (Class type : result.getTypes()) if (Trans.get(cate).equals(type.getTypeName())) types.add(type);
for (String cate : getSite().getCategories()) for (Class type : result.getTypes()) if (Trans.s2t(cate).equals(type.getTypeName())) types.add(type);
return types;
}

@ -91,7 +91,7 @@ public class Class {
public void trans() {
if (Trans.pass()) return;
this.typeName = Trans.get(typeName);
this.typeName = Trans.s2t(typeName);
}
@Override

@ -87,7 +87,7 @@ public class Epg {
for (Epg item : getList()) {
item.setStartTime(Utils.format(format, getDate().concat(item.getStart())));
item.setEndTime(Utils.format(format, getDate().concat(item.getEnd())));
item.setTitle(Trans.get(item.getTitle()));
item.setTitle(Trans.s2t(item.getTitle()));
}
}

@ -75,7 +75,7 @@ public class Filter {
}
public void trans() {
this.n = Trans.get(n);
this.n = Trans.s2t(n);
}
@Override

@ -37,7 +37,7 @@ public class Sub {
public void trans() {
if (Trans.pass()) return;
this.name = Trans.get(name);
this.name = Trans.s2t(name);
}
public MediaItem.SubtitleConfiguration getExo() {

@ -178,13 +178,13 @@ public class Vod {
public void trans() {
if (Trans.pass()) return;
this.vodName = Trans.get(vodName);
this.vodArea = Trans.get(vodArea);
this.typeName = Trans.get(typeName);
this.vodActor = Trans.get(vodActor);
this.vodRemarks = Trans.get(vodRemarks);
this.vodContent = Trans.get(vodContent);
this.vodDirector = Trans.get(vodDirector);
this.vodName = Trans.s2t(vodName);
this.vodArea = Trans.s2t(vodArea);
this.typeName = Trans.s2t(typeName);
this.vodActor = Trans.s2t(vodActor);
this.vodRemarks = Trans.s2t(vodRemarks);
this.vodContent = Trans.s2t(vodContent);
this.vodDirector = Trans.s2t(vodDirector);
}
public void setVodFlags() {
@ -308,7 +308,7 @@ public class Vod {
public Episode(String name, String url) {
this.number = Utils.getDigit(name);
this.name = Trans.get(name);
this.name = Trans.s2t(name);
this.url = url;
}

@ -13,6 +13,7 @@ import com.fongmi.android.tv.bean.Result;
import com.fongmi.android.tv.bean.Site;
import com.fongmi.android.tv.bean.Vod;
import com.fongmi.android.tv.net.OkHttp;
import com.fongmi.android.tv.utils.Trans;
import com.fongmi.android.tv.utils.Utils;
import com.github.catvod.crawler.Spider;
import com.github.catvod.crawler.SpiderDebug;
@ -169,12 +170,12 @@ public class SiteViewModel extends ViewModel {
public void searchContent(Site site, String keyword) throws Throwable {
if (site.getType() == 3) {
Spider spider = ApiConfig.get().getCSP(site);
String searchContent = spider.searchContent(keyword, false);
String searchContent = spider.searchContent(Trans.t2s(keyword), false);
SpiderDebug.log(searchContent);
post(site, Result.fromJson(searchContent));
} else {
ArrayMap<String, String> params = new ArrayMap<>();
params.put("wd", keyword);
params.put("wd", Trans.t2s(keyword));
if (site.getType() != 0) params.put("ac", "detail");
String body = OkHttp.newCall(site.getApi(), params).execute().body().string();
SpiderDebug.log(site.getName() + "," + body);

File diff suppressed because one or more lines are too long

@ -145,7 +145,7 @@ public class VodFragment extends BaseFragment implements SiteCallback, FilterCal
private Result handle(Result result) {
List<Class> types = new ArrayList<>();
for (String cate : getSite().getCategories()) for (Class type : result.getTypes()) if (Trans.get(cate).equals(type.getTypeName())) types.add(type);
for (String cate : getSite().getCategories()) for (Class type : result.getTypes()) if (Trans.s2t(cate).equals(type.getTypeName())) types.add(type);
result.setTypes(types);
return result;
}

Loading…
Cancel
Save