Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples in documentation #31

Closed
csm10495 opened this issue Dec 23, 2020 · 5 comments
Closed

Examples in documentation #31

csm10495 opened this issue Dec 23, 2020 · 5 comments

Comments

@csm10495
Copy link

Can there be examples added? Things like:

  • Listing current torrents
  • Getting status names for current torrents
  • Removing torrents
  • Adding torrents

Thanks.

@mhadam
Copy link
Owner

mhadam commented Dec 26, 2020

Thanks for the suggestion, I'll try to get this done soon.

@csm10495
Copy link
Author

Thanks! Merry Christmas!

@mhadam
Copy link
Owner

mhadam commented Dec 27, 2020

Getting status names for current torrents

I started putting together the examples in an update to the docs and it occured to me that currently clutch only returns what Transmission provides: an integer corresponding to various states.

I think it'd be better for clutch to return an enum so you don't have to dig into the Transmission code to figure out what they mean. I'll put this in a new release soon.

In the meantime, from here:

1652:    TR_STATUS_STOPPED = 0, /* Torrent is stopped */
1653:    TR_STATUS_CHECK_WAIT = 1, /* Queued to check files */
1654:    TR_STATUS_CHECK = 2, /* Checking files */
1655:    TR_STATUS_DOWNLOAD_WAIT = 3, /* Queued to download */
1656:    TR_STATUS_DOWNLOAD = 4, /* Downloading */
1657:    TR_STATUS_SEED_WAIT = 5, /* Queued to seed */
1658:    TR_STATUS_SEED = 6 /* Seeding */

@csm10495
Copy link
Author

Cool. I was using version 1.0 and was doing something like this to get done torrents:

for key, info in client.list().items():
    status = info['status']
    if 'stopped' in status.name and info['left_until_done'] == 0 :
        # ... 

An enum would be nicer than this weirdness.

@mhadam mhadam changed the title Examples Examples in documentation Dec 28, 2020
mhadam added a commit that referenced this issue Dec 28, 2020
@mhadam mhadam closed this as completed in 755cf39 Dec 28, 2020
@mhadam
Copy link
Owner

mhadam commented Dec 28, 2020

@csm10495 should be fixed in v6.0.0, there's an enum now Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants