Open cheeseandcereal opened 1 month ago
(As a note to others who find this issue before it's fixed)
A hacky workaround to this without actually fetching the additional fields is to just manually set the internal field state of the torrent yourself before calling .get_files()
- i.e.:
torrent.fields["priorities"] = [0] * len(torrent.fields["files"])
torrent.fields["wanted"] = [True] * len(torrent.fields["files"])
# get_files() should now work
torrent.get_files()
A bit weird to close this issue because it's definitely not fixed by the mention of an unmerged PR. Unless you're saying you won't fix?
Should probably separate #446 out, or at least address separately since there's 2 different issues:
.get_files()
if the files
field wasn't fetched should return an error (not what I'm talking about with this issue at all).get_files()
if the priorities
or wanted
fields aren't fetched should not failShouldn't this issue remain open until at least it's merged then?
Yes, both your suggestions on splitting PR and keep issue open sounds reasonable to me. But I'm don't want to spend time on that PR just split it into 2 PR and resolve conflicts when I plan to merge it, so I'll just only re-open this issue.
Yeah sounds good. It's just helpful to track this as an open issue. I appreciate it!
for tracking, I want to avoid unnecessary breaking change so I will merge PR and make new release when new transmission version is released.
you can use pip to install zip of PR if you need it now.
Description
Currently, it is impossible to get files of a torrent (with the
.get_files()
interface) unless you fetch thepriorities
andwanted
fields.This is due to trying to directly reference these fields here: https://github.com/trim21/transmission-rpc/blob/57c064f6b740b67be1ed7c5afad5ce18476616f4/transmission_rpc/torrent.py#L436-L437
It currently returns a key error if you try to use this:
This doesn't really seem necessary and forces fetching these fields onto users for use-cases that may not need them.
I would propose updating this function or providing an alternative interface to get the files of a
Torrent
class(as a side note, why are getting files a function interface while everything else on the class is a property? It seems a bit weird/inconsistent)