Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jaria2 🥳

jaria2 is a java client for aria2c (jaria2是一个aria2c的java客户端)

quick start (快速开始)

  1. add maven dependency(引入maven依赖)

now version is : 1.0.4

<dependency>
    <groupId>cn.lishiyuan</groupId>
    <artifactId>jaria2</artifactId>
    <version>{jaria2.version}</version>
</dependency>
  1. aria2c start (启动程序)
public static void main(String[]args){
        String path = "aria2c";
        String[] params = {"--enable-rpc","--rpc-allow-origin-all","--rpc-secret=2089b05ecca3d829"};
        Aria2Manager aria2Manager = Aria2Manager.build(path,params);
        aria2Manager.start();
        System.out.println(aria2Manager.status());
}
  1. send action (客户端发送请求)
public static void main(String[]args){
        Aria2Client client = = new DefaultAria2Client("2089b05ecca3d829");
        client.addEventProcessor(event->{
            System.out.println(event.toJsonString());
        });
        client.connect();
        AddUriAction.AddUriActionResponse response = client.action(new AddUriAction(UUID.randomUUID().toString(),"https://desk-fd.zol-img.com.cn/t_s720x360c5/g7/M00/0A/0D/ChMkK2MoBA6IcIAaAAnmKLET1UwAAHq2wB4jO4ACeZA213.jpg"));
        System.out.println(response.toJsonString());
}

more (更多信息)

All in all, jaria2 has two parts: Aria2Manager and Aria2Client.

总的来说,jaria2主要有两个部分组成:Aria2Manager和Aria2Client。

Aria2Manager Aria2Manager is used to start aria2c program, instead of starting the server through command line and so on.

Aria2Manager用来aria2c程序,代替命令行启动服务端等等操作。

Aria2Client Aria2Client is used to interact with the server, which is currently netty + websocket. There are two main features.

Aria2Client是与服务端交互的客户端,目前是netty + websocket。主要有下面两个feature

  1. Action

action corresponds to method, and I describe it as an action instruction issued by a client to a server.

action对应method,我这里描述为一个客户端向服务端发出的动作指令。

  1. Event

event corresponds to notification, in which each life cycle node of the download will have a corresponding event trigger.

event对应notification,在下载的各个生命周期节点都会有对应的event触发。

configuration(配置)

Configuration is concentrated in the Aria2Config class, which also includes two parts: Manager and Client.

配置集中在Aria2Config类里面,它同样包括Manager和Client两部分。 Aria2Config

extend (扩展)

  1. Aria2Client

Default implementation is DefaultAria2Client, if you need to customize, implement the Aria2Client interface.

默认实现是DefaultAria2Client,如果需要自定义,实现Aria2Client接口即可。

  1. EventProcessor

EventProcessor is used to process event, you can add multiple EventProcessor to the client.

EventProcessor用来处理event,可以向client添加多个EventProcessor。

  1. Action Action is used to send action to server, I have add all Action to the client.

Action用来向服务端发送action,我已经把所有的Action都添加到了client里面。

action and event

all action and notification coverage.

所有的action和notification的覆盖情况。

notification(event)

Below are all the events that are already supported, that is, notifications, and the check marks are already tested.

下面是所有的已经支持的事件回调,也就是通知,打钩是已经通过测试的。

  • onDownloadStart
  • onDownloadError
  • onDownloadComplete
  • onBtDownloadComplete
  • onDownloadStop
  • onDownloadPause

action(methods)

below are all the methods that are already supported, that is, actions, and the check marks are already tested.

下面是所有的已经支持的方法,也就是动作,打钩是已经通过测试的。

  • listMethods
  • listNotifications
  • pause
  • unpause
  • pauseAll
  • unpauseAll
  • getVersion
  • getSessionsInfo
  • tellStatus
  • tellWaiting
  • tellStopped
  • tellActive
  • addUri
  • addTorrent
  • addMetalink
  • getUris
  • getFiles
  • getPeers
  • getServers
  • ForcePause
  • ForcePauseAll
  • ForceRemove
  • ForceShutdown
  • Remove
  • Shutdown
  • SaveSession
  • ChangePosition
  • ChangeUri
  • PurgeDownloadResult
  • RemoveDownloadResult
  • ChangeGlobalOption
  • ChangeOption
  • Multicall
  • GetOption
  • GetGlobalOption
  • GetGlobalStat

License (开源协议,待补充)

李干嘛大帅哥

About

jaria2 is a java client for aria2c (jaria2是一个aria2c的java客户端)

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages