From 2536d296d7846d99532f9d75f1de23a45e014255 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Sat, 4 Mar 2023 23:07:06 +0800 Subject: [PATCH] #164 --- module/core/download_client.py | 6 +++--- module/core/renamer.py | 3 ++- module/downloader/qb_downloader.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/core/download_client.py b/module/core/download_client.py index 95aa2f4f..1b63e37e 100644 --- a/module/core/download_client.py +++ b/module/core/download_client.py @@ -80,11 +80,11 @@ class DownloadClient: status_filter="completed", category="Bangumi" ) - def rename_torrent_file(self, hash, path_name, new_name): + def rename_torrent_file(self, hash, new_file_name, old_path, new_path): self.client.torrents_rename_file( - torrent_hash=hash, old_path=path_name, new_path=new_name + torrent_hash=hash, new_file_name=new_file_name, old_path=old_path, new_path=new_path ) - logger.info(f"{path_name} >> {new_name}") + logger.info(f"{old_path} >> {new_path}, new name {new_file_name}") def delete_torrent(self, hashes): self.client.torrents_delete( diff --git a/module/core/renamer.py b/module/core/renamer.py index 1e9e61c4..98d5c2e3 100644 --- a/module/core/renamer.py +++ b/module/core/renamer.py @@ -65,7 +65,8 @@ class Renamer: try: new_name = self._renamer.download_parser(name, folder_name, season, suffix, settings.bangumi_manage.rename_method) if path_name != new_name: - self.client.rename_torrent_file(torrent_hash, path_name, new_name) + old_name = info.content_path.replace(info.save_path, "") + self.client.rename_torrent_file(torrent_hash, new_name, old_name, new_name) rename_count += 1 else: continue diff --git a/module/downloader/qb_downloader.py b/module/downloader/qb_downloader.py index 7e0d628c..b51b2e4a 100644 --- a/module/downloader/qb_downloader.py +++ b/module/downloader/qb_downloader.py @@ -56,8 +56,9 @@ class QbDownloader: torrent_hashes=hash ) - def torrents_rename_file(self, torrent_hash, old_path, new_path): - self._client.torrents_rename_file(torrent_hash=torrent_hash, old_path=old_path, new_path=new_path) + def torrents_rename_file(self, torrent_hash, new_file_name, old_path, new_path): + self._client.torrents_rename_file(torrent_hash=torrent_hash, new_file_name=new_file_name, + old_path=old_path, new_path=new_path) def get_rss_info(self): item = self._client.rss_items().get("Mikan_RSS")