docs » HSaria2

Communicate with aria2, an interactive panel included.

Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/HSaria2.spoon.zip

API Overview

API Documentation

Variables

max_items
Signature HSaria2.max_items
Type Variable
Description

How many items should be created on aria2 panel? Defaults to 5.

Source Source/HSaria2.spoon/init.lua line 17
refresh_interval
Signature HSaria2.refresh_interval
Type Variable
Description

How often should HSaria2 retrieve data from RPC server? Defaults to 1 (second).

Source Source/HSaria2.spoon/init.lua line 22

Methods

connectToHost
Signature HSaria2:connectToHost(hostaddr, secret)
Type Method
Description

Try connect to hostaddr with secret. If succeed, they will become default values for following-up oprations.

Parameters
  • hostaddr - A sring specifying aria2 RPC host, including host name and port address. e.g. "http://localhost:6800/jsonrpc".
  • secret - A string specifying host secret
Returns
Source Source/HSaria2.spoon/init.lua line 27
newTask
Signature HSaria2:newTask(tasktype, urls, hostaddr, secret)
Type Method
Description

Create new regular/bt/metalink task, and send notification when done.

Parameters
  • tasktype - A string specifying task type. The value is one of these: addUri, addTorrent, addMetalink, nil. When tasktype is nil, aria2 will create a regular download task.
  • urls - A string or a table specifying URL. Multi URLs (table) are only available when tasktype is addUri or nil.
  • hostaddr - A optional sring specifying aria2 RPC host
  • secret - A optional string specifying host secret
Returns
Source Source/HSaria2.spoon/init.lua line 456
sendCommand
Signature HSaria2:sendCommand(command, gid, hostaddr, secret)
Type Method
Description

Send a command to hostaddr, only limited commands are supported.

Parameters
  • command - A string specifying sending command. The value is one of these: remove, forceRemove, pause, pauseAll, forcePause, forcePauseAll, unpause, unpauseAll, purgeDownloadResult, removeDownloadResult.
  • gid - A string specifying GID (aria2 identifies each download by the ID called GID). This Parameter can be optional or not according to the value of command.
  • hostaddr - A optional sring specifying aria2 RPC host
  • secret - A optional string specifying host secret
Returns
Source Source/HSaria2.spoon/init.lua line 512
togglePanel
Signature HSaria2:togglePanel()
Type Method
Description

Toggle the display of aria2 panel. The panel allows users to interact with aria2, add new tasks, pause them, or remove, purge … etc.

Parameters
  • None
Returns
Source Source/HSaria2.spoon/init.lua line 551