Comments (7)
Hmm....you should be able to rename the top directory of the torrent with the torrents_rename_folder
command; that even changed the directory on the disk for me. It's possible qBittorrent is encountering some sort of error; perhaps their log would capture that.
Further, though, I also will usually do things in qBittorrent's WebUI to understand how they use the API for different tasks. You can open up the dev tools with F12 or some menu, select the Network tab and there you can see the API calls being made to qBittorrent when you rename things. That may help clarify what's going wrong as well.
You can even get verbose logging out of this client if you initialize it like this:
import logging
logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] {%(name)s:%(lineno)d} %(levelname)s - %(message)s')
import qbittorrentapi
client = qbittorrentapi.Client(host='localhost:8080', username="admin", password="adminadmin", VERBOSE_RESPONSE_LOGGING=True)
The torrents_rename_file
command will allow you rename files. I used this command for a single file torrent:
client.torrents_rename_folder(old_path="kubuntu-21.04-desktop-amd64.iso", new_path="new_kubuntu-21.04-desktop-amd64.iso", torrent_hash="d65d07329264aecb2d2be7a6c0e86b6613b2a600")
from qbittorrent-api.
Hello @farmwald,
Here's an example with a dummy torrent I just made.
for file in client.torrents_files("35ea45daf588289aba0dee455eff33246db58d4b"):
pprint(dict(file))
{'availability': 0,
'id': 0,
'index': 0,
'is_seed': False,
'name': 'rootdir/dir1/file1',
'piece_range': [0, 0],
'priority': 1,
'progress': 0,
'size': 6}
{'availability': 0,
'id': 1,
'index': 1,
'name': 'rootdir/dir2/file2',
'piece_range': [0, 0],
'priority': 1,
'progress': 0,
'size': 6}
Rename dir1
folder to dir1new
client.torrents_rename_folder(old_path="rootdir/dir1", new_path="rootdir/dir1new", torrent_hash="35ea45daf588289aba0dee455eff33246db58d4b")
for file in client.torrents_files("35ea45daf588289aba0dee455eff33246db58d4b"):
pprint(dict(file))
{'availability': 0,
'id': 0,
'index': 0,
'is_seed': False,
'name': 'rootdir/dir1new/file1',
'piece_range': [0, 0],
'priority': 1,
'progress': 0,
'size': 6}
{'availability': 0,
'id': 1,
'index': 1,
'name': 'rootdir/dir2/file2',
'piece_range': [0, 0],
'priority': 1,
'progress': 0,
'size': 6}
Hope that helps. Let me know if you run into more issues.
from qbittorrent-api.
This is very helpful, but I'm still having problems with two different cases.
In both cases, I'm trying to rename the "top" file or directory, i.e. "rootdir" in your example.
In one case, rootdir is actually a directory, and I want to change its name (to match a modified torrent name). It sort of works,
in that qbittorrent changes the name under content in the qbittorrent gui, but doesn't rename the actual folder. This leaves the torrent in an errored state. The old dirname contains non-ascii characters which may be relevant. I can try it with a more standard name.
In the other case, I'm trying to rename a single file at the top level, no directories involved. I've tried both torrent_rename_file and torrent_rename_folder. Both fail for me. rename_file fails complaining about new_path and old_path - I've tried
path=".",, path="", and not adding them (path=None) - all throw errors.
torrent_rename_folder throws an error that no such directory exists.
Thanks for the help.
from qbittorrent-api.
Another thought is to confirm the version of qBittorrent you're using. Some package managers have quite old versions.
from qbittorrent-api.
I'm on either 4.4.0 or 4.5.0, depending.
It sounds like the problems are mine, so let me generate some simple test cases and also check the log.
from qbittorrent-api.
I had a bug - seems to work just fine.
Thanks.
from qbittorrent-api.
Good deal; glad you got it worked out.
from qbittorrent-api.
Related Issues (20)
- Unable to access documents HOT 2
- `torrents_export` returns None HOT 3
- Timeout seems to be in multiples of 10 HOT 3
- make the "IS PRIVATE" flag usable please HOT 1
- Reporting a vulnerability HOT 1
- Request Constant for tracker status
- Build docs with sphinx-build is broken HOT 1
- free_space_on_disk returning 0 HOT 7
- how do "do not download" certain file
- FR: Return torrent hash or torrent object when adding new torrent HOT 1
- Hash v1 vs v2 surprising behavior HOT 4
- No "export" attribute for "Torrents" object HOT 12
- qBittorrent v4.6.0 and `inactive_seeding_time_limit` HOT 6
- Implement `torrents/count` API method
- Add type hints for qBittorrent's API payloads
- torrents_count() not a function in API HOT 4
- Async Support HOT 1
- TorrentDictionary.properties raises AttributeError HOT 1
- can this software control Bittorrent Option? HOT 2
- Adding RSS feeds fails without specifying the path HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qbittorrent-api.