PQL - The PicoTorrent Query Language
PicoTorrent ships with an embedded query language (called PQL) which makes it possible to filter the torrent list view in order to quickly show relevant information.
PQL supports two primitive and two compound types:
NUMBER- signed integer or floating-point number;
STRING- string of Unicode characters enclosed within quotation marks.
SIZE- consists of a
NUMBERtype value followed by zero or one size unit. See type examples;
SPEED- consists of a
NUMBERtype value followed by zero or one speed unit. See type examples.
These are the fields available to query:
dl(SPEED type) - the current downloading speed;
name(STRING type) - the name of the torrent as seen in the UI;
progress(NUMBER type) - the current progress in percents;
size(SIZE type) - the total wanted size - e.g. total size excluding skipped files;
status(STRING type) - the torrent current status. This field accepts the following string values:
queued- either for downloading or uploading;
ul(SPEED type) - the current uploading speed.
PQL use the JEDEC Standard 100B.01 prefixes for its units of size and speed. The units are used unquoted and are case insensitive. They can be separated with an optional white space from the preceding numeric value.
Units of Size
Used in conjunction with the size field and together form
b- bytes, default unit of size if none other provided;
Units of Speed
Used in conjunction with dl and ul fields and together form
bps- bytes per second, default unit of speed if none other provided;
kbps- Kilobytes per second;
mbps- megabytes per second;
gbps- Gigabytes per second.
PQL supports a handful of operators to make filtering flexible.
There are two logical operators:
and- Logical And;
or- Logical Or.
In PQL you can use 6 comparison operators:
<- less than;
<=- less than or equal to;
>- greater than;
>=- greater than or equal to;
~- like. Case insensitive string matching.
NUMBERvalue equal to 5 and size unit equal to kb.
NUMBERvalue equal to 10 and speed unit equal to kbps.
Torrents larger than 1GB.
size > 1gb
Torrents where the name contains ubuntu.
name ~ "ubuntu"
Torrents with either 1080p or 720p in the name.
name ~ "1080p" or name ~ "720p"
Torrents downloaded at least to 90%.
progress >= 90
Torrents larger than 1GB that are currently downloading.
size > 1gb and status = "downloading"
Torrents that are currently queued.
status = "queued"
Torrents that are downloading with more than 10 mbps.
dl > 10mpbs
Torrents that are uploading with more than 5 mbps.
ul > 5mpbs