idlesign / torrt

Automates torrent updates for you
https://github.com/idlesign/torrt
BSD 3-Clause "New" or "Revised" License
112 stars 19 forks source link

qbittorrent: 'savepath' is not a valid torrent file [RUS] #71

Closed malef1k closed 2 years ago

malef1k commented 2 years ago

Используется qbittorrent 4.3.3 docker. Торренты без параметра -d добавляются нормально, но при использовании параметра -d или при их обновлении возникает ошибка.

Вот логи. П.С. Если что-то сделал не так, прошу сильно не ругать, я тут новичек.

~# /var/packages/py3k/target/usr/local/bin/torrt walk --verbose DEBUG: Bootstrapping torrt environment ... DEBUG: Importing rpc ... DEBUG: Registering deluge from <class 'torrt.rpc.deluge.DelugeRPC'> ... DEBUG: Registering qbittorrent from <class 'torrt.rpc.qbittorrent.QBittorrentRPC'> ... DEBUG: Registering transmission from <class 'torrt.rpc.transmission.TransmissionRPC'> ... DEBUG: Registering utorrent from <class 'torrt.rpc.utorrent.UTorrentRPC'> ... DEBUG: Importing trackers ... DEBUG: Registering tr.anidub.com from <class 'torrt.trackers.anidub.AniDUBTracker'> ... DEBUG: Registering anilibria.tv from <class 'torrt.trackers.anilibria.AnilibriaTracker'> ... DEBUG: Registering casstudio.tv from <class 'torrt.trackers.casstudio.CasstudioTracker'> ... DEBUG: Registering eniahd.com from <class 'torrt.trackers.eniahd.EniaHDTracker'> ... DEBUG: Registering kinozal.tv from <class 'torrt.trackers.kinozal.KinozalTracker'> ... DEBUG: Registering nnm-club.me from <class 'torrt.trackers.nnmclub.NNMClubTracker'> ... DEBUG: Registering rutor.org from <class 'torrt.trackers.rutor.RutorTracker'> ... DEBUG: Registering rutracker.org from <class 'torrt.trackers.rutracker.RuTrackerTracker'> ... DEBUG: Importing notifiers ... DEBUG: Registering email from <class 'torrt.notifiers.mail.EmailNotifier'> ... DEBUG: Registering telegram from <class 'torrt.notifiers.telegram.TelegramNotifier'> ... DEBUG: Importing bots ... DEBUG: Registering telegram from <class 'torrt.bots.telegram_bot.TelegramBot'> ... DEBUG: Initializing objects registries from configuration file ... DEBUG: Loading configuration file /root/.torrt/config.json ... DEBUG: Spawning QBittorrentRPC object with the given settings ... DEBUG: Registering qbittorrent from qbittorrent ... DEBUG: Spawning EmailNotifier object with the given settings ... DEBUG: Registering email from email ... DEBUG: Spawning AnilibriaTracker object with the given settings ... DEBUG: Registering anilibria.tv from anilibria.tv ... DEBUG: Spawning KinozalTracker object with the given settings ... DEBUG: Registering kinozal.tv from kinozal.tv ... DEBUG: Spawning RutorTracker object with the given settings ... DEBUG: Registering rutor.org from rutor.org ... DEBUG: Spawning RuTrackerTracker object with the given settings ... DEBUG: Registering rutracker.org from rutracker.org ... INFO: Torrent walk is triggered DEBUG: Loading configuration file /root/.torrt/config.json ... INFO: Torrent walk is started INFO: Getting torrents from qbittorrent ... DEBUG: QBittorrentRPC: RPC action login ... DEBUG: Fetching http://127.0.0.1:8085/api/v2/auth/login ... DEBUG: Starting new HTTP connection (1): 127.0.0.1:8085 DEBUG: http://127.0.0.1:8085 "POST /api/v2/auth/login HTTP/1.1" 200 3 DEBUG: QBittorrentRPC: RPC action get_torrents ... DEBUG: Fetching http://127.0.0.1:8085/api/v2/torrents/info ... DEBUG: http://127.0.0.1:8085 "GET /api/v2/torrents/info HTTP/1.1" 200 1529 DEBUG: QBittorrentRPC: RPC action get_torrent ... DEBUG: Fetching http://127.0.0.1:8085/api/v2/torrents/properties ... DEBUG: http://127.0.0.1:8085 "POST /api/v2/torrents/properties HTTP/1.1" 200 795 INFO: Processing Foundation.S01.WEB-DL.720p.Rus.Eng... DEBUG: Downloading torrent file from https://rutracker.org/forum/viewtopic.php?t=6114289 ... DEBUG: RuTrackerTracker: Picking a mirror ... DEBUG: RuTrackerTracker: Probing mirror: https://rutracker.org ... DEBUG: Fetching https://rutracker.org ... DEBUG: Starting new HTTPS connection (1): rutracker.org:443 DEBUG: https://rutracker.org:443 "GET / HTTP/1.1" 301 162 DEBUG: https://rutracker.org:443 "GET /forum/index.php HTTP/1.1" 200 None DEBUG: Fetching https://rutracker.org/forum/viewtopic.php?t=6114289 ... DEBUG: https://rutracker.org:443 "GET /forum/viewtopic.php?t=6114289 HTTP/1.1" 200 None DEBUG: RuTrackerTracker: Torrent download link found: https://rutracker.org/forum/dl.php?t=6114289 DEBUG: RuTrackerTracker: Downloading torrent file from https://rutracker.org/forum/dl.php?t=6114289 ... DEBUG: Fetching https://rutracker.org/forum/dl.php?t=6114289 ... DEBUG: https://rutracker.org:443 "GET /forum/dl.php?t=6114289 HTTP/1.1" 200 23209 DEBUG: Torrent was downloaded from https://rutracker.org/forum/viewtopic.php?t=6114289 DEBUG: Update is available DEBUG: QBittorrentRPC: RPC action add_torrent ... DEBUG: Fetching http://127.0.0.1:8085/api/v2/torrents/add ... DEBUG: http://127.0.0.1:8085 "POST /api/v2/torrents/add HTTP/1.1" 415 46 ERROR: QBittorrentRPC: Failed to query RPC http://127.0.0.1:8085/api/v2/torrents/add: Error: 'savepath' is not a valid torrent file. ERROR: QBittorrentRPC: Failed to query RPC add_torrent: Error: 'savepath' is not a valid torrent file. ERROR: Unable to replace torrent: Error: 'savepath' is not a valid torrent file. DEBUG: Loading configuration file /root/.torrt/config.json ... DEBUG: Saving configuration file /root/.torrt/config.json ... INFO: Torrent walk is finished

idlesign commented 2 years ago

Нужно отлаживать. Но есть подозрение, что не в том месте передаётся параметр savepath: здесь https://github.com/idlesign/torrt/blob/master/torrt/rpc/qbittorrent.py#L180 он передаётся с блоке файлов, можно попробовать заменить метод на

    def method_add_torrent(self, torrent: TorrentData, download_to: str = None, params: dict = None) -> Any:

        file_data = {'torrents': torrent.raw}
        params = None

        if download_to is not None:
            params = {'data':{'savepath': download_to}}

        return self.auth_query(self.build_params(action='add_torrent', params), file_data)
malef1k commented 2 years ago

Заменил

Вот что получил в логах

Traceback (most recent call last): File "/var/packages/py3k/target/usr/local/bin/torrt", line 8, in sys.exit(process_commands()) File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/torrt/main.py", line 151, in process_commands bootstrap() File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/torrt/toolbox.py", line 185, in bootstrap import_classes() File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/torrt/utils.py", line 272, in import_classes import_from_path(package_name) File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/torrt/utils.py", line 283, in import_from_path import(f'torrt.{path}.{pname}') File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/torrt/rpc/qbittorrent.py", line 183 return self.auth_query(self.build_params(action='add_torrent', params), file_data) ^ SyntaxError: positional argument follows keyword argument

idlesign commented 2 years ago

Ошибка в последней строке. Пробуем:

return self.auth_query(self.build_params(action='add_torrent', params=params), file_data)
malef1k commented 2 years ago

Спасибо, добавил торрент с параметром -d "путь". Никаких ошибой не вылезло. Посмотрим что будет при обновлении, но по идеет все должно быть ок.

idlesign commented 2 years ago

Выпустил 0.16.3 с этим исправлением. Задачу закрываю.