Clean code
This commit is contained in:
parent
e80fac6d50
commit
3ac9f333d6
|
|
@ -59,21 +59,20 @@ public class Push extends Ali {
|
|||
|
||||
private void setHttpSub(String url, List<Sub> subs) {
|
||||
try {
|
||||
String ext = Utils.getExt(url);
|
||||
if (!ext.equals("mp4") && !ext.equals("mkv")) return;
|
||||
List<String> types = Arrays.asList(".srt", ".ass");
|
||||
for (String type : types) detectSub(Utils.removeExt(url).concat(type), subs);
|
||||
List<String> vodTypes = Arrays.asList("mp4", "mkv");
|
||||
List<String> subTypes = Arrays.asList("srt", "ass");
|
||||
if (!vodTypes.contains(Utils.getExt(url))) return;
|
||||
for (String ext : subTypes) detectSub(url, ext, subs);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void detectSub(String url, List<Sub> subs) throws Exception {
|
||||
if (OkHttp.newCall(url).code() == 200) {
|
||||
String ext = Utils.getExt(url);
|
||||
String name = Uri.parse(url).getLastPathSegment();
|
||||
subs.add(Sub.create().name(name).ext(ext).url(url));
|
||||
}
|
||||
private void detectSub(String url, String ext, List<Sub> subs) throws Exception {
|
||||
url = Utils.removeExt(url).concat(".").concat(ext);
|
||||
if (OkHttp.newCall(url).code() != 200) return;
|
||||
String name = Uri.parse(url).getLastPathSegment();
|
||||
subs.add(Sub.create().name(name).ext(ext).url(url));
|
||||
}
|
||||
|
||||
private void setFileSub(String url, List<Sub> subs) {
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
d0ac4c362ded4782f74f467bfa3420be
|
||||
d02ea3eb2cda4c0a98f3758125eb667e
|
||||
|
|
|
|||
Loading…
Reference in New Issue