aboutsummaryrefslogtreecommitdiff
path: root/scripts/enqueue.md
blob: 210fb91b1e49c609fc0131a158a13af7a91f673a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Enqueue

Inserts tasks into the queue with some time interval.

## Configuration

- `enqueue`
  - `list_file`: Path to the task list. The format is described below. (optional
    string)
  - `retry_failed`: Move failed completed tasks back to the queue instead of
    adding from a list file.
  - `kind`: Task kind to insert.
  - `interval`: Number of seconds to wait in between inserts. (number)
  - `filter`: Only inserts tasks that have this flag attached. The flag will be
    removed. This filters for fail reason if `retry_failed` is used. (optional
    string)
  - `default_flags`: List of flags attached to every task except where manually
    removed. (optional list of string)
  - `data`: Additional attributes that will be attached to the tasks data.

```yaml
enqueue:
    - list_file: /home/user/silly_tasks.ini
      kind: webpage-download
      interval: 86400
      filter: "important"
      default_flags: ["novideos"]
      data:
          priority: 100
          output: /home/user/somedir

    - retry_failed: true
      kind: webpage-download
      interval: 86400
      filter: "some_reason"
```

## Task list file format

A file that contains one task per line. Empty lines are ignored. The INI
syntax-highlighted works well with this format.

Each line follows the format `OUTPUT=ID;FLAGS` where

- `ID` forms the task key together with the task kind from the config
- `OUTPUT` is attached as-is to the task data as `output`. If output is already
  specified in `data` then `OUTPUT` is path-joined to that.
- `FLAGS` is a space seperated list of flags that will be added to the task
  data's `flags` attribute together with all default flags. Including
  `-FLAGNAME` here, prevents the default flag `FLAGNAME` from being added.

Sample file:

```ini
example=https://example.org;important noimages
sometask=https://example.com;noimages -novideos
```