Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (94 sloc) 4.49 KB
### UI/Categories: Category Rotation and Watches ############################
# vim: ft=dosini
#
# List all category views: python-pyrocore -m pyrocore.ui.categories -l
# Rotate to next view: python-pyrocore -m pyrocore.ui.categories -qn
# Rotate to previous view: python-pyrocore -m pyrocore.ui.categories -qp
# Re-filter current view: python-pyrocore -m pyrocore.ui.categories -qu
#
# See also 'd.category.set' in 'helper-methods'.
#
# Example category definitions:
#
# echo >>rtorrent.d/categories.rc "pyro.category.add = hdtv"
# echo >>rtorrent.d/categories.rc "pyro.category.add = movies"
# echo >>rtorrent.d/categories.rc "pyro.category.add = books"
#
# UI/Keys: Prev / Update / Next [ < | > ]
pyro.bind_key = category_view_prev, <,\
"execute.nothrow.bg = (cat,(pyro.bin_dir),python-pyrocore), -m, pyrocore.ui.categories, -q, --prev"
pyro.bind_key = category_view_update, |,\
"execute.nothrow.bg = (cat,(pyro.bin_dir),python-pyrocore), -m, pyrocore.ui.categories, -q, --update"
pyro.bind_key = category_view_next, >,\
"execute.nothrow.bg = (cat,(pyro.bin_dir),python-pyrocore), -m, pyrocore.ui.categories, -q, --next"
# HELPER: Add a category
method.insert = pyro.category.list, multi|rlookup|static
method.insert = pyro._category.add_new, private|simple,\
"view.add = (cat, category_, (argument.0)) ;\
pyro.view.collapsed.toggle = (cat, category_, (argument.0)) ;\
method.set_key = pyro.category.list, (argument.0), (cat, print=, (argument.0))"
method.insert = pyro.category.add, private|simple,\
"branch = \"not = (method.has_key, pyro.category.list, (argument.0))\", \
\"pyro._category.add_new = (argument.0)\""
# HELPER: Compare item category (label) to a given text (arg.0), for filtering
method.insert = pyro._in_category, simple|private, "equal={d.custom1=,argument.0=}"
# HELPER: Filter a category view
method.insert = pyro.category.update, simple,\
"view.filter = (cat, category_, (argument.0)), pyro._in_category=$argument.0="
# HELPER: Categorized watches
#
# This allows you to add concise labelled watches like this:
#
# schedule2 = watch_hdtv, 123, 10, ((load.category, hdtv))
#
# Metafiles are loaded from a subdir with the given category
# name, in the normal watch folder (cfg.watch).
#
# The "category" custom attribute is set to the given label,
# as is "custom1" (the ruTorrent label). Use either in your
# completion handler to create target paths.
#
# If you use "load.category", items are started immediately by
# default, but you can change that with "cfg.watch.start.set = 0".
# There are also variants with fixed behaviour, named
# "load.category.normal" and "load.category.start".
#
# Alternatively, you can add `pyro.category.separated.set = 1` to
# the END of your custom config, which causes the download path
# to be set immediately to a categorized one (`…/work/‹category›`).
#
method.insert.value = pyro.category.separated, 0
method.insert = d.category.set, simple,\
"branch = (method.has_key, pyro.category.list, (argument.0)),\
((do,\
((d.custom1.set, (argument.0))),\
((pyro.category.update, (d.custom,category))),\
((d.custom.set, category,(argument.0))),\
((pyro.category.update, (argument.0)))\
)),\
((print, (cat, \"Category '\", (argument.0), \"' does not exist\")))"
method.insert = pyro._category.path, private|simple,\
"cat = (directory.default), /, (argument.0)"
method.insert = pyro._category.check_set_dir, private|simple,\
"branch = (pyro.category.separated),\
((d.directory.set, (pyro._category.path, (argument.0))))"
method.insert = load.category, private|simple,\
"load.verbose =\
(cat,(cfg.watch),(argument.0),/*.torrent),\
(cat, d.category.set=, (argument.0)),\
(cat, pyro._category.check_set_dir=, (argument.0)),\
(cat, d.watch.startable=) ;\
pyro.category.update=(argument.0)"
method.insert = load.category.normal, private|simple,\
"load.verbose =\
(cat,(cfg.watch),(argument.0),/*.torrent),\
(cat, d.category.set=, (argument.0)),\
(cat, pyro._category.check_set_dir=, (argument.0)) ;\
pyro.category.update=(argument.0)"
method.insert = load.category.start, private|simple,\
"load.start_verbose =\
(cat, (cfg.watch), (argument.0), /*.torrent),\
(cat, d.category.set=, (argument.0)),\
(cat, pyro._category.check_set_dir=, (argument.0)) ;\
pyro.category.update = (argument.0)"
# END categories