Skip to content

Commit

Permalink
Improved custom code docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kannibalox committed May 31, 2024
1 parent 386758d commit 8d3bd7d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/custom-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def _custom_fields():
# Add a single field, which is matched like a number,
# and accessed by performing a single RPC call.
yield engine.ConstantField(
int,
"piece_size", # name of the field
int, # The type of the field, supported types are: int, str, set, bool, list, untyped
"piece_size", # Name of the field
"Piece size for the item", # The description for --help
matcher=matching.FloatFilter, # The type to use when matching the field
accessor=lambda o: o.rpc_call("d.size_chunks"), # How to actually access the method
requires=["d.size_chunks"], # Optional but speeds up the process
matcher=matching.FloatFilter, # The filter type to use when matching the field, see pyrosimple.util.matching for a list of filters
accessor=lambda o: o.rpc_call("d.size_chunks"), # How to actually access the method. `o` is a pyrosimple.torrent.RtorrentItem
requires=["d.size_chunks"], # Optional, but great speeds any rtcontrol commands by allowing prefetching
)

# Insert any other custom fields here
Expand Down

0 comments on commit 8d3bd7d

Please sign in to comment.