qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.62k stars 4.01k forks source link

Make content_layout visible and editable #17652

Open tumd opened 2 years ago

tumd commented 2 years ago

Suggestion

The content_layout exists and is (to me) very usefull, and the option is exposed when adding a new torrent. But there it stops.

What I miss;

  1. It is not shown in any way what so ever how content_layout was used while adding a torrent. This is exposed in the api with content_path, and I wish this was used instead of save_path in the GUI's.
  2. There is no way to change content_layout after a torrent has been added. This perhaps isn't very often needed, but never the less thoroughly annoying when you do need it. And I see no reason why it shouldn't be possible.

Use case

To me, content_layout set to NoSubfolder is most useful when adding Packs of something (movie-series pack, or a tv series season pack). Some well organized trackers uploads a pack of a season when the season has finished, and will remove the single episode torrents after a while. These packs needs to be added with the NoSubfolder option, to match (check and resume) the already existing episodes downloaded from the per-episode torrents. But without the correct Location shown in the GUIs, you loose a lot of the visibility of where the content actually is stored. And if you by any reason happens to add the torrent without NoSubfolder, you won't see it until it has started the download in the wrong place, and you have to delete the torrent to re add it with the correct content_layout.

Thank you in advance!

Extra info/examples/attachments

No response

Niketin commented 4 weeks ago

This would be very useful. I'm in a situation where I have downloaded many torrents with content_layout set to "Don't create subfolder", and now when I tried using Sonarr, it expects torrents to be under their own subfolders:

Download warning: Unable to Import. Path matches client base download directory, it's possible 'Keep top-level folder' is disabled for this torrent or 'Torrent Content Layout' is NOT set to 'Original' or 'Create Subfolder'?

I do not know how to change the content_layout to "Create subfolder" for existing torrents. I tried the API, but there were no setter for the content_layout nor content_path.

Example

A torrent is added with content_layout "Don't create subfolder". Its properties look as follows.

...
content_path: "<finished_torrents>/<category>"
root_path: ""
save_path: "<finished_torrents>/<category>"
...

The same torrent is added with content_layout "Create subfolder". Its properties look as follows.

...
content_path: "<finished_torrents>/<category>/<subfolder>"
root_path: "<finished_torrents>/<category>/<subfolder>"
save_path: "<finished_torrents>/<category>"
...

I would like to be able to change the torrent from the former state to the latter state without readding the torrent. I believe the ability to change the content_layout would be a great solution.

Niketin commented 4 weeks ago

I solved my sonar problem by manually changing the save path of each torrent. Well, not manually but with a python script. It basically calls the setLocationAction() for each torrent, to change the save path from <default_save_path>/<category> to <default_save_path>/<category>/<subfolder> where the subfolder is the torrent's name. Extension .mkv is automatically stripped out from the name in the script.

Python code ```python import qbittorrentapi def main(): client = qbittorrentapi.Client(INSERT_CREDENTIALS_HERE) try: client.auth_log_in() except qbittorrentapi.LoginFailed as e: print(e) return sonarr_category = "tv-sonarr" torrents = client.torrents_info(category=sonarr_category) default_save_path = client.app_default_save_path() for i, torrent in enumerate(torrents): subfolder_name = torrent.name.rstrip(".mkv") new_save_path = f"{default_save_path}/{sonarr_category}/{subfolder_name}" print(f"{i+1}/{len(torrents)}: {subfolder_name}") print(f"{i+1}/{len(torrents)}: {new_save_path}") torrent.set_location(location=new_save_path) client.auth_log_out() if __name__ == "__main__": main() ```

Result is not the same as the latter case from above comment, but it works for me for now. Still, it would be nice to be able to change the content_layout of a torrent.