# Log extension switch setting
branch=pyro.extended=,\
    print=rTorrent-PS\\\ features\\\ active!,\
    print=rTorrent-PS\\\ features\\\ NOT\\\ active!

# COMMAND: Return startup time (can be used to calculate uptime)
method.insert = startup_time, value|const, $system.time=

# COMMAND: Return path to item data (never empty, unlike `d.base_path`);
#          multi-file items return a path ending with a '/'.
method.insert = d.data_path, simple,\
    "if=(d.is_multi_file),\
        (cat, (d.directory), /),\
        (cat, (d.directory), /, (d.name))"

# COMMAND: Return path to session file
method.insert = d.session_file, simple, "cat=(session.path), (d.hash), .torrent"

# COMMAND: Nicer key binds (hide technical complications)
method.insert = pyro._bind_schedule, private|simple,\
    "schedule2=(argument.0), 1, 0, (argument.1)"
method.insert = pyro._bind_key_command, private|simple,\
    "cat=\"ui.bind_key=download_list,\",$argument.0=,\",\\\"\",$argument.1=, \"\\\"\""
method.insert = pyro.bind_key, private|simple,\
    "branch=(pyro.extended),\
        ((pyro._bind_schedule, (argument.0), (pyro._bind_key_command, (argument.1), (argument.2))))"

# COMMAND: Safely toggle collapsed state of views
method.insert = pyro.view.collapsed.toggle, private|simple,\
    "branch=(pyro.extended), ((view.collapsed.toggle, (argument.0)))"
method.insert = pyro.collapsed_view.add, private|simple,\
    "view.add=(argument.0) ;pyro.view.collapsed.toggle=(argument.0)"

# UI/VIEW: Bind "*" to toggle between collapsed and expanded display
pyro.bind_key = collapsed_view_toggle, *, "view.collapsed.toggle="

# UI/VIEW: Default view for filtering results (bound to '^' key in rT-PS)
pyro.collapsed_view.add = rtcontrol
view.filter = rtcontrol, ((false))
pyro.bind_key = rtcontrol_view, ^, "ui.current_view.set=rtcontrol"

# UI/Key: Press 'u' for uptime
method.insert = pyro._print_uptime, private|simple,\
    "print=\"rTorrent \", $system.library_version=,\
    /, $system.client_version=,\
    \" started \", $convert.date=$startup_time=,\
    \" \", $convert.time=$startup_time=,\
    \", up \", $convert.elapsed_time=$startup_time=,\
    \" [PID=\", $system.pid=,],\
    \" [CWD=\", $system.cwd=,]"

pyro.bind_key = print_uptime, u, "pyro._print_uptime="
