Méthode |
Description |
|
__construct ( $data = null, $meta = [], $piece_length = 256 ) |
Read and decode torrent file/data OR build a torrent from source folder/file(s)
Supported signatures:
- Torrent(); // get an instance (usefull to scrape and check errors)
- Torrent( string $torrent ); // analyse a torrent file
- Torrent( string $torrent, string $announce );
- Torrent( string $torrent, array $meta );
- Torrent( string $file_or_folder ); // create a torrent file
- Torrent( string $file_or_folder, string $announce_url, [int $piece_length] );
- Torrent( string $file_or_folder, array $meta, [int $piece_length] );
- Torrent( array $files_list );
- Torrent( array $files_list, string $announce_url, [int $piece_length] );
- Torrent( array $files_list, array $meta, [int $piece_length] ); |
|
__toString ( ) : string |
Convert the current Torrent instance in torrent format |
|
announce ( $announce = null ) : string | array | null |
Getter and setter of torrent announce url / list
If the argument is a string, announce url is added to announce list (or set as announce if announce is not set)
If the argument is an array/object, set announce url (with first url) and list (if array has more than one url), tiered list supported
If the argument is false announce url & list are unset |
|
comment ( $comment = null ) : string | null |
Getter and setter of torrent comment |
|
content ( $precision = null ) : array |
List torrent content |
|
encode ( $mixed ) : string |
Encode torrent data |
|
error ( ) : string | boolean |
Return last error message |
|
errors ( ) : array | boolean |
Return Errors |
|
file_get_contents ( $file, $timeout = self::timeout, $offset = null, $length = null ) : string | boolean |
Helper to get (distant) file content |
|
filesize ( $file ) : double | boolean |
Helper to return filesize (even bigger than 2Gb -linux only- and distant files size) |
|
fopen ( $file, $size = null ) : ressource | boolean |
Helper to open file to read (even bigger than 2Gb, linux only) |
|
format ( $size, $precision = 2 ) : string |
Helper to format size in bytes to human readable |
|
hash_info ( ) : string |
Compute hash info |
|
httpseeds ( $urls = null ) : array | null |
Getter and setter of httpseed(s) url list ( Bittornado implementation ) |
|
is_private ( $private = null ) : boolean |
Getter and setter of private flag |
|
is_torrent ( $file, $timeout = self::timeout ) : boolean |
Helper to check if a file is a torrent |
|
is_url ( $url ) : boolean |
Helper to check if string is an url (http) |
|
magnet ( $html = true ) : string |
Get magnet link |
|
name ( $name = null ) : string | null |
Getter and setter of torrent name |
|
offset ( ) : array |
List torrent content pieces and offset(s) |
|
piece_length ( ) : integer |
Get piece length |
|
save ( $filename = null ) : boolean |
Save torrent file to disk |
|
scandir ( $dir ) : array |
Helper to scan directories files and sub directories recursivly |
|
scrape ( $announce = null, $hash_info = null, $timeout = self::timeout ) |
* static |
|
send ( $filename = null ) : void |
Send torrent file to client |
|
size ( $precision = null ) : integer | string |
Sum torrent content size |
|
source ( $source = null ) : string | null |
Getter and setter of torrent source |
|
untier ( $announces ) : array |
Flatten announces list |
|
url_exists ( $url ) : boolean |
Helper to check if url exists |
|
url_list ( $urls = null ) : string | array | null |
Getter and setter of webseed(s) url list ( GetRight implementation ) |
|