Archived

This topic is now archived and is closed to further replies.

pedymaster

Auto load torrent from directory is not checking properly

Recommended Posts

Hi, I hope this post is not somewhere already, I tried to look for it but did not find it.

 

The problem is simple. When you setup settings -> Directories -> Automatically load .torrents from, the utserver should check the folder periodicaly for .torrent files and loading them. Well, It wont happen.

When I save some .torrent files to the set directory it is not load automaticaly unless I go to the settings and change to path. (e.g. from /mnt/utorrent/autotorrent to /mnt/utorrent/autotorrent/ - yes, just the slash at the and (and it works backward too) When I change it, the files are loaded, but only once and for next load, I again need to change the path, so its probably not done automaticaly.

The system is Debian 7 x64

 

I just wanted to report it and confirm it from someone else, that it really is like that.

 

Thanks, Pedy

Share this post


Link to post
Share on other sites

Not the answer you want, but FWIW I was not able to get this to work reliably either. I was stumbling over permissions problems with my Dropbox but I think the behavior was similar to yours. In the end I found it much more useful anyhow to put my own scheme together using fsniper and a script to post a torrent because I could label it, etc. I modified a script that someone else posted here. fsniper is very useful on my NAS for all kinds of things so I already had it installed. This lets me create a variety of auto load directories from different sources, label them separately, enforce permissions, and shuffle the final downloads all into their correct destinations.

 

steve

Share this post


Link to post
Share on other sites

Not the answer you want, but FWIW I was not able to get this to work reliably either. I was stumbling over permissions problems with my Dropbox but I think the behavior was similar to yours. In the end I found it much more useful anyhow to put my own scheme together using fsniper and a script to post a torrent because I could label it, etc. I modified a script that someone else posted here. fsniper is very useful on my NAS for all kinds of things so I already had it installed. This lets me create a variety of auto load directories from different sources, label them separately, enforce permissions, and shuffle the final downloads all into their correct destinations.

 

steve

 

Is there any chance you could share this script with me as I need my utserver to load torrents and automatically assign labels?

Share this post


Link to post
Share on other sites

Sure. Here is a perl script. I'm sure that I hacked this from someone else's but I can't remember who. You need to edit in your server IP, user name and password. You use them as:

 

add_torrent <filename> <label>

#!/usr/bin/perluse strict;use warnings;use HTTP::Cookies;use LWP::UserAgent;my @ns_headers = (    'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20041107 Firefox/1.0',    'Accept'     => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*',    'Accept-Charset'  => 'iso-8859-1,*,utf-8',    'Accept-Language' => 'en-US',  );# config your server heremy $server = "ip:port";my $username = "username";my $password = "password";my $filename=$ARGV[0];my $label=$ARGV[1];my $upload_url = "http://$server/gui";my $token_url = "$upload_url/token.html";my $realm = "uTorrent";# zero the cookie jarmy $ua = LWP::UserAgent->new();$ua->cookie_jar( { } );#login$ua->credentials( $server, $realm, $username => $password );# get tokenmy $response = $ua->get( $token_url , @ns_headers );my $return =  ( $response->is_success && $response->as_string =~/token/) ? 1 : 0 ;# token scraping and verificationmy $token_page = $response->as_string;$token_page =~ /none\;\'\>(.+)\<\/div/g;my $token = undef;$token=$1;unless ($return ==1 && $token ){ print "not logged in or no token exiting";exit; }# get files and loop through them sending and uploadingmy $hash=`/c/home/Steve/bin/tor_hash "$filename"`;chomp($hash);upload_file ( "$filename" ) if $filename =~/\.torrent$/;label_file ( "$hash", "$label");sub label_file {  #make query string  my %args = ( action => 'setprops', token => $token, hash => $_[0], s => 'label', v => $_[1]);  my $query_string = join '&', map { "$_=$args{$_}" } keys %args;  my $url =  $upload_url . "/?" . $query_string;  my $response = $ua->get( $url, @ns_headers );}sub upload_file {  my $filename = shift;  #make query string  my %args = ( action => 'add-file', token =>$token,);  my $query_string = join '&', map { "$_=$args{$_}" } keys %args;  my $url = $upload_url . "/?" . $query_string;  # post form content  my @content = (               Content_Type => 'form-data',               Content => [                         torrent_file => [ $filename ],                         submit => 'ADD_FILE_OK',                        ]              );  $response = $ua->post( $url, @ns_headers, @content );  $return =  ($response->is_success && $response->as_string =~/build/) ? 1 : 0 ;  unless ($return ==1  )    {      print "upload not successful for $filename\n";    }  else    {      unlink $filename;    }}

 

Share this post


Link to post
Share on other sites

 

Sure. Here is a perl script. I'm sure that I hacked this from someone else's but I can't remember who. You need to edit in your server IP, user name and password. You use them as:

 

add_torrent <filename> <label>

#!/usr/bin/perluse strict;use warnings;use HTTP::Cookies;use LWP::UserAgent;my @ns_headers = (    'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20041107 Firefox/1.0',    'Accept'     => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*',    'Accept-Charset'  => 'iso-8859-1,*,utf-8',    'Accept-Language' => 'en-US',  );# config your server heremy $server = "ip:port";my $username = "username";my $password = "password";my $filename=$ARGV[0];my $label=$ARGV[1];my $upload_url = "http://$server/gui";my $token_url = "$upload_url/token.html";my $realm = "uTorrent";# zero the cookie jarmy $ua = LWP::UserAgent->new();$ua->cookie_jar( { } );#login$ua->credentials( $server, $realm, $username => $password );# get tokenmy $response = $ua->get( $token_url , @ns_headers );my $return =  ( $response->is_success && $response->as_string =~/token/) ? 1 : 0 ;# token scraping and verificationmy $token_page = $response->as_string;$token_page =~ /none\;\'\>(.+)\<\/div/g;my $token = undef;$token=$1;unless ($return ==1 && $token ){ print "not logged in or no token exiting";exit; }# get files and loop through them sending and uploadingmy $hash=`/c/home/Steve/bin/tor_hash "$filename"`;chomp($hash);upload_file ( "$filename" ) if $filename =~/\.torrent$/;label_file ( "$hash", "$label");sub label_file {  #make query string  my %args = ( action => 'setprops', token => $token, hash => $_[0], s => 'label', v => $_[1]);  my $query_string = join '&', map { "$_=$args{$_}" } keys %args;  my $url =  $upload_url . "/?" . $query_string;  my $response = $ua->get( $url, @ns_headers );}sub upload_file {  my $filename = shift;  #make query string  my %args = ( action => 'add-file', token =>$token,);  my $query_string = join '&', map { "$_=$args{$_}" } keys %args;  my $url = $upload_url . "/?" . $query_string;  # post form content  my @content = (               Content_Type => 'form-data',               Content => [                         torrent_file => [ $filename ],                         submit => 'ADD_FILE_OK',                        ]              );  $response = $ua->post( $url, @ns_headers, @content );  $return =  ($response->is_success && $response->as_string =~/build/) ? 1 : 0 ;  unless ($return ==1  )    {      print "upload not successful for $filename\n";    }  else    {      unlink $filename;    }}

 

 

 

Thanks, appreciate you sharing the script.

Share this post


Link to post
Share on other sites

Have you tried setting the dir_autoload and dir_autoload_delete parameters in the utserver.conf configuration file?  This should allow you to set up an autoload directory.  I'm surprised you are able to use the web UI to do what looks like the same thing, since that feature isn't supposed to be available in the web UI (it'll show the value but not allow changes to it).

Share this post


Link to post
Share on other sites