/go-libdeluge

A native Deluge RPC client library

Primary LanguageGoGNU General Public License v2.0GPL-2.0

go-libdeluge

Go library for native RPC connection to a Deluge daemon; it uses go-rencode for the RPC protocol serialization/deserialization.

Release blog post.

License

GNU GPL version 2

How to build

This project uses Go modules. You can build it with make:

make

How to use

The library by itself is a Go package and needs to be embedded in an UI or CLI application.

	deluge := delugeclient.NewV2(delugeclient.Settings{
		Hostname:              "localhost",
		Port:                  58846,
		Login:                 "localclient",
		Password:              "*************",
	})

	// perform connection to Deluge server
	err := deluge.Connect()

	// ... use the client methods

To debug the library you may want to set DebugServerResponses to true.

Example CLI application

An example CLI application is available through:

go get github.com/gdm85/go-libdeluge/delugecli

Example usage:

DELUGE_PASSWORD="mypassword" bin/delugecli -add magnet:?xt=urn:btih:C1939CA413B9AFCC34EA0CF3C128574E93FF6CB0&tr=http%3A%2F%2Ftorrent.ubuntu.com%3A6969%2Fannounce

This will start downloading the latest Ubuntu 14.04 LTS server ISO. Multiple magnet URIs are supported as command-line arguments; run bin/delugecli alone to see all available options and their description.

Supported deluge versions

Both deluge v2.0+ and v1.3+ are supported with the two different constructors NewV2 and NewV1.

RPC API supported methods

  • daemon.login
  • daemon.info
  • daemon.authorized_call
  • daemon.get_method_list
  • daemon.get_version
  • daemon.shutdown
  • core.add_torrent_file
  • core.add_torrent_file_async
  • core.add_torrent_files
  • core.add_torrent_magnet
  • core.add_torrent_url
  • core.connect_peer
  • core.create_account
  • core.create_torrent
  • core.disable_plugin
  • core.enable_plugin
  • core.force_reannounce
  • core.force_recheck
  • core.get_auth_levels_mappings
  • core.get_available_plugins
  • core.get_completion_paths
  • core.get_config
  • core.get_config_value
  • core.get_config_values
  • core.get_enabled_plugins
  • core.get_external_ip
  • core.get_filter_tree
  • core.get_free_space
  • core.get_known_accounts
  • core.get_libtorrent_version
  • core.get_listen_port
  • core.get_path_size
  • core.get_proxy
  • core.get_session_state
  • core.get_session_status
  • core.get_torrent_status
  • core.get_torrents_status
  • core.glob
  • core.is_session_paused
  • core.move_storage
  • core.pause_session
  • core.pause_torrent
  • core.pause_torrents
  • core.prefetch_magnet_metadata
  • core.queue_bottom
  • core.queue_down
  • core.queue_top
  • core.queue_up
  • core.remove_account
  • core.remove_torrent
  • core.remove_torrents
  • core.rename_files
  • core.rename_folder
  • core.rescan_plugins
  • core.resume_session
  • core.resume_torrent
  • core.resume_torrents
  • core.set_config
  • core.set_torrent_options
  • core.set_torrent_trackers
  • core.test_listen_port
  • core.update_account
  • core.upload_plugin

Plugins

Plugins can be used by calling the relative method and checking if the result is not nil, example:

	p, err := deluge.LabelPlugin()
	if err != nil {
		panic(err)
	}
	if p == nil {
		println("Label plugin not available")
		return
	}

	// call plugin methods
	labelsByTorrent, err := p.GetTorrentsLabels(delugeclient.StateUnspecified, nil)

Label

RPC API supported methods

  • label.add
  • label.get_config
  • label.get_labels
  • label.get_options
  • label.remove
  • label.set_config
  • label.set_options
  • label.set_torrent