@@ -355,85 +355,4 @@ function rtExec( $cmds, $hash, $dbg )
355
355
return null ;
356
356
}
357
357
else return $ req ;
358
- }
359
-
360
- //------------------------------------------------------------------------------
361
- // Make string param for XMLRPC call
362
- //------------------------------------------------------------------------------
363
- function rtMakeStrParam ( $ param )
364
- {
365
- return "<param><value><string> " .$ param ."</string></value></param> " ;
366
- }
367
-
368
- //------------------------------------------------------------------------------
369
- // Add ".torrent" file to rTorrent
370
- //------------------------------------------------------------------------------
371
- function rtAddTorrent ( $ fname , $ isStart , $ directory , $ label , $ dbg = false )
372
- {
373
- if ( $ isStart )
374
- $ method = 'load_start_verbose ' ;
375
- else
376
- $ method = 'load_verbose ' ;
377
-
378
- if ( $ dbg ) rtDbg ( __FUNCTION__ , "1 " .$ fname );
379
- $ torrent = new Torrent ($ fname );
380
- if ( $ dbg ) rtDbg ( __FUNCTION__ , "2 " );
381
- if ( $ torrent ->errors () )
382
- {
383
- if ( $ dbg ) rtDbg ( __FUNCTION__ , "fail to create Torrent() object " );
384
- return false ;
385
- }
386
-
387
- if ( $ directory && strlen ( $ directory ) > 0 )
388
- {
389
- $ directory = rtMakeStrParam ( "d.set_directory= \"" .$ directory ."\"" );
390
- }
391
- else $ directory = "" ;
392
-
393
- $ comment = $ torrent ->comment ();
394
- if ( $ comment && strlen ( $ comment ) > 0 )
395
- {
396
- if ( isInvalidUTF8 ( $ comment ) )
397
- $ comment = win2utf ($ comment );
398
- if ( strlen ( $ comment ) > 0 )
399
- {
400
- $ comment = rtMakeStrParam ( "d.set_custom2=VRS24mrker " .rawurlencode ( $ comment ) );
401
- if (strlen ($ comment )>4096 )
402
- $ comment = '' ;
403
- }
404
- }
405
- else $ comment = "" ;
406
-
407
- if ( $ label && strlen ( $ label ) > 0 )
408
- {
409
- $ label = rtMakeStrParam ( "d.set_custom1= \"" .rawurlencode ( $ label )."\"" );
410
- }
411
- else $ label = "" ;
412
-
413
- $ addition = "" ;
414
- global $ saveUploadedTorrents ;
415
- $ delete_tied = ($ saveUploadedTorrents ? "" : rtMakeStrParam ( "d.delete_tied= " ));
416
-
417
- $ content =
418
- '<?xml version="1.0" encoding="UTF-8"?> ' .
419
- '<methodCall> ' .
420
- '<methodName> ' .$ method .'</methodName> ' .
421
- '<params> ' .
422
- '<param><value><string> ' .$ fname .'</string></value></param> ' .
423
- $ directory .
424
- $ comment .
425
- $ label .
426
- $ addition .
427
- $ delete_tied .
428
- '</params></methodCall> ' ;
429
-
430
- //if( $dbg ) rtDbg( __FUNCTION__, $content );
431
- $ res = rXMLRPCRequest::send ( $ content );
432
-
433
- if ( $ dbg && !empty ($ res ) ) rtDbg ( __FUNCTION__ , $ res );
434
-
435
- if ( !$ res || $ res = '' )
436
- return false ;
437
- else
438
- return $ torrent ->hash_info ();
439
- }
358
+ }
0 commit comments