From a32c0d3fd47adfd97dd11b8d3eef5bcc371c71e3 Mon Sep 17 00:00:00 2001 From: tdc Date: Wed, 6 Sep 2023 17:35:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=E4=B8=8B?= =?UTF-8?q?=E8=BC=89=E5=B0=81=E9=9D=A2=E7=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Anime.py | 22 ++++++++++++++++++++++ Config.py | 4 +++- config-sample.json | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Anime.py b/Anime.py index 5d3001a..b415bcd 100644 --- a/Anime.py +++ b/Anime.py @@ -1086,6 +1086,15 @@ def download(self, resolution='', save_dir='', bangumi_tag='', realtime_show_fil except: err_print(self._sn, 'Plex auto Refresh UNKNOWN ERROR', 'Exception: ' + str(e), status=1) + # 下載封面照 + if self._settings['download_poster']: + url = self.get_thumbnail() + full_filename = os.path.join(self._bangumi_dir, 'poster.jpg') + if url: + with requests.get(url, stream=True) as r: + with open(full_filename, 'wb') as f: + shutil.copyfileobj(r.raw, f) + def upload(self, bangumi_tag='', debug_file=''): first_connect = True # 标记是否是第一次连接, 第一次连接会删除临时缓存目录 tmp_dir = str(self._sn) + '-uploading-by-aniGamerPlus' @@ -1362,6 +1371,19 @@ def get_info(self): err_print(0, indent+'参考檔名:', '\"' + self.get_filename() + '\"', no_sn=True, display_time=False) err_print(0, indent+'可用解析度', 'P '.join(self.get_m3u8_dict().keys()) + 'P\n', no_sn=True, display_time=False) + def get_thumbnail(self): + if self._settings['use_mobile_api']: + return self._src['data']['anime']['cover'] + else: + soup = self._src + # return soup.find('meta', property='og:image')['content'] + try: + return soup.find('div', 'data-file').img['data-src'] + except (TypeError, AttributeError, KeyError): + # 该sn下没有动画 + err_print(self._sn, 'ERROR: 該 sn 下真的有動畫?', status=1) + sys.exit(1) + def enable_danmu(self): self._danmu = True diff --git a/Config.py b/Config.py index 99c6acd..f862be1 100644 --- a/Config.py +++ b/Config.py @@ -161,7 +161,9 @@ def __init_settings(): 'save_logs': True, 'quantity_of_logs': 7, 'config_version': latest_config_version, - 'database_version': latest_database_version + 'database_version': latest_database_version, + 'download_poster': True, + 'generate_nfo': True, } with open(config_path, 'w', encoding='utf-8') as f: json.dump(settings, f, ensure_ascii=False, indent=4) diff --git a/config-sample.json b/config-sample.json index d3ef529..65c212e 100644 --- a/config-sample.json +++ b/config-sample.json @@ -67,6 +67,6 @@ }, "save_logs": true, "quantity_of_logs": 7, - "config_version": 13.0, + "config_version": 13.1, "database_version": 2.0 } From a55f22e4e99b89ea39da61d323ee079c4bc0df4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B8=A2=E4=BD=8E=E5=90=B8?= Date: Thu, 7 Sep 2023 23:05:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20=E6=8F=90=E9=AB=98=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=99=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config.py b/Config.py index f862be1..526ba23 100644 --- a/Config.py +++ b/Config.py @@ -21,8 +21,8 @@ sn_list_path = os.path.join(working_dir, 'sn_list.txt') cookie_path = os.path.join(working_dir, 'cookie.txt') logs_dir = os.path.join(working_dir, 'logs') -aniGamerPlus_version = 'v24.5' -latest_config_version = 17.2 +aniGamerPlus_version = 'v24.6' +latest_config_version = 17.3 latest_database_version = 2.0 cookie = None max_multi_thread = 5