diff --git a/CHANGELOG.md b/CHANGELOG.md index 755596c..09303d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/src/v2/torrents/dto/torrent_filter.dart b/lib/src/v2/torrents/dto/torrent_filter.dart index 657342e..c84726a 100644 --- a/lib/src/v2/torrents/dto/torrent_filter.dart +++ b/lib/src/v2/torrents/dto/torrent_filter.dart @@ -10,6 +10,8 @@ enum TorrentFilter { stalled('stalled'), stalledUploading('stalled_uploading'), stalledDownloading('stalled_downloading'), + checking('checking'), + moving('moving'), errored('errored'); const TorrentFilter(this.value); diff --git a/lib/src/v2/torrents/dto/torrent_info.g.dart b/lib/src/v2/torrents/dto/torrent_info.g.dart index fee35b2..c829d78 100644 --- a/lib/src/v2/torrents/dto/torrent_info.g.dart +++ b/lib/src/v2/torrents/dto/torrent_info.g.dart @@ -135,11 +135,12 @@ const _$TorrentStateEnumMap = { TorrentState.allocating: 'allocating', TorrentState.downloading: 'downloading', TorrentState.metaDL: 'metaDL', + TorrentState.forcedMetaDL: 'forcedMetaDL', TorrentState.pausedDL: 'pausedDL', TorrentState.queuedDL: 'queuedDL', TorrentState.stalledDL: 'stalledDL', TorrentState.checkingDL: 'checkingDL', - TorrentState.forceDL: 'forceDL', + TorrentState.forcedDL: 'forcedDL', TorrentState.checkingResumeData: 'checkingResumeData', TorrentState.moving: 'moving', TorrentState.unknown: 'unknown', diff --git a/lib/src/v2/torrents/dto/torrent_list_options.g.dart b/lib/src/v2/torrents/dto/torrent_list_options.g.dart index 04ab68a..0906fd8 100644 --- a/lib/src/v2/torrents/dto/torrent_list_options.g.dart +++ b/lib/src/v2/torrents/dto/torrent_list_options.g.dart @@ -54,6 +54,8 @@ const _$TorrentFilterEnumMap = { TorrentFilter.stalled: 'stalled', TorrentFilter.stalledUploading: 'stalledUploading', TorrentFilter.stalledDownloading: 'stalledDownloading', + TorrentFilter.checking: 'checking', + TorrentFilter.moving: 'moving', TorrentFilter.errored: 'errored', }; diff --git a/lib/src/v2/torrents/dto/torrent_state.dart b/lib/src/v2/torrents/dto/torrent_state.dart index 88431ca..c0fbb68 100644 --- a/lib/src/v2/torrents/dto/torrent_state.dart +++ b/lib/src/v2/torrents/dto/torrent_state.dart @@ -45,6 +45,9 @@ enum TorrentState { @JsonValue('metaDL') metaDL, + @JsonValue('forcedMetaDL') + forcedMetaDL, + /// Torrent is paused and has NOT finished downloading @JsonValue('pausedDL') pausedDL, @@ -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') diff --git a/lib/src/v2/torrents/torrents_controller.dart b/lib/src/v2/torrents/torrents_controller.dart index e32d6ab..3d31624 100644 --- a/lib/src/v2/torrents/torrents_controller.dart +++ b/lib/src/v2/torrents/torrents_controller.dart @@ -23,6 +23,7 @@ class TorrentsController { final ApiClient _apiClient; /// Get torrent list + /// [options] - The options to filter the torrents. Future> getTorrentsList({ required TorrentListOptions options, }) async { @@ -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> 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 getProperties({required String hash}) async { diff --git a/pubspec.yaml b/pubspec.yaml index a39274f..df3603c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: