Skip to content

FriesI23/dart_transmission_rpc

Repository files navigation

Dart Transmission RPC

Package Likes Popularity Points

dart_transmission_rpc is a Transmission RPC client implemented in Dart, supporting rpc-version>=14. for more information, see Transmission/rpc-spec.md.

Features

Following interfaces have been implemented:

  • torrent
    • torrent-start
    • torrent-start-now
    • torrent-stop
    • torrent-verify
    • torrent-reannounce
    • torrent-set
    • torrent-get
    • torrent-add
    • torrent-remove
    • torrent-set-location
    • torrent-rename-path
  • session
    • session-get
    • session-set
    • session-stats
    • blocklist-update
    • port-test
    • session-close
    • queue-move-top
    • queue-move-up
    • queue-move-down
    • queue-move-bottom
    • free-space
    • group-set
    • group-get

Getting started

Add dependency with dart pub add command

dart pub add dart_transmission_rpc

Or Add below line to pubspec.yaml

dependencies:
  ...
  dart_transmission_rpc: any  # or special version

Then run dart pub get, or flutter pub get for flutter project.

Usage

final client = TransmissionRpcClient(
  username: "admin", password: "123456");
await client.init();

// get session info
final sessionInfo = await client.sessionGet(null);

// get torrent info
final torrentInfo = await client.torrentGet([
  TorrentGetArgument.name,
  TorrentGetArgument.id,
  TorrentGetArgument.hashString,
  TorrentGetArgument.addedDate,
  TorrentGetArgument.pieces,
]);

// add torrent
await client.torrentAdd(
  TorrentAddRequestArgs(
    fileInfo: TorrentAddFileInfo.byMetainfo(
        io.File("demo/demo_test.torrent").readAsBytesSync()),
    downloadDir: "/downloads/complete",
    labels: ["test", "test1"],
  ),
);
// or
await client.torrentAdd(
  TorrentAddRequestArgs(
    fileInfo: TorrentAddFileInfo.byFilename(
        "magnet:?xt=urn:btih:cce82738e2f9217c5631549b0b8c1dfe12331503&dn=debian-12.5.0-i386-netinst.iso"),
    downloadDir: "/downloads",
    labels: ["test", "test1", "test2"],
  ),
  );

for more example see: demo_test.dart

Donate

"Buy Me A Coffee" Alipay WechatPay

ETH BTC

License

MIT License

Copyright (c) 2024 Fries_I23

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.