mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-28 04:21:24 +08:00
fix(renamer): only log rename operations that actually succeed
Previously, the rename log message was printed before checking if the qBittorrent API call succeeded. This caused log spam when rename operations failed (e.g., due to 409 conflicts or network errors) since the same file would be attempted again on the next cycle. Now the log message is only printed after confirming the rename succeeded, reducing noise in the logs. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -121,10 +121,14 @@ class DownloadClient(TorrentPath):
|
||||
return await self.client.torrents_files(torrent_hash=torrent_hash)
|
||||
|
||||
async def rename_torrent_file(self, _hash, old_path, new_path) -> bool:
|
||||
logger.info(f"{old_path} >> {new_path}")
|
||||
return await self.client.torrents_rename_file(
|
||||
result = await self.client.torrents_rename_file(
|
||||
torrent_hash=_hash, old_path=old_path, new_path=new_path
|
||||
)
|
||||
if result:
|
||||
logger.info(f"{old_path} >> {new_path}")
|
||||
else:
|
||||
logger.debug(f"[Downloader] Rename failed: {old_path} >> {new_path}")
|
||||
return result
|
||||
|
||||
async def delete_torrent(self, hashes, delete_files: bool = True):
|
||||
await self.client.torrents_delete(hashes, delete_files=delete_files)
|
||||
|
||||
Reference in New Issue
Block a user