Author Topic: to limit the speed  (Read 4870 times)

0 Members and 1 Guest are viewing this topic.

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« on: February 01, 2009, 08:18:31 PM »
i want to have an event but can't understand how to imlement it, if someone of you can make it for you

if the download is from Drive D E & F then speed is 500KB/s and if any file download by 3 ppls at the time speed limit to 500KB/s

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #1 on: February 02, 2009, 02:06:45 PM »
for the first part, put in event scripts
Code: [Select]
[download]
{.switch| {.cut||2|%item-resource%.} |,|D:,E:,F:| {:{.set speed limit for connection|500.}:} /switch.}

but for this to make sense, you should have "prevent leeching" enabled, because it sets the limit on the single connection.

the second is not possible (or very hard) because at the moment there's no macro to count the number of people downloading a file.

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #2 on: February 02, 2009, 08:29:18 PM »
thanks Rejetto

my settings are Max 10 downloads from 10 seperate addresses, each user can create 3 connections at a time , on of them is for download

if user downloading a file he cant download other file and he left with 2 connections for browsing site

it will pervent my system to be overload .. i have 10 downloads 24*7 :/ and almost 600 connections every seconds from users browsing the site

every new addition will be downloaded usually 10 ppl at a time

thats why i wanna implement all thise restrictions and pervent leechaing is TICKED

MORAL : code isnt working :( for Drive D E F one

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #3 on: February 03, 2009, 01:33:44 AM »
not working because it is not what you need, or because it doesn't set a limit to downloads from drives D/E/F ?

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #4 on: March 10, 2009, 05:01:46 PM »
it dosent set limit for drive D E F

and also is it possible i can set limit of speed for a folder name, infact subfolder name


i Have folder on root named "Music Masti" and under it a folder named "MovieZ"

i wanna set speed limit to 100 for this MovieZ folder

possible?

BTW, i tried ur example for a word in filename with speed limit and it dosent work for me

[download]
{.if|{.is substring|%item-name%|Xvid.}| {:{.set speed limit for connection|100.}:}

and tried this to with word MovieZ in it but i realize that moviez should be in url not in word .. anyways

[download]
{.if|{.is substring|%item-name%|MovieZ| {:{.set speed limit for connection|100.}:}

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #5 on: March 11, 2009, 12:18:39 PM »
it dosent set limit for drive D E F

strange.
i just tested the script, and it worked here.  :-\
see the screenshot.
music2 is on E:
music is on C:
first mp3 is downloaded at 5KB/s (the limit i set on the script) and the other at 100KB/s (global limit i set).
are you sure your test was correct?
where did you put the script? you should do ALT+F6

Quote
and also is it possible i can set limit of speed for a folder name, infact subfolder name
i wanna set speed limit to 100 for this MovieZ folder
possible?

yes it is

Quote
BTW, i tried ur example for a word in filename with speed limit and it dosent work for me

[download]
{.if|{.is substring|%item-name%|Xvid.}| {:{.set speed limit for connection|100.}:}

and tried this to with word MovieZ in it but i realize that moviez should be in url not in word .. anyways

[download]
{.if|{.is substring|%item-name%|MovieZ| {:{.set speed limit for connection|100.}:}

again: are you putting this stuff in the right place?
not the template, but the event scripts file.
ALT+F6, it's a file named "hfs.events"

MovieZ is a folder, so you won't find it in %item-name% but in %folder%

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #6 on: March 11, 2009, 08:44:24 PM »
i set the %item-name% to %folder%  now lets see if it works


and yes i am placing it in right file

ALT+F6  and thers a notepad open with hfs.events file, pls check if all codes are fine

Code: [Select]
[download]
{.switch| {.cut||2|%item-resource%.} |,|D:,E:,F:| {:{.set speed limit for connection|500.}:} /switch.}

[download]
{.switch| {.cut||2|%item-resource%.} |,|G:,H:,I:,P:,L:| {:{.set speed limit for connection|1030.}:} /switch.}

[download]
{.if|{.is substring|%folder%|MovieZ| {:{.set speed limit for connection|100.}:}

[download]
{.if|{.is substring|%item-name%|Xvid.}| {:{.set speed limit for connection|100.}:}

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #7 on: March 11, 2009, 09:30:37 PM »
it say's template error for speed limit event

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #8 on: March 11, 2009, 09:34:44 PM »
the same template error in previous post "umatched marker"

and speed is 1MB/s  coz i set it in limits that a single user can download at 1030KB/s  the event isnt working but the limit

i tried turning off the limit too but no luck

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #9 on: March 12, 2009, 11:14:47 AM »
ok, we found your problem.
when you re-declare [download], the previous one is overwritten.

you should do it only once, or if you truly need to have it more than once and don't want to lose the previous one, you must do [+download]

Code: [Select]
[download]
{.if|{.is substring|%folder%|MovieZ.} {.is substring|%item-name%|Xvid.}
| {:{.set speed limit for connection|100.}:}
|
{.switch| {.cut||2|%item-resource%.} |,|
D:,E:,F:| {:{.set speed limit for connection|500.}:}
|
G:,H:,I:,P:,L:| {:{.set speed limit for connection|1030.}:}
/switch.}

 /if.}

(untested)

you previously reported that my script was not working,
but you didn't say you made changes to the script.
next time you report a problem you should specify, or you'll drive me crazy.
« Last Edit: March 12, 2009, 11:20:04 AM by rejetto »

Offline AYEHAN

  • Occasional poster
  • *
  • Posts: 92
    • View Profile
to limit the speed
« Reply #10 on: March 12, 2009, 08:03:14 PM »
thanks and sorry for not telling that i made some changes

1 more thing  ... we have set speed 1030KB/s for some drives and MovieZ is in the same partions .. will they clash again?

MovieZ  path is L:\MovieZ   and we are setting speed 100KB for it and  we also set speed for drive G:\ as 1030KB/s

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1877
    • View Profile
to limit the speed
« Reply #11 on: March 12, 2009, 08:56:02 PM »
one diff tpl (since build 224)
Quote
<html>
<body>

{.section|section.}
</body>
<html>

[section]
texte1

[+section]
texte2

[+section]
texte3

asking to rejetto:
 Are there  other small craftiness of this kind? ???
« Last Edit: March 12, 2009, 09:27:14 PM by mars »

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #12 on: March 13, 2009, 11:11:47 AM »
1 more thing  ... we have set speed 1030KB/s for some drives and MovieZ is in the same partions .. will they clash again?

no.
anyway, the script is made so that "switch" is done only if not "movieZ".

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12948
    • View Profile
to limit the speed
« Reply #13 on: March 13, 2009, 11:14:31 AM »
Are there  other small craftiness of this kind? ???

you mean the "+" function for section name?
there is [section|no log] not documented yet (i put it now in my to-do) and aliasing

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1877
    • View Profile
to limit the speed
« Reply #14 on: March 13, 2009, 02:58:31 PM »
You could verify in which conditions, what follows can work.

change the name of [item start] to the full example as follow,

Quote
[file=folder=link]
<a href=%item-url>%item-name%

[+file]
<td align='right'>%item-size%<td align='right'>%item-modified%<td align='right'>%item-dl-count%

[+folder]
<td align='center'><i>folder</i><td align='right'>%item-modified%<td align='right'>%item-dl-count%

[+link]
<td colspan='3' align='center'><i>link</i>

[+file=+folder|nolog]
I am a file or a folder, be happy

[+link|nolog]
I am only a link SNIF!

If you are right, this template shall have to work correctly with some small modifications in delphi. ;)