Skip to content

Add content_layout parameter for "add torrent" for Qbittorrent#93

Closed
AllikarDD wants to merge 0 commit intoidlesign:masterfrom
AllikarDD:master
Closed

Add content_layout parameter for "add torrent" for Qbittorrent#93
AllikarDD wants to merge 0 commit intoidlesign:masterfrom
AllikarDD:master

Conversation

@AllikarDD
Copy link
Copy Markdown

Add parameter content_layout - uses the folder structure defined within the torrent file itself(NoSubfolder,CreateSubfolder,Original). - specific to qBittorrent

@idlesign
Copy link
Copy Markdown
Owner

Thank you. Will try to review this week.

@idlesign
Copy link
Copy Markdown
Owner

I've made a revamp, fixed CI, added tests and introduced a generic way to pass custom parameters to RPC.
It should now be more easy to implement a kind of changes you want.
I'd like to ask you to rebase and restruct PR accordingly.

Issuing something like the following

torrt register_torrent https://... --params="contentLayout=CreateSubfolder"

should give you torrent.params=={"contentLayout": "CreateSubfolder"} in method_add_torrent.

Let me know whether it works for you.

@AllikarDD
Copy link
Copy Markdown
Author

Ok, i get your version
But now add_torrent do not work

  1. i try torrt add_torrent -d "/downloads/" --params "contentLayout=NoSubfolder" https://rutracker.net/forum/viewtopic.php?t=6697690
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Scripts\torrt.exe\__main__.py", line 5, in <module>
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\main.py", line 235, in process_commands
    add_torrent_from_url(
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\toolbox.py", line 264, in add_torrent_from_url
    torrent_data = get_torrent_from_url(url)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\utils.py", line 457, in get_torrent_from_url
    torrent_info = tracker.get_torrent(url, last_updated=last_updated)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\base_tracker.py", line 375, in get_torrent
    download_link = self.get_download_link(url)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\trackers\rutracker.py", line 38, in get_download_link
    is_anonymous = self.find_links(url, page_soup, 'register') is not None
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseTracker.find_links() takes 3 positional arguments but 4 were given

  1. I try torrt add_torrent -d "/downloads/" https://rutracker.net/forum/viewtopic.php?t=6697690
    and get:
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Scripts\torrt.exe\__main__.py", line 5, in <module>
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\main.py", line 238, in process_commands
    params=settings_dict_from_list(args['params']),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aleks\AppData\Local\Programs\Python\Python312\Lib\site-packages\torrt\main.py", line 46, in settings_dict_from_list
    for setting in value:
                   ^^^^^
TypeError: 'NoneType' object is not `iterable`
  1. And i think when set parameter -d then параметр params will be reassign.
    https://github.com/idlesign/torrt/blob/master/src/torrt/rpc/qbittorrent.py#L177C1-L178C1

I think you need modify func like this https://github.com/idlesign/torrt/pull/93/changes#diff-3da1d82cc07d4745d9f116dbabd7e41969394e4291a4569e293646368b473992R175

idlesign added a commit that referenced this pull request Mar 29, 2026
@idlesign
Copy link
Copy Markdown
Owner

But now add_torrent do not work

That's a regression after the refactoring. It now seems to be fixed in master. Please, give it a try.

I think you need modify func like this

I've actually introduced a generic way to pass parameters to RPC. So the functionality from your PR is not implemented. So, yes you can now just modify method_add_torrent similar to what you've done before, but a little bit more easy: pass parameters from torrent.params into your data = {}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants