Page 1 of 1

[plugin] Traffic Limits

Posted: Fri Nov 12, 2010 8:24 pm
by mavit
TrafficLimits is a Deluge plugin to pause all torrents if more than a set amount of data is uploaded or downloaded.

Downloads
Source code, bug reports, etc.

From the README:
Configuration:


As well as setting the limits through the preferences (GTK UI only, for now), you can also create a file called `~/.config/deluge/trafficlimits` containing a label, the upload limit, and the download limit (in bytes), each on a line by themselves. For example:

Code: Select all

January
-1
21474836480

This is intended to be used by a cron job for automatic scheduling, e.g.,

Code: Select all

* 00-15,21-23 * * * /bin/echo -e "Unlimited\n-1\n-1"             > ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits.tmp && mv ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits.tmp ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits
* 16-20       * * * /bin/echo -e "Evening\n400000000\n750000000" > ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits.tmp && mv ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits.tmp ${XDG_CONFIG_HOME:-~/.config}/deluge/trafficlimits

See also:

Please see also the Toggle plugin. You will need this to resume transfers once they have been paused, unless you use the automatic scheduling.

Re: [plugin] Traffic Limits

Posted: Sat Nov 13, 2010 4:41 am
by loki
Could be very useful, for instance, people that have a monthly limit or pay by the byte...

Re: [plugin] Traffic Limits

Posted: Sun Dec 19, 2010 2:33 am
by SpmP
I need some help on how to use this plugin.
My situation is this:
During the day its par per gig,
Then at night I get some free bandwidth which is up and down combined.

I use the schedulere plugin to run deluge at night, but sometimes I dl stuff during the day using the toggle plugin.

What I want is that traffic is monitored and limited during the nightime part only. Cron is great, no probs there, I just dont understand the sample provided, sorry.

deluged is on the house server, accessed via deluge-gtk on local network.

TIA

Re: [plugin] Traffic Limits

Posted: Sun Dec 19, 2010 12:09 pm
by mavit
SpmP wrote:What I want is that traffic is monitored and limited during the nightime part only. Cron is great, no probs there, I just dont understand the sample provided, sorry.


Add a cronjob that runs at the start of the evening. Have it create a file called ~/.config/deluge/trafficlimits with the following contents:

Code: Select all

Nighttime
<upload limit in bytes>
<download limit in bytes>

Then add a second cronjob that runs at the start of the day, overwriting the file with the following. This will reset the counters and make both upload and download unlimited.

Code: Select all

Daytime
-1
-1

Make sure the cronjobs run on the server box, not one of your clients.

Hope this makes more sense.

Re: [plugin] Traffic Limits

Posted: Sun Dec 19, 2010 9:07 pm
by SpmP
mavit wrote:Add a cronjob that runs at the start of the evening. Have it create a file called ~/.config/deluge/trafficlimits with the following contents:

Code: Select all

Nighttime
<upload limit in bytes>
<download limit in bytes>

Then add a second cronjob that runs at the start of the day, overwriting the file with the following. This will reset the counters and make both upload and download unlimited.

Code: Select all

Daytime
-1
-1

Thanks Mavit,

I need monthly accounting, how can I avoid resetting the counter, or save the counter to a file (then reload).

My ISP counts traffic, up and down summed together... total traffic (ie up+down) be used , or a provision made for it in your code?
ie:
label
up limit
down limit
total limit

or implied total limit if
label
total limit (i.e only 1 line)

is given.

cheers

Re: [plugin] Traffic Limits

Posted: Sun Dec 19, 2010 9:32 pm
by mavit
SpmP wrote:I need monthly accounting, how can I avoid resetting the counter, or save the counter to a file (then reload).

If you don't change the label then the counter doesn't get reset, so try something like:

Night:

Code: Select all

December
<upload limit in bytes>
<download limit in bytes>

Day:

Code: Select all

December
-1
-1


SpmP wrote:My ISP counts traffic, up and down summed together... total traffic (ie up+down)

Ah, okay. That's a situation I hadn't considered. I'll need to modify the plugin to make that possible.

Re: [plugin] Traffic Limits

Posted: Sun May 19, 2013 2:00 pm
by mavit
SpmP wrote:My ISP counts traffic, up and down summed together... total traffic (ie up+down)


The latest version of the plugin should handle this. Please give it a try and let me know how you get on!