Help to understand the logic of the program #1414
Unanswered
alibek2023
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can't figure out how to properly compose an RC file.
I want to make automatic distribution of torrents based on type. They should be distributed not after completion, but at the moment they are added. Source torrent files should be moved to the “.history” subdirectory, with the prefix corresponding to the category added to the file name.
Distribution pattern:
The RC-file should be modular and easy to extend. Therefore, it is made up of several parts.
dirs config
~/Torrents/ - base directory
~/Torrents/.session/ - session directory
~/Torrents/.history/ - the place where torrent files are moved to after they are added; category prefix is added to the file name when moving
~/Torrents/.log/ - logs directory
/data/ - destination directory (subdirectories download, video, music, etc)
/shares/nas_video_* - destination directories set (nas_video_movie, nas_video_serial, nas_video_children, etc)
logging
Common logging.
init
Prepare to work and print current states.
variables
Temporary variables for string operations.
What to do next, I don't know.
I was planning on doing it this way:
But this way doesn't work. Most likely because the added torrents (d.*) are not passed to the method when it is called.
The following should be happening:
In the RC-file, the list of available commands is limited. There are no operators for string handling (substr, instr, regexp) and I don't know how to handle torrents depending on their location.
Most likely I need to use the “event.download.inserted_new” method. But I can't understand how to combine it with using “load”.
If the “loaditem” method is written like this (remove any d.*):
In this case, the torrents are automatically downloaded. But they are downloaded to the default directory (/data/download), remain linked to the original torrent file (~/Torrents/...*.torrent), and rtorrent tries to re-add the original torrent file every 5 seconds, after which it writes the message “Could not create download: Info hash already used by another torrent.”.
That is, I need to move the original torrent file to a different location (which is not watched) and change the destination directory for the added torrents.
Beta Was this translation helpful? Give feedback.
All reactions