在torrent文件中设置torrent上载的大小
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在torrent文件中设置torrent上载的大小相关的知识,希望对你有一定的参考价值。
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]
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
以上是关于在torrent文件中设置torrent上载的大小的主要内容,如果未能解决你的问题,请参考以下文章
您如何获得 libtorrent 中 torrent 的总大小?
使用 python-libtorrent 从 torrent 文件中获取 torrent 下载目录