Fwd: btpd raw list/stats

17 views
Skip to first unread message

Cedric Tefft

unread,
Feb 12, 2010, 4:26:28 PM2/12/10
to
Hi all -

I tried sending this to Richard Nyberg directly at both of his
@murmeldjur.se addresses, so far with no response. So, I throw this
out to the list both to get your input as well as to ask if anybody
knows how to get in touch with Richard.

Thanks,

- Cedric


-------- Original Message --------

Hi Richard -

I've been fiddling with sort of a front-end to btcli for which I needed
a bit more detail than I could get out of btcli's list or stat
commands. Anyway, to make a long story short, I added some code to
btcli to dump torrent data/stats in a format suitable for machine
parsing. I implemented it as 'raw' list mode. It looks like this:

lithium:~ > btcli list -r

HASH[8]: b148c4beff54ae919bd5ac947e86395e7e39c532
NAME[8]: my_test_torrent2
DIR[8]: /data/user/cedric/inbox/bt/active/my_test_torrent2
STATE[8]: I
PEERS[8]: 0
BYTES_TOTAL[8]: 6026993900
BYTES_HAVE[8]: 0
BYTES_SENT[8]: 0
BYTES_DOWNLOADED[8]: 0
BYTES_UPLOADED[8]: 0
BPS_DOWN[8]: 0
BPS_UP[8]: 0
PIECES_TOTAL[8]: 12
PIECES_AVAIL[8]: 0
PIECES_HAVE[8]: 12

HASH[3]: ad164a08b74eb04cf5491a7c04f624bca6d8a3e3
NAME[3]: my_test_torrent_with_a_name_longer_than_40_characters
DIR[3]:
/data/user/cedric/inbox/bt/active/my_test_torrent_with_a_name_longer_than_40_characters
STATE[3]: L
PEERS[3]: 23
BYTES_TOTAL[3]: 11559003430
BYTES_HAVE[3]: 2230887718
BYTES_SENT[3]: 2294546207
BYTES_DOWNLOADED[3]: 2236132081
BYTES_UPLOADED[3]: 2294546207
BPS_DOWN[3]: 0
BPS_UP[3]: 0
PIECES_TOTAL[3]: 2756
PIECES_AVAIL[3]: 534
PIECES_HAVE[3]: 532

So, my questions are:

1) Would you consider adding this feature into the official btpd source?
2) If so, are there any modifications you would like me to make before
doing so?

I'm including my working version of the patch. It's not clean enough to
be incorporated as-is, but it should give you the basic idea.

Thanks,

- Cedric


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100212/8344f0d1/attachment.htm
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: listraw.patch
Url: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100212/8344f0d1/attachment.txt

Cedric Tefft

unread,
Feb 15, 2010, 12:39:36 PM2/15/10
to
Anyone? Bueller?

> _______________________________________________
> btpd-users mailing list
> btpd-users at murmeldjur.se
> http://lists.stargirl.org/listinfo/btpd-users


>
-------------- next part --------------
An HTML attachment was scrubbed...

URL: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100215/86fd46ab/attachment.htm

Cesare Falco

unread,
Feb 16, 2010, 3:25:46 AM2/16/10
to
Just to let you know you're not alone in the ML. :)

Cesare.


2010/2/15, Cedric Tefft <logicloop at gmail.com>:

Alexander Bogdanov

unread,
Feb 16, 2010, 1:52:40 PM2/16/10
to
'course he's not.

I suppose, this patch's not gonna be paid any attention, because btpd's
native "btcli list" is not so hard to parse.
Moreover, you'd rather use socket to communicate with it (get list, or so)

2010/2/16 Cesare Falco <cesare.falco at gmail.com>

-------------- next part --------------
An HTML attachment was scrubbed...

URL: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100216/9126eb5f/attachment.htm

Cedric Tefft

unread,
Feb 18, 2010, 4:35:17 AM2/18/10
to
Well, as I said, I created the feature because I needed MORE DETAIL than
the list command provides. It had nothing to do with btcli being hard
to parse (which it isn't, as you said). I did also consider using the
socket interface, but I'm trying to think beyond my own personal needs
here. The reason I'd like to see this integrated into the official
distribution is not for me, but for other people LIKE me who want to do
something similar. I see this feature as facilitating the ability to
write custom wrappers and front-ends to BTPD. Yes, all of this CAN be
done with the socket interface, but I think the solution I've come up
with is better for a couple of reasons:

1) A text interface is much easier to deal with from the perspective of
a wrapper program. Your average sysadmin can probably write a basic
shell/awk/perl script to parse text, but the socket interface is pretty
complex by comparison. A text interface makes btpd more accessable to a
wider range of users and sysadmins. I think that's a good thing.
2) The socket interface depends on some enums. When those enums change
in future versions, they could potentially break third-party clients
that were built against the old enums. What's worse, those clients may
not even be able to recognize the interface has changed.
3) The socket interface is, as far as I can tell, undocumented.

Certainly it's POSSIBLE to do this with the socket interface, but the
text interface seems, to me, to be a more robust solution in the long
term, not to mention it (potentially) opens up BTPD to a wider audience.

Thx,

- Cedric

On 2/16/2010 11:52 AM, Alexander Bogdanov wrote:
> 'course he's not.
>
> I suppose, this patch's not gonna be paid any attention, because
> btpd's native "btcli list" is not so hard to parse.
> Moreover, you'd rather use socket to communicate with it (get list, or so)
>
> 2010/2/16 Cesare Falco <cesare.falco at gmail.com

> <mailto:cesare.falco at gmail.com>>


>
> Just to let you know you're not alone in the ML. :)
>
> Cesare.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...

URL: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100218/a61f9544/attachment.htm

Martin Miller

unread,
Feb 18, 2010, 8:40:51 AM2/18/10
to
I'm a new subscriber. I currently use transmission-daemon, and parse the
text output of torrent stats using a perl script in exactly the way that
Cedric described.

The reason I haven't switched yet is because stat doesn't give me enough
information. I collect:

Hash,Name,directory,tracker URL,total uploaded, total downloaded, number of
seeders, date created (when the torrent file was originally created, not
added)

I don't know how to communicate via socket.

I would be interested in seeing this pursued. Otherwise I'd like to get
access to the patch so I can access this information for my own purposes.

Martin

On Thu, Feb 18, 2010 at 8:00 PM, <btpd-users-request at murmeldjur.se> wrote:

> Send btpd-users mailing list submissions to
> btpd-users at murmeldjur.se
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.stargirl.org/listinfo/btpd-users
> or, via email, send a message with subject or body 'help' to
> btpd-users-request at murmeldjur.se
>
> You can reach the person managing the list at
> btpd-users-owner at murmeldjur.se
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of btpd-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Fwd: btpd raw list/stats (Cedric Tefft)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 18 Feb 2010 02:35:17 -0700
> From: Cedric Tefft <logicloop at gmail.com>
> Subject: Re: Fwd: btpd raw list/stats
> To: "btpd general discussion." <btpd-users at murmeldjur.se>
> Message-ID: <4B7D09D5.9000503 at gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"

> http://lists.stargirl.org/pipermail/btpd-users/attachments/20100218/a61f9544/attachment.html
>
> ------------------------------


>
> _______________________________________________
> btpd-users mailing list
> btpd-users at murmeldjur.se
> http://lists.stargirl.org/listinfo/btpd-users
>
>

> End of btpd-users Digest, Vol 41, Issue 4
> *****************************************


>
-------------- next part --------------
An HTML attachment was scrubbed...

URL: http://lists.stargirl.org/pipermail/btpd-users/attachments/20100218/cf165734/attachment.htm

Matt

unread,
Feb 18, 2010, 10:43:29 AM2/18/10
to
On Thu, 18 Feb 2010 22:40:51 +0900
Martin Miller <martin.miller7 at gmail.com> wrote:

> I would be interested in seeing this pursued. Otherwise I'd like to
> get access to the patch so I can access this information for my own
> purposes.

If you look at Cedric's first e-mail, he included the source diff's in
the message.


Matt

Marq Schneider

unread,
Jul 29, 2010, 11:00:38 PM7/29/10
to btpd-...@googlegroups.com
On Fri, Feb 12, 2010 at 16:26, Cedric Tefft <logi...@gmail.com> wrote:
> I've been fiddling with sort of a front-end to btcli for which I needed a
> bit more detail than I could get out of btcli's list or stat commands.
> Anyway, to make a long story short, I added some code to btcli to dump
> torrent data/stats in a format suitable for machine parsing.  I implemented
> it as 'raw' list mode.

This is the last issue i want to fix before the 0.16 release. I just
checked in a change [0] that i think solves the problem of making more
machine-friendly output and additionally solves the problem of
deciding on a format to use. I implemented an optional printf()-style
customizable format for the 'btcli list' operation. This allows
complete customization in the output. Examples:

Old operation still works as default:
$ btcli list
NAME NUM ST HAVE SIZE RATIO
archlinux-2010.05-netinstall-dual.iso 0 S. 100.0% 324.00M 0.06
ubuntu-10.04-desktop-i386.iso 1 S. 100.0% 699.44M 0.61

Simple formatting option (similar to default output):
$ btcli list -f "%n\t%#\t%p%s\t%r\n"
archlinux-2010.05-netinstall-dual.iso 0 100.0% 324.00M 0.06
ubuntu-10.04-desktop-i386.iso 1 100.0% 699.44M 0.61

Full formatting options, comma-separated:
$ btcli list -f
"%#,%^,%A,%D,%H,%P,%R,%S,%U,%T,%d,%g,%h,%n,%p,%r,%s,%t,%u,%v,%%:"
0,0,0,343968902,648,0,,S,19824309,648,/mnt/data/dl/btpd/arch,339738624,43d3eaeeb4138054b212a665e47d65a11596564e,archlinux-2010.05-netinstall-dual.iso,100.0%
, 0.06 ,324.00M
,339738624,19824309,0,%:1,2569,1399,850551846,1399,4,,S,447553225,1399,/mnt/data/dl/btpd/ubuntu,733419520,3e16157f0879eb43e9e51f45d485feff90a77283,ubuntu-10.04-desktop-i386.iso,100.0%
, 0.61 ,699.44M ,733419520,447553225,0,%:

Does this work for everyone? Or is this overkill for people and i
should add a configure flag to optionally remove this?

[0] http://github.com/btpd/btpd/commit/76c49475cea16512cb319a5222f657254f487cc5

-Marq

Nicholas Marriott

unread,
Jul 30, 2010, 3:17:55 AM7/30/10
to btpd-...@googlegroups.com
Looks great to me.

configure flags for functionality (especially trivial things like this)
are awful, it would be great to avoid them.


On Thu, Jul 29, 2010 at 10:00:38PM -0500, Marq Schneider wrote:
> On Fri, Feb 12, 2010 at 16:26, Cedric Tefft <logi...@gmail.com> wrote:
> > I've been fiddling with sort of a front-end to btcli for which I needed a
> > bit more detail than I could get out of btcli's list or stat commands.
> > Anyway, to make a long story short, I added some code to btcli to dump

> > torrent data/stats in a format suitable for machine parsing.? I implemented

Cedric Tefft

unread,
Jul 30, 2010, 11:31:13 AM7/30/10
to btpd-...@googlegroups.com
On 7/29/2010 8:00 PM, Marq Schneider wrote:
> On Fri, Feb 12, 2010 at 16:26, Cedric Tefft<logi...@gmail.com> wrote:
>> I've been fiddling with sort of a front-end to btcli for which I needed a
>> bit more detail than I could get out of btcli's list or stat commands.
>> Anyway, to make a long story short, I added some code to btcli to dump
>> torrent data/stats in a format suitable for machine parsing. I implemented
>> it as 'raw' list mode.
> This is the last issue i want to fix before the 0.16 release. I just
> checked in a change [0] that i think solves the problem of making more
> machine-friendly output and additionally solves the problem of
> deciding on a format to use. I implemented an optional printf()-style
> customizable format for the 'btcli list' operation. This allows
> complete customization in the output.
Looks good and frankly I think this is a better solution than mine. I
agree with Nicholas -- a configure switch is unnecessary.

- Cedric

Reply all
Reply to author
Forward
0 new messages