Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Add Created, Started, and Finished time fields to Torrent #17

Merged
merged 2 commits into from
Apr 11, 2021
Merged

Add Created, Started, and Finished time fields to Torrent #17

merged 2 commits into from
Apr 11, 2021

Conversation

justinrush
Copy link
Contributor

This PR adds the Created, Started, and Finished fields to the Torrent struct, closing #16 .

Example usage:

s := rtorrent.New("https://rutorrent.myhost.com/RPC2", false)
torrents, err := s.GetTorrents(rtorrent.ViewSeeding)
if err != nil {
	panic(err)
}

for _, torrent := range torrents {
	fmt.Printf("Name: %s; Created: %s; Finished: %s; Started: %s\n", torrent.Name, torrent.Created.Format(time.RFC3339), torrent.Finished.Format(time.RFC3339), torrent.Started.Format(time.RFC3339))
}

Example output:

Name: Some.Torrent.With.All.The.Dates; Created: 2021-03-16T16:35:32-05:00; Finished: 2021-04-07T13:12:53-05:00; Started: 2021-04-07T13:10:00-05:00
Name: Some.Torrent.With.No.Create.Date; Created: 1969-12-31T18:00:00-06:00; Finished: 2021-04-10T09:07:04-05:00; Started: 2021-04-10T09:01:43-05:00

Note that the tests in general fail with and without these changes, however, the test that actually gets the torrent(s) works. I am not sure if the torrent used in the test even exists anymore.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 230

  • 17 of 23 (73.91%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 49.654%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rtorrent/rtorrent.go 17 23 73.91%
Totals Coverage Status
Change from base Build 204: 0.6%
Covered Lines: 430
Relevant Lines: 866

💛 - Coveralls

@justinrush
Copy link
Contributor Author

added a newer torrent and now tests pass

@mrobinsn mrobinsn self-assigned this Apr 11, 2021
@mrobinsn mrobinsn merged commit a554e07 into mrobinsn:master Apr 11, 2021
mrobinsn added a commit that referenced this pull request Apr 11, 2021
Add Created, Started, and Finished time fields to Torrent
@mrobinsn
Copy link
Owner

Thank you @justinrush for the PR, released in https://github.com/mrobinsn/go-rtorrent/releases/tag/v1.6.0

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

Successfully merging this pull request may close these issues.

3 participants