Page 1 of 2
Copy Completed Torrents
Posted: Sun Oct 26, 2008 10:46 pm
by Sentinel
Hey I'm not sure if this falls under the pluggin or feature space, but I see there is a handy feature to move completed torrents.
I would REALLY like it if there was a way to copy completed torrents to a folder of my choosing but leave the original torrents in place to facilitate seeding. I want this because I often change the tags on files (.mp3, for example) but then I can't seed those files because they have been altered.
Sure, it's inefficient to keep two copies of everything, but it really makes for better organization, and hard drives are cheap compared to my time and effort.
In summary, I want to be able to copy completed torrents (maybe the .torrent file too) in addition to move them, if I choose.
~ Sentinel
Re: Copy Completed Torrents
Posted: Wed Oct 29, 2008 3:45 pm
by Mindzai
Well, until this is implemented (if it ever is), the same thing could be achieved using the move torrent functionality, a small shell script and cron. If you have 2 folders, one for unfinished dls and another for finished dls, then move completed downloads to the finished folder, you could then set up a cron job to run every 30 mins (for example) that calls a script which copies the contents of this finished folder to another folder of your choosing. I use something similar currently, except I use this system to automatically unrar downloads rather than copy them. Let me know if my script will be of any help.
Re: Copy Completed Torrents
Posted: Wed Oct 29, 2008 3:58 pm
by tyskis
Mindzai wrote:Well, until this is implemented (if it ever is), the same thing could be achieved using the move torrent functionality, a small shell script and cron. If you have 2 folders, one for unfinished dls and another for finished dls, then move completed downloads to the finished folder, you could then set up a cron job to run every 30 mins (for example) that calls a script which copies the contents of this finished folder to another folder of your choosing. I use something similar currently, except I use this system to automatically unrar downloads rather than copy them. Let me know if my script will be of any help.
Hi, I would love to have your script for automatic unrar, I've been thinking about writing a similar script, but haven't gotten around to it yet.
Re: Copy Completed Torrents
Posted: Sun Nov 02, 2008 11:20 pm
by Sentinel
Mindzai wrote:Well, until this is implemented (if it ever is), the same thing could be achieved using the move torrent functionality, a small shell script and cron. If you have 2 folders, one for unfinished dls and another for finished dls, then move completed downloads to the finished folder, you could then set up a cron job to run every 30 mins (for example) that calls a script which copies the contents of this finished folder to another folder of your choosing. I use something similar currently, except I use this system to automatically unrar downloads rather than copy them. Let me know if my script will be of any help.
So this actually wouldn't work because I will move things out of my completed folder to archive them, but I still want the originals in place to seed. So the cron job would copy stuff that I already moved out of the "to sort" folder. I'm really trying to make a "to sort" folder that will only contain files that I haven't sorted yet after I download them. But I also want to keep a copy unaltered for seeding in the "completed" folder.
Do you see what I mean?
Re: Copy Completed Torrents
Posted: Mon Nov 03, 2008 5:48 pm
by Mindzai
tyskis wrote:Hi, I would love to have your script for automatic unrar, I've been thinking about writing a similar script, but haven't gotten around to it yet.
Hi - here is the script I use:
Code: Select all
#!/bin/sh
cd /media/disk/incoming/unpacking/
for file in $(find /media/disk/incoming/finished/ -iregex '.*\.\(rar\|001\)')
do
echo -n "checking file ${file##*/}..."
onblacklist=`grep -c $file /media/disk/incoming/unpacking/blacklist`
if [ $onblacklist -ne 0 ]; then
echo "already unpacked"
else
echo "not unpacked yet"
echo -n "unpacking..."
unrar e -inul -o- $file
echo "done!"
echo -n "adding to blacklist..."
echo $file >> /media/disk/incoming/unpacking/blacklist
echo "done!"
fi
done
ls -rt /media/disk/incoming/unpacking/ | grep -v '\(^unpack_torrents.sh$\|^blacklist$\|^cron.log$\)' | xargs -I{} mv {} /media/disk/incoming/unpacked/
I have 2 directories, unpacking and unpacked, and this script along with the blacklist file and the cron.log file sit in the unpacking folder. Should be pretty easy to adjust to your needs. The script will write the filename of each file it unpacks to a blacklist so that it will not unpack it again next time the script is run. You can obviously remove all of the echo stuff if you have no interest in logging, I just stuck it in there while I was testing and havent got round to removing it. I'm not exactly an expert shell scripter so there may be a more elegant solution, however this does work well for me.
Sentinel wrote:
So this actually wouldn't work because I will move things out of my completed folder to archive them, but I still want the originals in place to seed. So the cron job would copy stuff that I already moved out of the "to sort" folder. I'm really trying to make a "to sort" folder that will only contain files that I haven't sorted yet after I download them. But I also want to keep a copy unaltered for seeding in the "completed" folder.
Do you see what I mean?
Hmm maybe I'm not understanding what you are trying to do. My suggestion would automatically make a copy of any finished download and move it to a directory of your choice for sorting/deleting/whatever whilst leaving the finished file in place for seeding - is this not what you want to do? Just to clarify what I mean, deluge can automatically move all completed downloads to a certain directory where it will continue seeding them. The only reason for doing this is that you want only finished files to be copied by the script and moving finished files to a different location is the only way (that I know of) to accurately tell they they are finished. The script would then monitor this folder for any new files (referring to a blacklist as in the above script to avoid duplicate copies) and copy them to a 'to sort' location. So you end up with the original still seeding and a copy which you can do whatever you need to with.
Re: Copy Completed Torrents
Posted: Fri Nov 07, 2008 5:56 am
by Sentinel
Hmm, a blacklist might be the answer. But I think you can see how it would be a nice feature to implement and would take all of 20 lines of code from the Deluge team?
Re: Copy Completed Torrents
Posted: Fri Nov 07, 2008 6:35 am
by johnnyg
You could just as easily write a
ui client script to do the same thing.
It wouldn't require that move torrent be enabled.
If you want it to be implemented in deluge, you could either write it as a patch and submit it as feature request (this doesn't necessarily mean it will be accepted though) or you could write it as a plugin (which is a step up from the ui client script).
Re: Copy Completed Torrents
Posted: Tue Nov 18, 2008 1:59 am
by Sentinel
I looked at the source code and it was complicated, so I went with Mindzai's idea made it a cron script. I am using a 3-tier download system where files progress like so:
Downloading Folder ->[move]-> Seeding Folder ->[copy]-> Finished Folder
The blacklist makes it so I can freely modify the files in the finished folder and still have an untouched copy in the seeding folder. This is good for tag-editing or renaming files. Then, I take files out of the Finished Folder and put them in permanent archive.
Here's the code for my script, if anyone else would find this useful. It is designed to be used in conjunction with "Move on Complete" in order to get from the Downloading Folder to the Seeding Folder. Make sure you change the directories accordingly and "touch" the blacklist.txt file before your first run.
Code: Select all
#!/bin/bash
# Assumes that newly-finished torrent files are automatically
# moved to the SEEDING directory
# directory of finished torrents that are seeding
SEEDING=/mnt/Vault/Seeding/
# blacklist
BLACKLIST=/mnt/Vault/Finished/blacklist.txt
# where to move files for archival staging
# files can be edited and removed from this folder
# whithout affecting seeding copy
FINISHED=/mnt/Vault/Finished/
# for each file or folder in the SEEDING directory,
# check if it's on the blacklist
# if it is not, then recursively copy it to FINSIHED
# and add it to the blacklist
cd $SEEDING
echo Copying files from Seeding directory to Finished Directory...
for file in *
do
COUNT=`grep -cF "$file" $BLACKLIST`
if [ $COUNT == 0 ]; then
echo $file
cp -r "$file" $FINISHED
echo $file >> $BLACKLIST
fi
done
NOTE: For some reason grep fails on filenames that have more than one space in a row. If anyone knows a solution, please let me know. Otherwise, I think the script works well. Enjoy!
Re: Copy Completed Torrents
Posted: Wed Nov 19, 2008 10:41 am
by johnnyg
If you're mainly copying torrents so that you can rename them I should mention that from 1.1.0 you will be able to rename files within a torrent.
Re: Copy Completed Torrents
Posted: Thu Nov 20, 2008 4:30 am
by Sentinel
johnnyg wrote:If you're mainly copying torrents so that you can rename them I should mention that from 1.1.0 you will be able to rename files within a torrent.
No, it's mainly so I can fix files with bad meta data and tags and still seed them.