Skip to content

Output Formats

fedarovich edited this page Aug 22, 2019 · 4 revisions

Output Formats

Introduction

Starting with version 1.5 qBittorrent CLI supports different output formats for many list and object details commands.

By default, the commands produce output for better look on the screen, but if you need to process the output with scripts or other tools, you can set output format to JSON or CSV now.

The commands supporting different output formats have an additional --format option.

The value of the format option has the following format:

name[:setting1=value1][:setting2=value2]...

As you can see, it constists of mandatory format name and an optional list of additional format settings separated by colons (:).

The allowed format names dependend on whether the command is a list command or an object command.

If the setting value must contain a colon you must escape it with the backslash \:

List commands

The list commands return lists of some objects. The examples of the list commands are the following:

The list commands support the following output formats

If no format is specified either table or list command is used depending on the command.

Object commands

The object commands return values of some object's properties. The examples of the object commands are the following:

The object commands supports the following output formats

If no format is specified then list format is used by default.

Formats

Table

The table format is designed for a nice look and feel, but is displays only part of the available information.

Here is an example of output of the torrent list --format table command:

╒══╤═══════════════════════════════════════╤══════╤══════════╤══════════╤═════════╕
│ST│Name                                   │Hash  │ DL Speed │ UL Speed │   ETA   │
╞══╪═══════════════════════════════════════╪══════╪══════════╪══════════╪═════════╡
│SU│debian-10.0.0-amd64-xfce-CD-1.iso      │ff3f0e│    0  B/s│    0  B/s│         │
├──┼───────────────────────────────────────┼──────┼──────────┼──────────┼─────────┤
│SU│manjaro-xfce-17.1.10-stable-x86_64.iso │3ab528│    0  B/s│    0  B/s│         │
└──┴───────────────────────────────────────┴──────┴──────────┴──────────┴─────────┘

The table format does not support additional settings.

List

The list format is designed to display a verbose list of object(s) properties. For the list commands, the individual object property lists are separated with one or more blank lines.

Here is an example of output of the torrent list --format list command:

Name:       debian-10.0.0-amd64-xfce-CD-1.iso
State:      StalledUpload
Hash:       ff3f0ea6f906b4b17b273b3228a53e7e441ec6e7
Size:       672 137 216 bytes
Progress:   100%
DL Speed:   0  B/s
UP Speed:   0  B/s
Priority:   0
Seeds:      0 of 120
Leechers:   0 of 184
Ratio:      0,26
ETA:
Category:
Tags:
Save path:  D:\Downloads\
Added:      29.07.2019 16:27:38
Completion: 29.07.2019 16:29:32
Options:

Name:       manjaro-xfce-17.1.10-stable-x86_64.iso
State:      StalledUpload
Hash:       3ab528e8324ba52a44c7b1e39010340b3f04c696
Size:       1 832 333 312 bytes
Progress:   100%
DL Speed:   0  B/s
UP Speed:   0  B/s
Priority:   0
Seeds:      0 of 268
Leechers:   0 of 18
Ratio:      1,27
ETA:
Category:   Application
Tags:
Save path:  D:\Downloads\
Added:      01.06.2018 0:54:49
Completion: 01.06.2018 1:00:02
Options:

The list format does not support additional settings.

JSON

The json format is designed for futher processing of the output. By default, the JSON text is idented, but you can disable identation using ident setting (see below).

Top level token is a JSON array for the list commands and JSON object for the object commands.

Here is an example of output of the torrent list --format json command:

[
  {
    "hash": "ff3f0ea6f906b4b17b273b3228a53e7e441ec6e7",
    "name": "debian-10.0.0-amd64-xfce-CD-1.iso",
    "magnet_uri": "magnet:?xt=urn:btih:ff3f0ea6f906b4b17b273b3228a53e7e441ec6e7&dn=debian-10.0.0-amd64-xfce-CD-1.iso&tr=http%3a%2f%2fbttracker.debian.org%3a6969%2fannounce",
    "size": 672137216,
    "progress": 1.0,
    "dlspeed": 0,
    "upspeed": 0,
    "priority": 0,
    "num_seeds": 0,
    "num_complete": 152,
    "num_leechs": 1,
    "num_incomplete": 191,
    "ratio": 0.26183559930694206,
    "eta": "100.00:00:00",
    "state": "stalledUP",
    "seq_dl": false,
    "f_l_piece_prio": false,
    "category": "",
    "tags": "",
    "super_seeding": false,
    "force_start": false,
    "save_path": "D:\\Downloads\\",
    "added_on": 1564406858,
    "completion_on": 1564406972,
    "tracker": "http://bttracker.debian.org:6969/announce",
    "dl_limit": null,
    "up_limit": null,
    "downloaded": 679284022,
    "uploaded": 177860739,
    "downloaded_session": 0,
    "uploaded_session": 180224,
    "amount_left": 0,
    "completed": 672137216,
    "ratio_limit": -2.0,
    "seen_complete": 1566310784,
    "last_activity": 1566310804,
    "time_active": "8.19:07:29",
    "auto_tmm": false,
    "total_size": 672137216,
    "max_ratio": -1,
    "max_seeding_time": -1,
    "seeding_time_limit": -2
  },
  {
    "hash": "3ab528e8324ba52a44c7b1e39010340b3f04c696",
    "name": "manjaro-xfce-17.1.10-stable-x86_64.iso",
    "magnet_uri": "magnet:?xt=urn:btih:3ab528e8324ba52a44c7b1e39010340b3f04c696&dn=manjaro-xfce-17.1.10-stable-x86_64.iso&tr=udp%3a%2f%2fmirror.strits.dk%3a6969&ws=http%3a%2f%2fonet.dl.osdn.jp%2fstorage%2fg%2fm%2fma%2fmanjaro%2fxfce%2f17.1.10%2fmanjaro-xfce-17.1.10-stable-x86_64.iso",
    "size": 1832333312,
    "progress": 1.0,
    "dlspeed": 0,
    "upspeed": 0,
    "priority": 0,
    "num_seeds": 0,
    "num_complete": 268,
    "num_leechs": 1,
    "num_incomplete": 18,
    "ratio": 1.2664005520872796,
    "eta": "100.00:00:00",
    "state": "stalledUP",
    "seq_dl": false,
    "f_l_piece_prio": false,
    "category": "Application",
    "tags": "",
    "super_seeding": false,
    "force_start": false,
    "save_path": "D:\\Downloads\\",
    "added_on": 1527803689,
    "completion_on": 1527804002,
    "tracker": "",
    "dl_limit": null,
    "up_limit": null,
    "downloaded": 1847868693,
    "uploaded": 2340141933,
    "downloaded_session": 0,
    "uploaded_session": 0,
    "amount_left": 0,
    "completed": 1832333312,
    "ratio_limit": -2.0,
    "seen_complete": 1529004204,
    "last_activity": 1566311221,
    "time_active": "13.22:07:20",
    "auto_tmm": false,
    "total_size": 1832333312,
    "max_ratio": -1,
    "max_seeding_time": -1,
    "seeding_time_limit": -2
  }
]

The json format has the following additional settings:

ident

Controls whether the output JSON must be idented.

Allowed values: false, true

Default value: true

In order to print not idented JSON the format option must have the following look:

--format json:ident=false

CSV

The csv format is designed for futher processing of the output. By default a comma (,) is used as a field delimiter but you can specify another one using format settings (see below).

Here is an example of output of the torrent list --format json command:

Hash,Name,MagnetUri,Size,Progress,DownloadSpeed,UploadSpeed,Priority,ConnectedSeeds,TotalSeeds,ConnectedLeechers,TotalLeechers,Ratio,EstimatedTime,State,SequentialDownload,FirstLastPiecePrioritized,Category,SuperSeeding,ForceStart,SavePath,AddedOn,CompletionOn,CurrentTracker,DownloadLimit,UploadLimit,Downloaded,Uploaded,DownloadedInSession,UploadedInSession,IncompletedSize,CompletedSize,RatioLimit,LastSeenComplete,LastActivityTime,ActiveTime,AutomaticTorrentManagement,TotalSize
ff3f0ea6f906b4b17b273b3228a53e7e441ec6e7,debian-10.0.0-amd64-xfce-CD-1.iso,magnet:?xt=urn:btih:ff3f0ea6f906b4b17b273b3228a53e7e441ec6e7&dn=debian-10.0.0-amd64-xfce-CD-1.iso&tr=http%3a%2f%2fbttracker.debian.org%3a6969%2fannounce,672137216,1,0,0,0,0,155,0,200,0.261835599306942,100.00:00:00,StalledUpload,False,False,,False,False,D:\Downloads\,07/29/2019 13:27:38,07/29/2019 13:29:32,http://bttracker.debian.org:6969/announce,,,679284022,177860739,0,180224,0,672137216,-2,08/20/2019 14:34:35,08/20/2019 14:20:04,8.19:16:59,False,672137216
3ab528e8324ba52a44c7b1e39010340b3f04c696,manjaro-xfce-17.1.10-stable-x86_64.iso,magnet:?xt=urn:btih:3ab528e8324ba52a44c7b1e39010340b3f04c696&dn=manjaro-xfce-17.1.10-stable-x86_64.iso&tr=udp%3a%2f%2fmirror.strits.dk%3a6969&ws=http%3a%2f%2fonet.dl.osdn.jp%2fstorage%2fg%2fm%2fma%2fmanjaro%2fxfce%2f17.1.10%2fmanjaro-xfce-17.1.10-stable-x86_64.iso,1832333312,1,0,0,0,0,268,0,18,1.26640055208728,100.00:00:00,StalledUpload,False,False,Application,False,False,D:\Downloads\,05/31/2018 21:54:49,05/31/2018 22:00:02,,,,1847868693,2340141933,0,0,0,1832333312,-2,06/14/2018 19:23:24,08/20/2019 14:36:31,13.22:16:50,False,1832333312

The csv format has the following additional settings:

delimiter

Sets the field delimiter.

Allowed values: Any string

Default value: ,

In order to use a colon as a delimeter, escape it with a backslash:
powershell: --format csv:delimiter=\:
bash: --format cvs:delimiter=\\: or --format 'cvs:delimiter=\:'

In order to use a tab as a delimeter, use \t escape sequence:
powershell: --format csv:delimiter=\t or --format csv:delimiter=`t
bash: --format cvs:delimiter=\\t or --format 'cvs:delimiter=\t'

quote

Sets the quote character.

Allowed values: Any single character

Default value: "

culture

Set the culture used for formatting dates, numbers, etc.

Allowed values: RFC 5646 standard identification for a language

Default value: (invariant culture)

The examles of RFC 5646 tags are: en, en-US, de-DE.

property

The property format is designed for futher processing of the output. When it is used, only one property value is printer. The property name must be specified in name setting (see below).

Here is the example of output of the torrent properties ff3f0e -F property:name=Size command:

672137216

The property format has the following settings:

name

Specifies the property name.

This setting is required!

The value can be any of the following:

  • The pretty name of the property as shown in list format, e.g. Default save path.
  • The JSON name of the property as shown in json format, e.g. SavePath.
  • The CSV name of the property as shown in csv format, e.g. SavePath.
  • The long command option name without leading -- if the command supports setting this property, e.g. save-folder.

culture

Set the culture used for formatting dates, numbers, etc.

Allowed values: RFC 5646 standard identification for a language

Default value: (invariant culture)

The examles of RFC 5646 tags are: en, en-US, de-DE.

format

If the property is a number, date or time, you can use format option to fine-tune the way the value is displayed.

The allowed format strings can be found in .Net documentation:

Clone this wiki locally