Revision: 65167
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 3, 2013 15:04 by ktrout
Initial Code
rm -f $tname
tname=`ls | grep torrent$ | head --lines=1`
namehead=`grep -oa name[0-9]*: $tname`
namesize=${namehead:4}
namesize=${namesize%?}
offset=`grep --byte-offset --only-matching --text name[0-9]*: $tname`
cutsize=${#namehead}
cutsize=`expr $cutsize + 1`
cutsize=`expr -$cutsize`
expression="\${offset:0:$cutsize}"
eval "offset=$expression"
offset=`expr $offset + ${#namehead}`
limit=`expr $offset + $namesize`
outputname=`head --bytes=$limit $tname | tail --bytes=$namesize`
echo $outputname
uploadedsize=`du -b $outputname | awk '{ print $1 }'`
downloadedsize=`expr $uploadedsize \+ 1000`
uploadedsize=$downloadedsize
uploadedsize=`expr 3 \* $uploadedsize`
uploadedsize=`expr $uploadedsize / 2`
echo $uploadedsize
echo $tname
echo $outputname
resumename="${tname:0:-8}.resume"
paddingstring="eeeeeeeeeeee"
pad=`expr ${paddingstring:${#uploadedsize}}`
echo $uploadedsize$pad
mv $tname /home/xand/.config/transmission/torrents/
cd /home/xand/.config/transmission/resume
cp my.resume.template $resumename
test="sed -i \"s/uploadedi1098378065ee/uploadedi$uploadedsize$pad/g\" $resumename"
echo $tname $resumename $downloadedsize $uploadedsize $test
sed -i "s/uploadedi1098378065ee/uploadedi$uploadedsize$pad/g" $resumename
cdb -g down
Initial URL
Initial Description
Used parts of this in resetting my torrent upload information after losing if (was experimenting with switching to a new torrent-client). Only works on transmission-gtk torrent files [i think]
Initial Title
Set torrent uploaded sizes in torrent files
Initial Tags
Bash
Initial Language
Bash