Gnutella Forums  

Go Back   Gnutella Forums > Current Gnutella Client Forums > LimeWire+WireShare (Cross-platform) > Technical Support > Download/Upload Problems
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Search Today's Posts Mark Forums Read

Download/Upload Problems Problems with downloading or uploading files through the Gnutella network.
* Please specify whether the file problem is a Gnutella network shared file OR a Torrent file. *


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old July 29th, 2002
Unregistered
Guest
 
Posts: n/a
Default Somewhat of a solution for resuming downloads

Well, I got sick and tired of watching a nearly finished download stall, then restart under a slightly different name, even when the file sizes were exactly the same. Jeez, this should just work.

So here's a bit of a hack solution: this is a simple shell script that will create symbolic links of all files that share the same prefix with the target file that you specify. In other words, you type:

combine.sh "T-98721-Some Thing.file"

and every file that has the same "T-XXXXX" will be deleted (or moved, if you want to play it safe) and a symbolic link will be created in its stead. All you need to do is supply the filename of your target.

I haven't fully tested this out to see if it works without introducing artifacts, so be forewarned. Oh, and this is for Linux, sorry to Windows users, but it should also work under OSX if you have bash. I'd appreciate comments and improvements to **EDIT EMAIL ADDRESS**
Good luck.

-----BEGIN SCRIPT-----
#!/bin/bash
# This file is used to link similar files to a target file. It is
# intended to be used with Limewire to facilitate downloads.

function print_usage {
echo "Usage: $( basename $0 ) [-s] filename"
echo -e "\t-s\tbackup files"
echo "Remember to surround files that include whitespace with quotes"
exit $E_WRONGARGS
}

TARGET=temp # Target file to link to
PREFIX=temp # Prefix of target file used for search
SAFEMODE=false # Indicate whether to backup files
E_WRONGARGS=65 # Improper arguments
E_NOTARGET=66 # Target file does not exist
E_NODELETE=67 # Cannot delete file
E_NOMOVE=68 # Cannot move file
E_NOLINK=69 # Cannot link files

# Save stdin
exec 6<&0

# Test for appropriate arguments
if [ -z "$1" ]; then
print_usage
elif [ "$1" = "-s" ]; then
if [ -z "$2" ]; then
print_usage
else
SAFEMODE=true
TARGET="$2"
fi
else
TARGET="$1"
fi

# Test for existence of target file
if [ ! -f "$TARGET" ]; then
echo "Target file does not exist"
exit $E_NOTARGET
fi

# Create backup directory if applicable
if [ "$SAFEMODE" = "true" -a ! -d "backup" ]; then
mkdir backup
if [ ! "$?" ]; then
echo "Cannot create backup directory"
echo "Check directory permissions"
exit $E_FAILBACKUP
fi
fi

# Strip prefix from target file
PREFIX=$( echo $TARGET | cut -d- -f1,2 - )

# Perform search for prefix and store in a temp file
ls | grep $PREFIX > files.temp

# Change stdin to files.temp and begin processing
exec < files.temp
read FILE
while [ ! -z "$FILE" ]; do
if [ "$FILE" != "$TARGET" ]; then
if [ "$SAFEMODE" = "false" ]; then
rm -f "$FILE"
if [ ! "$?" = "0" ]; then
echo "Unable to delete $FILE"
echo "Check permissions"
echo "Exiting"
exit E_NODELETE
fi
else
mv "$FILE" ./backup/
if [ ! "$?" = "0" ]; then
echo "Unable to move $FILE"
echo "Check permissions"
echo "Exiting"
exit E_NOMOVE
fi
fi
ln -s "$TARGET" "$FILE"
if [ ! "$?" = "0" ]; then
echo "Unable to link files"
echo "Check permissions"
echo "Exiting"
exit E_NOLINK
fi
fi
read FILE
done

# Restore stdin
exec 0<&6 6<&-

rm -f files.temp

echo "Done"

exit 0
-----END SCRIPT-----
Just copy and paste it into a file like:
combine.sh, make it executable with
chmod 777 combine.sh, and place it
in /usr/local/bin or whatever.

Last edited by Remoc; March 8th, 2009 at 08:35 AM.
Reply With Quote
  #2 (permalink)  
Old July 31st, 2002
Unregistered
Guest
 
Posts: n/a
Default

Hmmm, after trying this out for a few more days, it seems like it doesn't work after all. In most cases, from what I can tell, downloads will most often start over rather than continuing from a linked position. I believe the problem lies instead with the downloads.dat file, which must be editable in some fashion.
Anyway, sorry for any false hopes, and if anyone has a recommendation for a better linux gnutella client, I'd like to hear it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resuming downloads ...kleim Download/Upload Problems 13 August 19th, 2005 01:31 PM
Resuming Downloads dimagor Download/Upload Problems 1 January 21st, 2002 05:43 PM
Resuming Downloads Paul Gnotella (Windows) 2 June 1st, 2001 07:38 PM
Resuming downloads jacmac Gnotella (Windows) 6 May 28th, 2001 08:19 AM


All times are GMT -7. The time now is 10:09 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.