Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Torrent - seed & peer ...
saint99
post 13.04.2004, 18:02:23
Post #1





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 18.03.2004
Skąd: Brzozów

Ostrzeżenie: (0%)
-----


Czy ktoś orientuje sie jak uzyskać informacje na temat ilości seedów i peerów danego pliku torrenta questionmark.gif

** plik torrent - plik który zawiera informacje o udostemnionych zasobach na innym kompie
** seed - osoba która udostempnia
** peer - osoba która ściąga


--------------------
----------- d[=_=]b ------------
Go to the top of the page
+Quote Post
FastRed
post 13.04.2004, 18:10:36
Post #2





Grupa: Zarejestrowani
Postów: 79
Pomógł: 0
Dołączył: 30.06.2003
Skąd: Chełm

Ostrzeżenie: (0%)
-----


Mój post co prawda nic nie wniesie do tematu, ale go napisze. Szukałem już trochę czasu info o tym jak odczytać info o seedach i peerach i znajduję tylko sposoby, które działają na jednym trackerze. Jeśli ktoś będzie znał sposób na rozwiązanie tego problemu to będę wdzięczny.
Go to the top of the page
+Quote Post
saint99
post 13.04.2004, 18:25:39
Post #3





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 18.03.2004
Skąd: Brzozów

Ostrzeżenie: (0%)
-----


Znalazłem coś takiego ... nie wiem czy to od tego jest ale nie działa sad.gif Pokazuje sie tylko tabelka ale bez danych (nie uzupełniona).

Kod
<table border="1" cellpadding="0" cellspacing="0" width="100%">

  <tr>

    <td nowrap>.torrent file</td>

    <td nowrap>Name</td>

    <td nowrap>Size</td>

    <td nowrap>Seeds</td>

    <td nowrap>Peers</td>

    <td nowrap>Hash</td>

    <td nowrap>Announce</td>

    <td nowrap>Tracker</td>

  </tr>

[php:1:861859e2f2]<?php
### Settings... ###
$path = "/upload/"; #Kansio mistä etsitään .torrent päätteisiä tiedostoja...
$max_cache_file_age = "10"; #(1h)
###/Settings... ###
$time_alku=explode(" ", microtime());
$time_alku=$time_alku[0] + $time_alku[1];
set_time_limit(900);
ini_set(register_globals, "On");
function torrent_nfo($torrent) {
global $max_cache_file_age;
require_once("bencode.php");
$bencode = new BEncodeLib();
$file = fopen($torrent, "r");
$stream = fread($file, filesize($torrent));
fclose($file);
$torrent = $bencode->bdecode($stream);
$torrent[hash] = sha1($bencode->bencode($torrent[info]));
$temp = tiedosto_loppu($torrent[announce]);
$torrent[tracker] = ereg_replace($temp, "", $torrent[announce]);
## Tracker status... ##
$tracker = "$torrent[tracker]" . "scrape";
$tracker_md5 = md5($tracker);
$cache_age = time() - @filemtime("/tmp/cache/$tracker_md5");
if(file_exists("/tmp/cache/$tracker_md5") && $cache_age < $max_cache_file_age) {
$open = fopen("/tmp/cache/$tracker_md5", "r");
$scrape = fread($open, filesize("/tmp/cache/$tracker_md5"));
$scrape = gzuncompress($scrape);
fclose($open);
}
if(file_exists("/tmp/cache/$tracker_md5") && $cache_age > $max_cache_file_age) {
$scrape = file_get_contents("$tracker");
if(strlen($scrape) > 10) {
$save = fopen("/tmp/cache/$tracker_md5", "w");
fwrite($save, gzcompress($scrape));
fclose($save);
}
}
if(!file_exists("/tmp/cache/$tracker_md5")) {
$scrape = file_get_contents("$tracker");
if(strlen($scrape) > 10) {
$save = fopen("/tmp/cache/$tracker_md5", "w");
fwrite($save, gzcompress($scrape));
fclose($save);
}
}
$info = $bencode->bdecode($scrape);
$torrent[seeds] = $info['files'][hex2bin($torrent[hash])]['complete'];
$torrent[peers] = $info['files'][hex2bin($torrent[hash])]['incomplete'];
##/Tracker status... ##
return $torrent;
}
function tiedosto_loppu($tiedosto) {
$tiedosto = explode("/", $tiedosto);
$tiedosto_pit = sizeof($tiedosto); $tiedosto_pit--;
$tiedosto = $tiedosto[$tiedosto_pit];
return($tiedosto);
}
function tiedosto_paate($tiedosto) {
$tiedosto = explode(".", $tiedosto);
$tiedosto_pit = sizeof($tiedosto); $tiedosto_pit--;
$tiedosto = $tiedosto[$tiedosto_pit];
return($tiedosto);
}
function hex2bin($hex)
{
$result = '';
for ($i = 0; $i < strlen($hex); $i += 2)
$result .= chr(hexdec(substr($hex,$i,2)));
return $result;
}
$files = shell_exec("find $path | grep -i torrent");
$files = explode("n", $files);
natcasesort($files);
foreach($files as $file) {
if(is_file($file) && filesize($file) > 0 && strtolower(tiedosto_paate($file)) == "torrent") {
$torrent = torrent_nfo($file);
$file_end = tiedosto_loppu($file);
print("<tr><td nowrap>$file_end</td><td nowrap>" . $torrent[info][name] . "</td><td nowrap>" . $torrent[info][length] . "</td><td nowrap>" . $torrent[seeds] . "</td><td nowrap>" . $torrent[peers] . "</td><td nowrap>" . $torrent[hash] . "</td><td nowrap>" . $torrent[announce] . "</td><td nowrap>" . $torrent[tracker] . "</td></tr>n");
}
}
$time_loppu=explode(" ", microtime());
$time_loppu=$time_loppu[0] + $time_loppu[1];
$time = round($time_loppu - $time_alku, 2);
print("</table>n<b>Processtime $time secs..");
?>[/php:1:861859e2f2]
Kod
</table>


--------------------
----------- d[=_=]b ------------
Go to the top of the page
+Quote Post
saint99
post 15.04.2004, 15:44:25
Post #4





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 18.03.2004
Skąd: Brzozów

Ostrzeżenie: (0%)
-----


Może ktoś wie jak to jest zrobione na tych stronach torrenta questionmark.gif


--------------------
----------- d[=_=]b ------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2025 - 17:25