1. Erik Svensson
  2. transmissionrpc
Issue #26 resolved

calling info method is kinda strange

jabbas
created an issue

If you want to get info for specific torrent you need to call:

{{{ tc.info(TORRENT_ID)[TORRENT_ID] }}}

you need to provide TORRENT_ID twice to get info for specific torrent.

Is there some reason to call it like that? Currently it's nicer to get info for specific torrent using list method: {{{ tc.list()[TORRENT_ID] }}}

It could be nicer if this method will return torrent object just by calling: {{{ tc.info(TORRENT_ID) }}}

Comments (6)

  1. Erik Svensson repo owner
    • changed status to open

    Yes this behavior is a little odd. The rationale for list was that you could use it to create lists with the most important fields. Info on the other hand is much more flexible where you can get a custom list of fields for a custom list of IDs, this reflects in the complex result. What might be missing is a method for getting a single Torrent object through the Client.

  2. jabbas reporter

    How about replacing info with find_torrents (because it can return more than one) and add get_torrent which will return only one Torrent object?

    list_torrents - returns a all torrents
    find_torrents - returns a "slice" of list_torrents
    get_torrent - returns one Torrent object
    

    Anyway, you need to keep in mind that this will be major API change, so you should keep old method names for some time with some kind of deprecation warning.

  3. Log in to comment