MCPcopy Create free account
hub / github.com/FongMi/CatVodSpider / action

Method action

app/src/main/java/com/github/catvod/spider/Market.java:52–69  ·  view source on GitHub ↗
(String action)

Source from the content-addressed store, hash-verified

50 }
51
52 @Override
53 public String action(String action) {
54 try {
55 OkHttp.cancel(TAG);
56 String name = Uri.parse(action).getLastPathSegment();
57 Notify.show("正在下載..." + name);
58 Response response = OkHttp.newCall(action, TAG);
59 File file = Path.create(new File(Path.download(), name));
60 download(file, response.body().byteStream());
61 if (file.getName().endsWith(".zip")) FileUtil.unzip(file, Path.download());
62 if (file.getName().endsWith(".apk")) FileUtil.openFile(file);
63 checkCopy(action);
64 response.close();
65 return Result.notify("下載完成");
66 } catch (Exception e) {
67 return Result.notify(e.getMessage());
68 }
69 }
70
71 private void download(File file, InputStream is) throws IOException {
72 try (BufferedInputStream input = new BufferedInputStream(is); FileOutputStream os = new FileOutputStream(file)) {

Callers

nothing calls this directly

Calls 12

cancelMethod · 0.95
showMethod · 0.95
newCallMethod · 0.95
createMethod · 0.95
downloadMethod · 0.95
downloadMethod · 0.95
unzipMethod · 0.95
openFileMethod · 0.95
checkCopyMethod · 0.95
notifyMethod · 0.95
parseMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected