Skip to content

Commit

Permalink
Merge pull request #9 from yosemiteyss/feat/update-1.0.3
Browse files Browse the repository at this point in the history
update version to 1.0.3
  • Loading branch information
yosemiteyss authored Sep 26, 2023
2 parents 40e8f56 + 13208a0 commit 4575a91
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.3
- Add forcedMetaDL torrent state
- Add checking and moving torrent filter
- Add subscribeTorrentsList stream
- Fix forcedDL enum value

## 1.0.2
- Fix upload torrent files failed.

Expand Down
2 changes: 2 additions & 0 deletions lib/src/v2/torrents/dto/torrent_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ enum TorrentFilter {
stalled('stalled'),
stalledUploading('stalled_uploading'),
stalledDownloading('stalled_downloading'),
checking('checking'),
moving('moving'),
errored('errored');

const TorrentFilter(this.value);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/v2/torrents/dto/torrent_info.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/src/v2/torrents/dto/torrent_list_options.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lib/src/v2/torrents/dto/torrent_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ enum TorrentState {
@JsonValue('metaDL')
metaDL,

@JsonValue('forcedMetaDL')
forcedMetaDL,

/// Torrent is paused and has NOT finished downloading
@JsonValue('pausedDL')
pausedDL,
Expand All @@ -62,8 +65,8 @@ enum TorrentState {
checkingDL,

/// Torrent is forced to downloading to ignore queue limit
@JsonValue('forceDL')
forceDL,
@JsonValue('forcedDL')
forcedDL,

/// Checking resume data on qBt startup
@JsonValue('checkingResumeData')
Expand Down
12 changes: 12 additions & 0 deletions lib/src/v2/torrents/torrents_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TorrentsController {
final ApiClient _apiClient;

/// Get torrent list
/// [options] - The options to filter the torrents.
Future<List<TorrentInfo>> getTorrentsList({
required TorrentListOptions options,
}) async {
Expand All @@ -33,6 +34,17 @@ class TorrentsController {
return data.map((e) => TorrentInfo.fromJson(e)).toList();
}

/// Subscribe to torrent list changes by polling.
/// [options] - The options to filter the torrents.
/// [interval] - The polling interval.
Stream<List<TorrentInfo>> subscribeTorrentsList({
required TorrentListOptions options,
Duration interval = const Duration(seconds: 5),
}) {
return Stream.periodic(interval, (_) => getTorrentsList(options: options))
.asyncExpand(Stream.fromFuture);
}

/// Get torrent generic properties
/// [hash] - The hash of the torrent you want to get the generic properties of.
Future<TorrentProperties> getProperties({required String hash}) async {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: qbittorrent_api
description: This package provides methods for making requests to qBittorrent Web API using Dart.
version: 1.0.2
version: 1.0.3
repository: https://github.com/yosemiteyss/qbittorrent_api

environment:
Expand Down

0 comments on commit 4575a91

Please sign in to comment.