Copy Script (need help)

Suggest, post, or discuss plugins for Deluge
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Copy Script (need help)

Post by vodkaholic27 »

Hey, Am trying to copy all "downloaded" torrents to a new folder where they can be used by the main people in are home

You see I have it set up like this (so far)
Downloading to E:/Leeching
Moved when downloaded to E:/Seeding

And I want to move them to E:/Leeching Done
(and if posable deleted and remove all data after seeding ratio has been hit (from seeding that is))

Tho here are the problems am on windows 7 and know nothing about scripting, Can this be even done?
Thanks alot and hope someone can help me :) I like Deluge alot (moved from utorrent)

Cheers
crazycaveman
Member
Member
Posts: 28
Joined: Mon Apr 30, 2012 3:08 am

Re: Copy Script (need help)

Post by crazycaveman »

That should be simple enough. Just to make sure I understand:
You download to E:\Leeching and move completed to E:\Seeding. You would also like a copy placed in E:\Leeching\Done for people to access while still seeding the files from E:\Seeding but would like these files to be deleted after reaching a certain ratio.

The remove at a certain ratio feature is built into Deluge (at least on 1.3.5, although I think it's in any 1.3 build); in Preferences, under Queue, check 'Stop seeding when share ratio reaches' and put in your ratio and also check the box below it, 'Remove torrent when share ratio reached.' To place a copy in E:\Leeching\Done, copy and paste the following commands into a file named .bat (i.e. copy_completed.bat).

Code: Select all

@echo off
set dest_dir=E:\Leeching\Done\%~2
set srce_dir=%~3\%~2
if not exist "%dest_dir%" mkdir "%dest_dir%"
xcopy /Y /S "%srce_dir%" "%dest_dir%"
Unfortunately, due to the way the Windows copy commands work, this script will place every torrent in its own subdirectory, even if it's only one file. If you wish to change where the files are copied to, change the second line to the directory you want (set dest_dir=<directory>\%~2 [that last part is needed]). Then, just put the path and filename of this script in the execute plugin and you should be good to go!
Last edited by crazycaveman on Thu May 10, 2012 5:18 pm, edited 1 time in total.
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Re: Copy Script (need help)

Post by vodkaholic27 »

crazycaveman wrote:That should be simple enough. Just to make sure I understand:
You download to E:\Leeching and move completed to E:\Seeding. You would also like a copy placed in E:\Leeching\Done for people to access while still seeding the files from E:\Seeding but would like these files to be deleted after reaching a certain ratio.

The remove at a certain ratio feature is built into Deluge (at least on 1.3.5, although I think it's in any 1.3 build); in Preferences, under Queue, check 'Stop seeding when share ratio reaches' and put in your ratio and also check the box below it, 'Remove torrent when share ratio reached.' To place a copy in E:\Leeching\Done, copy and paste the following commands into a file named .bat (i.e. copy_completed.bat).

Code: Select all

@echo off
set dest_dir=E:\Leeching\Done\%~2
set srce_dir=%~3\%~2
if not exist "%dest_dir%" mkdir "%dest_dir%"
xcopy /S "%srce_dir%" "%dest_dir%"
Unfortunately, due to the way the Windows copy commands work, this script will place every torrent in its own subdirectory, even if it's only one file. If you wish to change where the files are copied to, change the second line to the directory you want (set dest_dir=<directory>\%~2 [that last part is needed]). Then, just put the path and filename of this script in the execute plugin and you should be good to go!
Thanks Crazycavenan I'll give this a go later on :)

The delete torret in the remove feature removed just the torrent from the list no? not all the files and torrent etc..? (well that's what I thought it did)

Thanks again.
crazycaveman
Member
Member
Posts: 28
Joined: Mon Apr 30, 2012 3:08 am

Re: Copy Script (need help)

Post by crazycaveman »

I haven't used it, so I don't know, but that would make sense. Unfortunately, with the tools available at the moment, it's not possible to delete the torrent files when the ratio is reached, as far as I am aware.
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Re: Copy Script (need help)

Post by vodkaholic27 »

crazycaveman wrote:I haven't used it, so I don't know, but that would make sense. Unfortunately, with the tools available at the moment, it's not possible to delete the torrent files when the ratio is reached, as far as I am aware.
Ive tryed this on utorrent (which is the only one on the PC atm) and it copys all the user files everything :P now that could just be because its utorrrent when I get my other comp back tomorrow I'll try it with Deluge
crazycaveman
Member
Member
Posts: 28
Joined: Mon Apr 30, 2012 3:08 am

Re: Copy Script (need help)

Post by crazycaveman »

How are you calling the script from uTorrent? The Deluge execute plugin passes the torrent hash, torrent name, and torrent path to the script in that order, and that is what the script expects. So a similar call from uTorrent would be

Code: Select all

C:\bin\copy_completed.bin "%I" "%N" "%D"
However, you'll also need to make a small change to the script for uTorrent. In the line set srce_dir=%~3\%~2, remove the '\%~2' to make it work correctly. However, you'll have to add it back in (or have a separate script) for Deluge...
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Re: Copy Script (need help)

Post by vodkaholic27 »

crazycaveman wrote:How are you calling the script from uTorrent? The Deluge execute plugin passes the torrent hash, torrent name, and torrent path to the script in that order, and that is what the script expects. So a similar call from uTorrent would be

Code: Select all

C:\bin\copy_completed.bin "%I" "%N" "%D"
However, you'll also need to make a small change to the script for uTorrent. In the line set srce_dir=%~3\%~2, remove the '\%~2' to make it work correctly. However, you'll have to add it back in (or have a separate script) for Deluge...
Hey am back on my own pc now so utorrent is gone :P

So on Deluge I call it like this

Code: Select all

Q:\Vodkaholic\Software\copy_completed.bat
?
Or do I need stuff after it like you just posted?

Thanks for the help btw
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Re: Copy Script (need help)

Post by vodkaholic27 »

Ok I tested it just as I posted above and it copyed the torrents folder only (ie nothing was in it)

Also it pops up a black command box when it runs is that normal?

Cheers
crazycaveman
Member
Member
Posts: 28
Joined: Mon Apr 30, 2012 3:08 am

Re: Copy Script (need help)

Post by crazycaveman »

With uTorrent, it does happen, but I haven't experienced that with Deluge. Let me play around with it at home and see what I can find. Also, with Deluge, you call it exactly as you have it in that previous post. What version of Deluge are you running?
User avatar
vodkaholic27
Member
Member
Posts: 25
Joined: Thu Apr 12, 2012 1:48 pm
Contact:

Re: Copy Script (need help)

Post by vodkaholic27 »

crazycaveman wrote:With uTorrent, it does happen, but I haven't experienced that with Deluge. Let me play around with it at home and see what I can find. Also, with Deluge, you call it exactly as you have it in that previous post. What version of Deluge are you running?
1.3.5 I think the (lastest) and thanks
Post Reply