Modifying Create!

dsouvik215

Member
May 25, 2018
896
0
16
Hi there,

I was trying to modify the create plugin, because I want it to create torrents with ctorrent. I edited my conf.php as follows:

Code:
$useExternal = 'ctorrent';
Code:
$pathToCreatetorrent = '/usr/bin/ctorrent';
Then I created a bash script for ctorrent like for the other clients:

Code:
#!/bin/sh
#
# $1 - taskNo
# $2 - php
# $3 - ctorrent
# $4 - path
# $5 - piecesize
# $6 - user

dir=/tmp/"$6"$1
mkdir "$dir"
chmod a+rx "$dir"
echo $$ > "$dir"/pid
chmod a+r "$dir"/pid
"$3" -t -l $5 -u dummy "$4" -s "$dir"/temp.torrent 2> "$dir"/errors 1> "$dir"/log
last=$?
chmod a+r "$dir"/*
if [ $last -eq 0 ] ; then
echo 'Try to correct torrent file...' >> "$dir"/log
cd "$(dirname $0)"
"$2" ./correct.php $1 "$6" >> "$dir"/errors
last=$?
if [ $last -eq 0 ] ; then
echo 'Done.' >> "$dir"/log
else
echo 'Error.' >> "$dir"/log
fi
fi
echo $last > "$dir"/status
chmod a+r "$dir"/status
So far so good. But everytime I create a torrent it fails with this error message:

Code
X-Powered-By: PHP/5.2.6-1+lenny9
Content-type: text/html

<br />
<b>Warning</b>: file_put_contents(/var/www/rutorrent/share/users/rtor/torrents/Dumbo.Der.fliegende.Elefant.1941.German.1080p.BluRay.x264.PROPER-DETAiLS/.torrent) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/rutorrent/php/Torrent.php</b> on line <b>365</b><br />
Console log window:

Code:
Create hash table: 2076/2577
Create hash table: 2101/2577
Create hash table: 2126/2577
Create hash table: 2151/2577
Create hash table: 2176/2577
Create hash table: 2201/2577
Create hash table: 2226/2577
Create hash table: 2251/2577
Create hash table: 2276/2577
Create hash table: 2301/2577
Create hash table: 2326/2577
Create hash table: 2351/2577
Create hash table: 2376/2577
Create hash table: 2401/2577
Create hash table: 2426/2577
Create hash table: 2451/2577
Create hash table: 2476/2577
Create hash table: 2501/2577
Create hash table: 2526/2577
Create hash table: 2551/2577
Create hash table: 2576/2577
Create hash table: 2577/2577
create metainfo file /tmp/rtor1294092775/temp.torrent successful.
Try to correct torrent file...
Done.

Does anyone have an idea why this fails?
 

somus1735

Member
May 25, 2018
833
0
16
Do you think this issue was caused by ctorrent or my script?
I think this is ctorrent. Insert 'sleep 60' into end of your script and check /tmp/rtor1294092775/temp.torrent file (dir name may be different). Attach it here, for example.
 

shwetha17

Member
May 24, 2018
785
0
16
I think this is ctorrent. Insert 'sleep 60' into end of your script and check /tmp/rtor1294092775/temp.torrent file (dir name may be different). Attach it here, for example.
Put this into the script, but no dir and no .torrent file was created in /tmp. :s

Figured it out how to fish the torrent directly after creating it.

Code:
ctorrent -x temp.torrent
Code:
Piece length: 262144
FILES INFO
Directory: German_TOP30_Party_Schlager_Charts_03_01_2011-MCG/
 

dsouvik215

Member
May 25, 2018
896
0
16
Figured it out!

Hier is the working ctorrent.sh for everyone else!

Code:
#!/bin/sh
#
# $1 - taskNo
# $2 - php
# $3 - ctorrent
# $4 - path
# $5 - piecesize
# $6 - user

path=$(echo "$4" | sed -e "s/\/*$//")
dir=/tmp/"$6"$1
mkdir "$dir"
chmod a+rx "$dir"
echo $$ > "$dir"/pid
chmod a+r "$dir"/pid
"$3" -t -l $5 -u dummy "$path" -s "$dir"/temp.torrent 2> "$dir"/errors 1> "$dir"/log
last=$?
chmod a+r "$dir"/*
if [ $last -eq 0 ] ; then
echo 'Try to correct torrent file...' >> "$dir"/log
cd "$(dirname $0)"
"$2" ./correct.php $1 "$6" >> "$dir"/errors
last=$?
if [ $last -eq 0 ] ; then
echo 'Done.' >> "$dir"/log
else
echo 'Error.' >> "$dir"/log
fi
fi
echo $last > "$dir"/status
chmod a+r "$dir"/status