What Is 20 Minutes?

Suggest, post, or discuss plugins for Deluge
chnaski
Member
Member
Posts: 16
Joined: Sun Feb 26, 2023 1:39 pm

Re: What Is 20 Minutes?

Post by chnaski »

basher wrote: Tue Feb 28, 2023 11:37 am Ye, just grab the latest .egg and replace it with your current ARP egg. As long as you're using deluge 2 and py 3.7+ it's going to be fine.
This would be an example of config that runs every 19 minutes and removes autodl labeled torrents that have seeded for at least 20 minutes.
Note if you want it to use labels set by labelplus plugin, then flip the labelplus value to true.
autoremoveplus.conf:

Code: Select all

{
  "file": 1, 
  "format": 1
}{
  "labels": [], 
  "hdd_space": -1, 
  "use_quota_for_free_space": false,
  "label_rules": {
    "autodl": [
      [
        "or", 
        "func_seed_time", 
        0.333333
      ]
    ]
  }, 
  "tracker_rules": {}, 
  "enabled": true, 
  "force_reannounce_before_remove": true, 
  "skip_removal_on_reannounce_failure": true, 
  "reannounce_max_wait_sec": 30, 
  "remove": true, 
  "remove_data": true, 
  "labelplus": false, 
  "rule_1_enabled": false, 
  "rule_2_enabled": false, 
  "min": 2.0, 
  "min2": 0.0, 
  "sel_func": "or", 
  "count_exempt": false, 
  "filter": "func_seed_time",
  "filter2": "func_seed_time", 
  "max_seeds": 0, 
  "trackers": [], 
  "interval": 0.316667
}
Thanks
chnaski
Member
Member
Posts: 16
Joined: Sun Feb 26, 2023 1:39 pm

Re: What Is 20 Minutes?

Post by chnaski »

Alternatively, what if I wanted to delete any torrent labeled autodl after 20 minutes whether it’s been seeding for twenty minutes or not?
Just like remove any torrent from the time it was added to twenty minutes later
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: What Is 20 Minutes?

Post by basher »

chnaski wrote: Tue Feb 28, 2023 12:35 pm Alternatively, what if I wanted to delete any torrent labeled autodl after 20 minutes whether it’s been seeding for twenty minutes or not?
Just like remove any torrent from the time it was added to twenty minutes later
Assuming you still want the download to finish, then you could still use seed-time rule with value of 0. If you want to remove torrent regardless of its status after 20 minutes it's been added to your client, you'd need to use func_added rule, but note that is configured in days not hours.
chnaski
Member
Member
Posts: 16
Joined: Sun Feb 26, 2023 1:39 pm

Re: What Is 20 Minutes?

Post by chnaski »

basher wrote: Tue Feb 28, 2023 12:44 pm
chnaski wrote: Tue Feb 28, 2023 12:35 pm Alternatively, what if I wanted to delete any torrent labeled autodl after 20 minutes whether it’s been seeding for twenty minutes or not?
Just like remove any torrent from the time it was added to twenty minutes later
Assuming you still want the download to finish, then you could still use seed-time rule with value of 0. If you want to remove torrent regardless of its status after 20 minutes it's been added to your client, you'd need to use func_added rule, but note that is configured in days not hours.
My issue is that some torrents just never start downloading due to the unregistered torrent bug and i can't get it to work even with the scripts provided to fix it.

Code: Select all

#!/bin/bash

torrentid=$1
torrentname=$2
torrentpath=$3
x=1
ddport=$(grep '"daemon_port": [0-9]*' /config/core.conf | awk -F ': ' '{print $2}' | awk -F ',' '{print $1}')

while [ $x -le 100 ]
do
sleep 2

echo "Running $x times" >> /config/script.log
echo "TorrentID: $torrentid" >> /config/script.log
line=$(deluge-console "connect 127.0.0.1:$ddport; info" $1 | grep "Tracker status")
echo $line >> /config/script.log
case "$line" in
*Unregistered*|*unregistered*|*Sent*|*End*of*file*|*Bad*Gateway*|*Error*)
deluge-console "connect 127.0.0.1:$ddport; pause '$torrentid'"
sleep 2
deluge-console "connect 127.0.0.1:$ddport; resume '$torrentid'"
;;
*)
echo "Found working torrent: $torrentname $torrentpath $torrentid" >> /config/script.log
exit 1;;
esac
x=$(( $x + 1 ))
done

Code: Select all

version: '3.7'
services:
  deluge:
    image: lscr.io/linuxserver/deluge:latest
    container_name: deluge
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DELUGE_LOGLEVEL=error #optional
    volumes:
      - /data/deluge:/config
      - /media:/media
    ports:
      - 8112:8112
      - 6882:6881
      - 6882:6881/udp
    restart: unless-stopped
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: What Is 20 Minutes?

Post by mhertz »

There's also a plugin for this btw(so using deluge api instead of external calls to deluge-console), curtesey idiocracy: viewtopic.php?f=9&t=54638
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: What Is 20 Minutes?

Post by basher »

chnaski wrote: Tue Feb 28, 2023 2:21 pm My issue is that some torrents just never start downloading due to the unregistered torrent bug and i can't get it to work even with the scripts provided to fix it.
Did you check your log file (/config/script.log) and verify the script is actually started and doing what it's supposed to?
Nonetheless, if there really is a legitimate case of constant 'unregistered torrent' (eg a broken torrent), then ARP surely isn't the right tool for this. I do plan to add another rule for torrent status, which could be used together with func_added rule to accomplish this. Something like "if status = 'unregistered torrent' and torrent_age > 3 hours".

PRs welcome :)
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: What Is 20 Minutes?

Post by basher »

mhertz wrote: Tue Feb 28, 2023 3:00 pm There's also a plugin for this btw(so using deluge api instead of external calls to deluge-console), curtesey idiocracy: viewtopic.php?f=9&t=54638
Been using a bash script myself for this purpose, but this is considerably better way of doing this. Especially considering the deluge-console output isn't that good for parsing and changes quite a bit between versions.
I'll steal the code and move to github.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: What Is 20 Minutes?

Post by mhertz »

Please do bro, good to have some talented eyes on it :) If I remember right then I fixed it to work for idiocracy in the first unofficial windows installer thread, and I can't remember but saw a snippet posted using time.sleep(), which stalls whole deluge main UI thread if not remember wrong, so twisted reactor.callLater() or alike preferred I'd guess, but nonetheless, thanks :)
basher
Leecher
Leecher
Posts: 91
Joined: Wed Sep 29, 2021 8:42 am
Location: Estonia/Spain

Re: What Is 20 Minutes?

Post by basher »

mhertz wrote: Tue Feb 28, 2023 3:52 pm If I remember right then I fixed it to work for idiocracy in the first unofficial windows installer thread, and I can't remember but saw a snippet posted using time.sleep(), which stalls whole deluge main UI thread if not remember wrong, so twisted reactor.callLater() or alike preferred I'd guess, but nonetheless, thanks :)
The very last egg in the thread you posted already uses LoopingCall from twisted.internet.task, so looks like it's there.
Last edited by basher on Tue Feb 28, 2023 4:06 pm, edited 1 time in total.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: What Is 20 Minutes?

Post by mhertz »

Ahh, I'm an idiot, then fine and never mind the noise. Thanks bro :)
Post Reply