From b2992371e67ad68d1246689880a789f74fbef798 Mon Sep 17 00:00:00 2001 From: xiaojie Date: Thu, 12 Sep 2024 16:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E8=8E=B7=E5=8F=96=E5=87=BA=E9=94=99=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=20=E4=BF=AE=E5=A4=8D=E6=A1=A3=E6=A1=88=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=B8=8B=E8=BD=BD=E8=B7=AF=E5=BE=84=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hippo/ehviewer/spider/SpiderInfo.java | 85 +++++++++---------- .../hippo/ehviewer/spider/SpiderQueen.java | 5 +- .../ui/dialog/ArchiverDownloadDialog.java | 3 +- 3 files changed, 46 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/spider/SpiderInfo.java b/app/src/main/java/com/hippo/ehviewer/spider/SpiderInfo.java index c2591acc9..7ba0bb88d 100644 --- a/app/src/main/java/com/hippo/ehviewer/spider/SpiderInfo.java +++ b/app/src/main/java/com/hippo/ehviewer/spider/SpiderInfo.java @@ -17,7 +17,6 @@ package com.hippo.ehviewer.spider; import static com.hippo.ehviewer.spider.SpiderDen.getGalleryDownloadDir; -import static com.hippo.ehviewer.spider.SpiderQueen.SPIDER_INFO_BACKUP_FILENAME; import static com.hippo.ehviewer.spider.SpiderQueen.SPIDER_INFO_FILENAME; import android.content.Context; @@ -269,48 +268,48 @@ public static SpiderInfo getSpiderInfo(GalleryInfo info) { return null; } - public static SpiderInfo createBackupSpiderInfo(GalleryInfo info) { - UniFile mDownloadDir = getGalleryDownloadDir(info); - if (mDownloadDir != null && mDownloadDir.isDirectory()) { - UniFile file = mDownloadDir.findFile(SPIDER_INFO_FILENAME); - if (file==null){ - return null; - } - UniFile backupFile = mDownloadDir.findFile(SPIDER_INFO_BACKUP_FILENAME); - if (backupFile!=null){ - backupFile.delete(); - } - backupFile = mDownloadDir.createFile(SPIDER_INFO_BACKUP_FILENAME); - InputStream is; - OutputStream os = null; - - try { - is = file.openInputStream(); - os = backupFile.openOutputStream(); - - byte[] bytes = new byte[1024]; - int l; - while((l=is.read(bytes))>0){ - os.write(bytes,0,l); - } - os.flush(); - IOUtils.closeQuietly(is); - SpiderInfo spiderInfo; - spiderInfo = SpiderInfo.read(file); - if (spiderInfo != null && spiderInfo.gid == info.gid && - spiderInfo.token.equals(info.token)) { - return spiderInfo; - } - return null; - } catch (IOException e) { - return null; - } finally { - IOUtils.closeQuietly(os); - } - - } - return null; - } +// public static SpiderInfo createBackupSpiderInfo(GalleryInfo info) { +// UniFile mDownloadDir = getGalleryDownloadDir(info); +// if (mDownloadDir != null && mDownloadDir.isDirectory()) { +// UniFile file = mDownloadDir.findFile(SPIDER_INFO_FILENAME); +// if (file==null){ +// return null; +// } +// UniFile backupFile = mDownloadDir.findFile(SPIDER_INFO_BACKUP_FILENAME); +// if (backupFile!=null){ +// backupFile.delete(); +// } +// backupFile = mDownloadDir.createFile(SPIDER_INFO_BACKUP_FILENAME); +// InputStream is; +// OutputStream os = null; +// +// try { +// is = file.openInputStream(); +// os = backupFile.openOutputStream(); +// +// byte[] bytes = new byte[1024]; +// int l; +// while((l=is.read(bytes))>0){ +// os.write(bytes,0,l); +// } +// os.flush(); +// IOUtils.closeQuietly(is); +// SpiderInfo spiderInfo; +// spiderInfo = SpiderInfo.read(file); +// if (spiderInfo != null && spiderInfo.gid == info.gid && +// spiderInfo.token.equals(info.token)) { +// return spiderInfo; +// } +// return null; +// } catch (IOException e) { +// return null; +// } finally { +// IOUtils.closeQuietly(os); +// } +// +// } +// return null; +// } public static SpiderInfo getSpiderInfo(GalleryDetail info) { try { diff --git a/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java b/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java index 2c7c1bab7..da78a5fe6 100644 --- a/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java +++ b/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java @@ -107,7 +107,6 @@ public final class SpiderQueen implements Runnable { public static final int STATE_FAILED = 3; public static final int DECODE_THREAD_NUM = 2; public static final String SPIDER_INFO_FILENAME = ".ehviewer"; -// public static final String SPIDER_INFO_BACKUP_FILENAME = ".ehviewer_backup"; public static final String SPIDER_INFO_BACKUP_DIR = "backupDir"; private static final String TAG = SpiderQueen.class.getSimpleName(); @@ -1311,7 +1310,7 @@ private boolean downloadImage(long gid, int index, String pToken, String previou response = call.execute(); targetImageUrl = response.header("location"); } catch (IOException e) { - error = "TargetImageUrl error"; + error = "GP不足/Insufficient GP"; IOException ioException = new IOException("原图链接获取失败", e); FirebaseCrashlytics.getInstance().recordException(ioException); break; @@ -1321,7 +1320,7 @@ private boolean downloadImage(long gid, int index, String pToken, String previou } if (targetImageUrl == null) { - error = "TargetImageUrl error"; + error = "GP不足/Insufficient GP"; break; } if (DEBUG_LOG) { diff --git a/app/src/main/java/com/hippo/ehviewer/ui/dialog/ArchiverDownloadDialog.java b/app/src/main/java/com/hippo/ehviewer/ui/dialog/ArchiverDownloadDialog.java index d5602e605..e286b4855 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/dialog/ArchiverDownloadDialog.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/dialog/ArchiverDownloadDialog.java @@ -210,7 +210,8 @@ public void onSuccess(String downloadUrl) { request.setTitle(galleryDetail.title); request.setDescription(context.getString(R.string.download_archive_started)); request.setVisibleInDownloadsUi(true); - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "/EhviewerArchiver/"+galleryDetail.title + ".zip"); +// request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "EhviewerArchiver/"+galleryDetail.title + ".zip"); + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "EhviewerArchiver/"+"[Abe Nattsu] SEX de Wakaru Unmei no Hito ~ Karada no Aishou... Tameshite miru? ~ Ch. 1-6 [Chinese] [裸單騎漢化]" + ".zip"); request.allowScanningByMediaScanner(); DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);