From 3cb7002287ad783e1ac15027d58e79e1da99b5b0 Mon Sep 17 00:00:00 2001 From: Younes Ichiche Date: Sun, 29 Mar 2020 12:20:42 +0200 Subject: [PATCH] Aligning rtorrent rtrom_ modules same way as rtom_allsessions_ --- plugins/rtorrent/rtom_mem | 9 ++++++++- plugins/rtorrent/rtom_peers | 9 ++++++++- plugins/rtorrent/rtom_spdd | 10 +++++++++- plugins/rtorrent/rtom_vol | 8 +++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/plugins/rtorrent/rtom_mem b/plugins/rtorrent/rtom_mem index f691aab1..13ad209c 100755 --- a/plugins/rtorrent/rtom_mem +++ b/plugins/rtorrent/rtom_mem @@ -27,6 +27,7 @@ # ip rTorrent's ip address - using scgi_port - needed, when "src" is NOT set to "socket" # port rTorrent's scgi port (scgi_port) - using scgi_port - needed, when "src" is NOT set to "socket" # category Change graph category +# api use "pre09" (pre 0.9.0) or "current" (0.9.0+, the default) API calls # # Configuration example # @@ -63,10 +64,16 @@ my $src = $ENV{"src"} || ""; my $ip = $ENV{"ip"} || "127.0.0.1"; my $port = $ENV{"port"} || "5000"; my $socket = $ENV{"socket"} || ""; +my $api = $ENV{"api"} || "current"; my $pattern = qr/<(int|i4|i8|ex\.i8)>(\d+)<\/(int|i4|i8|ex\.i8)><\/value>/; +my $line = ""; +if ($api =~ /pre09/) { + $line = "get_memory_usage"; +} else { + $line = "pieces.memory.current"; +} -my $line = "get_memory_usage"; my $llen = length $line; my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000"; my $hlen = length $header; diff --git a/plugins/rtorrent/rtom_peers b/plugins/rtorrent/rtom_peers index ae414542..b5adab66 100755 --- a/plugins/rtorrent/rtom_peers +++ b/plugins/rtorrent/rtom_peers @@ -27,6 +27,7 @@ # ip rTorrent's ip address - using scgi_port - needed, when "src" is NOT set to "socket" # port rTorrent's scgi port (scgi_port) - using scgi_port - needed, when "src" is NOT set to "socket" # category Change graph category +# api use "pre09" (pre 0.9.0) or "current" (0.9.0+, the default) API calls # # Configuration example # @@ -74,11 +75,17 @@ my $src = $ENV{"src"} || ""; my $ip = $ENV{"ip"} || "127.0.0.1"; my $port = $ENV{"port"} || "5000"; my $socket = $ENV{"socket"} || ""; +my $api = $ENV{"api"} || "current"; my $pattern = qr/<(int|i4|i8|ex\.i8)>(\d+)<\/(int|i4|i8|ex\.i8)><\/value>/; my $tpattern = qr/[0-9A-F]{20}/; -my $line = "d.multicallmaind.get_hash=p.multicall=,p.is_encrypted=,p.is_incoming="; +my $line = ""; +if ($api =~ /pre09/) { + $line = "d.multicallmaind.get_hash=p.multicall=,p.is_encrypted=,p.is_incoming="; +} else { + $line = "d.multicall2maind.hash=p.multicall=,p.is_encrypted=,p.is_incoming="; +} my $llen = length $line; my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000"; my $hlen = length $header; diff --git a/plugins/rtorrent/rtom_spdd b/plugins/rtorrent/rtom_spdd index e2b08835..8a6f24e7 100755 --- a/plugins/rtorrent/rtom_spdd +++ b/plugins/rtorrent/rtom_spdd @@ -39,6 +39,7 @@ # port rTorrent's scgi port (scgi_port) - using scgi_port - needed, when "src" is NOT set to "socket" # category Change graph category # diff "yes" for using bps for upload and Bps for download, or anything else for using Bps for both +# api use "pre09" (pre 0.9.0) or "current" (0.9.0+, the default) API calls # # # Configuration example @@ -102,10 +103,17 @@ my $src = $ENV{"src"} || ""; my $ip = $ENV{"ip"} || "127.0.0.1"; my $port = $ENV{"port"} || "5000"; my $socket = $ENV{"socket"} || ""; +my $api = $ENV{"api"} || "current"; my $pattern = qr/<(int|i4|i8|ex\.i8)>([-]{0,1}\d+)<\/(int|i4|i8|ex\.i8)><\/value>/; -my $line = "system.multicallmethodNameget_up_totalparamsmethodNameget_down_totalparamsmethodNameget_upload_rateparamsmethodNameget_download_rateparams"; +my $line = ""; +if ($api =~ /pre09/) { + $line = "system.multicallmethodNameget_up_totalparamsmethodNameget_down_totalparamsmethodNameget_upload_rateparamsmethodNameget_download_rateparams"; +} else { + $line = "system.multicallmethodNamethrottle.global_up.totalparamsmethodNamethrottle.global_down.totalparamsmethodNamethrottle.global_up.max_rateparamsmethodNamethrottle.global_down.max_rateparams"; +} + my $llen = length $line; my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000"; my $hlen = length $header; diff --git a/plugins/rtorrent/rtom_vol b/plugins/rtorrent/rtom_vol index ea88fe13..4d366751 100755 --- a/plugins/rtorrent/rtom_vol +++ b/plugins/rtorrent/rtom_vol @@ -27,6 +27,7 @@ # ip rTorrent's ip address - using scgi_port - needed, when "src" is NOT set to "socket" # port rTorrent's scgi port (scgi_port) - using scgi_port - needed, when "src" is NOT set to "socket" # category Change graph category +# api use "pre09" (pre 0.9.0) or "current" (0.9.0+, the default) API calls # # Configuration example # @@ -78,6 +79,7 @@ my $src = $ENV{"src"} || ""; my $ip = $ENV{"ip"} || "127.0.0.1"; my $port = $ENV{"port"} || "5000"; my $socket = $ENV{"socket"} || ""; +my $api = $ENV{"api"} || "current"; my $pattern = qr/([A-Z0-9]+)<\/string><\/value>/; @@ -96,7 +98,11 @@ foreach ( @views ) { connect( SOCK, sockaddr_in( $port, inet_aton( $ip ) ) ); } - $line = "d.multicall${_}d.get_hash="; + if ($api =~ /pre09/) { + $line = "d.multicall${_}d.get_hash="; + } else { + $line = "d.multicall2${_}d.hash="; + } $llen = length $line; $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000"; $hlen = length $header;