kannibalox / pyrosimple

An overhauled fork of the pyrocore tools for rTorrent

Home Page:https://kannibalox.github.io/pyrosimple/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing fields

codedesperate opened this issue · comments

Hi,
I just installed Pyrosimple and super easy setup! Very happy you guys have made this project!
I installed it to get rtcontrol.
I have setup Aliases in the config, and this works on new torrents.

But what about all my existing torrents? If I select the tracker field with rtcontrol I can see the tracker on existing torrents. But how do I set the appropriate alias on existing torrents?

The way I see it, I need to run through all the torrents, read the tracker, load the config to read the appropriate alias, and then set the alias. But I don't know how to do this :(

EDIT
Same with the completed field. I don't have any info here either for existing torrents.

The alias is cached in the memo_alias custom field. The code is written so that it should reduce to the shortest configured alias, but if you want to clear the cache and start fresh, it's as simple as:

rtcontrol // -o hash --custom memo_alias=
rtcontrol // -o alias

That will set memo_alias for all torrents to a blank string, and then immediately recalculate the alias from the config.

For the completed field (and a couple other timestamp fields), it's a bit more complex, so there's a configuration snippet and backfill command documented here: https://kannibalox.github.io/pyrosimple/rtorrent-config/#timestamps

Thank you @kannibalox,
those alias commands fixed my issue. I configured just one Alias in the configuration to start with, and that gave all my torrents the same alias. After having fully configured the Aliases and running your commands, it now matches up.

I have now added the config to .rtorrent.rc. I can see the timestamps of new torrents, but not for older ones. It seems the backfill command does not work in my case. I might just have to wait it out till all my data has rotated. EDIT All my torrents have gotten todays timestamp. That is okay, i'll wait for them to rotate.

If I may borrow your expertise for one more thing, I have a question I hope you could help me with. My goal is that data automatically rotates in rtorrent, so that the oldest files are deleted. I wrote this script that "works".

#!/bin/bash
CLEAN=98
space_left=$(df -h /home/CENSORED/rtorrent/download/ | grep -vE '^Filesystem' | awk '{ print $5 }' | cut -d'%' -f1)
if [ $space_left -ge $CLEAN ]
then
    FILE=$(find /home/CENSORED/rtorrent/download/rtorrent_radarr* -type f -name *.mkv -printf '%T+ %p\n' | sort | head -n 1 | sed 's|^.*/||' | sed 's/.mkv//')
    /home/CENSORED/.local/bin/rtcontrol "$FILE*" --cull --cron --yes
fi

Once all my torrents have rotated and then have a "completed" timestamp, is there then a more direct rtcontrol command that can search for the oldest torrent and cull it? I've searched and read the documentation, but I can only fidn an option to look for a set timeframe. Not a "Give me the oldest torrent" timeframe.

I have now added the config to .rtorrent.rc. I can see the timestamps of new torrents, but not for older ones. It seems the backfill command does not work in my case. I might just have to wait it out till all my data has rotated. EDIT All my torrents have gotten todays timestamp. That is okay, i'll wait for them to rotate.

The backfill command requires access to the files/session directory, but if that's not the case it should give you a bunch of errors explaining so.

Once all my torrents have rotated and then have a "completed" timestamp, is there then a more direct rtcontrol command that can search for the oldest torrent and cull it?

There's a bit of redundancy here to be efficient/safe, but the command to cull the oldest completed torrent would be:

rtcontrol --sort completed completed\>0 --from=complete --select 1 --cull --quiet --yes

@kannibalox Okay, when I run the backfill command I just get exit code 0 so it ran successfully, but I don't see my completed timestamps update. The user I run the pyroadmin command with is also the owner of the .session folder and all its files.

Thank you for that command! <3
piggyback question to that command. How can I select multiple Aliases? I figured out to select not more than three aliases.
This is the only way I can select 3. And I don't see it possible to select 4:
alias=TEST1 OR [ alias=TEST2 OR alias=TEST3 ]

These variations do not work:
alias=TEST1,TEST2
alias=TEST1 OR alias=TEST2 OR alias=TEST3
alias=TEST1 alias=TEST2

It is important to me to use multiple aliases in a single rtcontrol command, and not multiple rtcontrol commands. As the single rtcontrol command should delete the oldest torrent of the specified trackers.

@kannibalox Okay, when I run the backfill command I just get exit code 0 so it ran successfully, but I don't see my completed timestamps update. The user I run the pyroadmin command with is also the owner of the .session folder and all its files.

Very strange. If you try doing pyroadmin --debug backfill, it'll tell you exactly what commands it's trying to run. If it only prints out 3 d.multicall2 commands, that means it thinks it's done all the backfilling it can.

piggyback question to that command. How can I select multiple Aliases?

Hm, the multiple alias=TEST1 OR alias=TEST2 OR alias=TEST3 variation should work but there might be a bug. In the meantime you can also use regexes to accomplish the same thing:

rtcontrol 'alias=/^(TEST1|TEST2|TEST3|etc..)$/'

@kannibalox
Okay, I think It has done all the backfilling it could. Which in my case were 0 torrents. Not sure why. I just see the 3 d.multicall2 and a bit extra. Seen here:

pyroadmin --debug backfill
DEBUG:pyrosimple.scripts.pyroadmin.AdminTool:Options: dry_run=False, func=<bound method AdminTool.backfill of <pyrosimple.scripts.pyroadmin.AdminTool object at 0x7f7a715b35b0>>, log_level=10, print_completion=None, url=None
DEBUG:pyrosimple.util.rpc:method 'system.multicall', params ([{'methodName': 'system.client_version', 'params': []}, {'methodName': 'system.library_version', 'params': []}, {'methodName': 'system.time_usec', 'params': []}, {'methodName': 'session.name', 'params': []}, {'methodName': 'directory.default', 'params': []}, {'methodName': 'session.path', 'params': []}],)
DEBUG:pyrosimple.util.rpc:method 'startup_time', params ()
DEBUG:pyrosimple.torrent.rtorrent.RtorrentEngine:RtorrentEngine connected to CENSORED:1761891 [rTorrent 0.13.8/0.9.8] via '127.0.0.1:5000'
DEBUG:pyrosimple.util.rpc:method 'd.multicall2', params ('', 'main', 'd.base_path=', 'd.complete=', 'd.custom=memo_alias', 'd.custom=tm_completed', 'd.custom=tm_loaded', 'd.custom=tm_started', 'd.down.rate=', 'd.down.total=', 'd.hash=', 'd.is_active=', 'd.is_multi_file=', 'd.is_open=', 'd.is_private=', 'd.message=', 'd.name=', 'd.ratio=', 'd.size_bytes=', 'd.tied_to_file=', 'd.tracker_size=', 'd.up.rate=', 'd.up.total=')
DEBUG:pyrosimple.torrent.rtorrent.RtorrentEngine:Got 247 items with 21 attributes
DEBUG:pyrosimple.util.rpc:method 'd.multicall2', params ('', 'main', 'd.base_path=', 'd.complete=', 'd.custom=memo_alias', 'd.custom=tm_completed', 'd.custom=tm_loaded', 'd.custom=tm_started', 'd.down.rate=', 'd.down.total=', 'd.hash=', 'd.is_active=', 'd.is_multi_file=', 'd.is_open=', 'd.is_private=', 'd.message=', 'd.name=', 'd.ratio=', 'd.size_bytes=', 'd.tied_to_file=', 'd.tracker_size=', 'd.up.rate=', 'd.up.total=')
DEBUG:pyrosimple.torrent.rtorrent.RtorrentEngine:Got 247 items with 21 attributes
DEBUG:pyrosimple.util.rpc:method 'd.multicall2', params ('', 'main', 'd.base_path=', 'd.complete=', 'd.custom=memo_alias', 'd.custom=tm_completed', 'd.custom=tm_loaded', 'd.custom=tm_started', 'd.down.rate=', 'd.down.total=', 'd.hash=', 'd.is_active=', 'd.is_multi_file=', 'd.is_open=', 'd.is_private=', 'd.message=', 'd.name=', 'd.ratio=', 'd.size_bytes=', 'd.tied_to_file=', 'd.tracker_size=', 'd.up.rate=', 'd.up.total=')
DEBUG:pyrosimple.torrent.rtorrent.RtorrentEngine:Got 247 items with 21 attributes
INFO:pyrosimple.scripts.pyroadmin.AdminTool:Total time: 0.127 seconds.

alias=TEST1 OR alias=TEST2 OR alias=TEST3 might be a bug then. To clarify the command does run with exit code 0, but when I add the third "OR" it givs me zero results.

CENSORED@CENSORED:~$ rtcontrol alias=TEST1 OR alias=TEST2 OR alias=TEST3 -o name | wc -l
0
CENSORED@CENSORED:~$

I've tested all all alias's and they work, and also in any combination as long as it's just 1 "OR". The second OR makes it come back empty handed.

Regex of course! Adding that works perfectly. :)

Ok, I have my setup completed now.

Thank you for all your help today! I'd like to pay for your next cup of coffee! Is there some way I can donate to you?

Glad it worked out, I'll create a separate issue to track the multiple OR thing, which is definitely a bug.

Is there some way I can donate to you?

No, I don't plan on ever accepting donations. If you're really feeling generous, archive.org is a worthy cause.

Glad it worked out, I'll create a separate issue to track the multiple OR thing, which is definitely a bug.

Is there some way I can donate to you?

No, I don't plan on ever accepting donations. If you're really feeling generous, archive.org is a worthy cause.

That is very nice of you. I've made a donation to archive.org as thanks to you :)