You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A. Modify directory.watch.added
Allow it to accept multiple commands (as load.* commands).
There are multiple ways to achieve this but since there's no "shortcut" (the directory (that is watched) for inotify has to be separated), the final command (that is called on an "add" event) is reconstructed as a line of config.
1st param: the directory that will be watched
2nd param: the name of the main command that will be called if an "add" event is triggered (load.* commands)
rest of the params: extra commands that will be passed as arguments to the above specified main command
if an extra command include commas (, parameter separator) then it needs to be included inside quotes (")
B. Add directory.watch.removed
Similarly to loading event, add ability to handle removing events of meta files as *_untied commands:
*_untied commands can't deal with a download individually: they go through and check all the downloads (they can generate lot of IO, especially if they are used with schedule command)
directory.watch.removed handles this individually
Since it doesn't need any additional commands, it accepts multiple directories as parameters.
1st param: the command to call when a meta file is removed, only 3 commands are supported
untied.stop, untied.close, untied.remove
rest of the params: comma separated list of the directories that will be watched
C. Rename *tied commands
Rename untied commands and add redirects for the new names to preserve compatibility:
start_tied -> tied.start
stop_untied -> untied.stop
close_untied -> untied.close
remove_untied -> untied.remove
D. Limitations
a given directory can only be specified once with either directory.watch.added or directory.watch.removed
torrent meta files that are "added" / "removed" into/from watched directories will be discarded if rtorrent wasn't run at the time of adding / removing
it's a good idea to run the normal scheduled "watch" command once after rtorrent is started
probably it won't work well with network file systems (NFS, Samba, etc.)
E. directory.watch.* commands in action
Let's assume the following:
we have multiple watch directories with which we want to use different properties for downloads with a parameterised command (like this d.attribs.set)
we want to provide the ability of switching inotify support for users in config
we also want to watch directories for removed metafiles
the meta files is moved by rtorrent (internally) when a download is finished
# Defining directory constantsmethod.insert = cfg.dir.main, string|const|private, (cat,"/mnt/Torrents/")
method.insert = cfg.dir.sub, string|const|private, (cat,(cfg.dir.main),".rtorrent/")
method.insert = cfg.dir.meta_downl, string|const|private, (cat,(cfg.dir.sub),".downloading/")
method.insert = cfg.dir.meta_compl, string|const|private, (cat,(cfg.dir.sub),".completed/")
# Whether to use inotify for loading/removing torrent (meta) files from watch directoriesmethod.insert = cfg.inotify.use, value|const|private, 1
# Whatch dir definitions for loading metafiles using inotifybranch = ((cfg.inotify.use)), ((directory.watch.added, (cat,(cfg.dir.meta_downl),rotating/), load.start, "d.attribs.set=rotating,1,1"))
branch = ((cfg.inotify.use)), ((directory.watch.added, (cat,(cfg.dir.meta_downl),fullseed/), load.start, "d.attribs.set=fullseed,1,"))
branch = ((cfg.inotify.use)), ((directory.watch.added, (cat,(cfg.dir.meta_downl),unsafe/), load.start, "d.attribs.set=unsafe,,1"))
branch = ((cfg.inotify.use)), ((directory.watch.added, (cat,(cfg.dir.meta_downl),various/), load.start, "d.attribs.set=various,,"))
branch = ((cfg.inotify.use)), ((directory.watch.added, (cat,(cfg.dir.meta_downl),load/), load.normal, "d.attribs.set=unsafe,,1"))
# Fire up only once (after rtorrent is started) the normal scheluded load watch dirs as well even if inotify is used: load added metafiles when rtorrent hasn't been runbranch = ((cfg.inotify.use)), ((schedule2, watch_dir_1, 85, 0, ((load.start, (cat,(cfg.dir.meta_downl),rotating/*.torrent), "d.attribs.set=rotating,1,1"))))
branch = ((cfg.inotify.use)), ((schedule2, watch_dir_2, 86, 0, ((load.start, (cat,(cfg.dir.meta_downl),fullseed/*.torrent), "d.attribs.set=fullseed,1,"))))
branch = ((cfg.inotify.use)), ((schedule2, watch_dir_3, 87, 0, ((load.start, (cat,(cfg.dir.meta_downl),unsafe/*.torrent), "d.attribs.set=unsafe,,1"))))
branch = ((cfg.inotify.use)), ((schedule2, watch_dir_4, 88, 0, ((load.start, (cat,(cfg.dir.meta_downl),various/*.torrent), "d.attribs.set=various,,"))))
branch = ((cfg.inotify.use)), ((schedule2, watch_dir_5, 89, 0, ((load.normal,(cat,(cfg.dir.meta_downl),load/*.torrent), "d.attribs.set=unsafe,,1"))))
# Whatch dir definitions for removing metafiles using inotifybranch = ((cfg.inotify.use)), ((directory.watch.removed, d.erase, (cat,(cfg.dir.meta_compl),various/), (cat,(cfg.dir.meta_compl),unsafe/), (cat,(cfg.dir.meta_compl),rotating/), (cat,(cfg.dir.meta_compl),fullseed/), (cat,(cfg.dir.meta_compl),load/)))
# Whatch dir definitions for loading metafiles NOT using inotifybranch = ((not, (cfg.inotify.use))), ((schedule2, watch_dir_1, 5, 10, ((load.start, (cat,(cfg.dir.meta_downl),rotating/*.torrent), "d.attribs.set=rotating,1,1"))))
branch = ((not, (cfg.inotify.use))), ((schedule2, watch_dir_2, 6, 10, ((load.start, (cat,(cfg.dir.meta_downl),fullseed/*.torrent), "d.attribs.set=fullseed,1,"))))
branch = ((not, (cfg.inotify.use))), ((schedule2, watch_dir_3, 7, 10, ((load.start, (cat,(cfg.dir.meta_downl),unsafe/*.torrent), "d.attribs.set=unsafe,,1"))))
branch = ((not, (cfg.inotify.use))), ((schedule2, watch_dir_4, 8, 10, ((load.start, (cat,(cfg.dir.meta_downl),various/*.torrent), "d.attribs.set=various,,"))))
branch = ((not, (cfg.inotify.use))), ((schedule2, watch_dir_5, 9, 10, ((load.normal,(cat,(cfg.dir.meta_downl),load/*.torrent), "d.attribs.set=unsafe,,1"))))
# Removes torrents from client when its metafile (torrent file) has been deleted manually or by a script. If inotify isn't used: Run it every 5 seconds, otherwise run only once after rtorrent is started.branch = ((cfg.inotify.use)), ((schedule2, untied_torrents, 99, 0, ((untied.remove)))), ((schedule2, untied_torrents, 8, 10, ((untied.remove))))
The text was updated successfully, but these errors were encountered:
One of the advantages of using "inotify" to load and remove downloads by torrent meta files is the reduced file system IO (apart from it's instant).
Refers to: rakshasa#374
A. Modify
directory.watch.added
Allow it to accept multiple commands (as
load.*
commands).There are multiple ways to achieve this but since there's no "shortcut" (the directory (that is watched) for inotify has to be separated), the final command (that is called on an "add" event) is reconstructed as a line of config.
load.*
commands),
parameter separator) then it needs to be included inside quotes ("
)B. Add
directory.watch.removed
Similarly to loading event, add ability to handle removing events of meta files as
*_untied
commands:*_untied
commands can't deal with a download individually: they go through and check all the downloads (they can generate lot of IO, especially if they are used withschedule
command)directory.watch.removed
handles this individuallySince it doesn't need any additional commands, it accepts multiple directories as parameters.
untied.stop
,untied.close
,untied.remove
directory.watch.removed = d.erase, (cat,(cfg.dir.meta_compl),various/), (cat,(cfg.dir.meta_compl),unsafe/)
C. Rename
*tied
commandsRename untied commands and add redirects for the new names to preserve compatibility:
start_tied
->tied.start
stop_untied
->untied.stop
close_untied
->untied.close
remove_untied
->untied.remove
D. Limitations
directory.watch.added
ordirectory.watch.removed
E.
directory.watch.*
commands in actionLet's assume the following:
The text was updated successfully, but these errors were encountered: