aboutsummaryrefslogtreecommitdiffstats
path: root/lib/FIDD.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/FIDD.php')
-rw-r--r--lib/FIDD.php40
1 files changed, 27 insertions, 13 deletions
diff --git a/lib/FIDD.php b/lib/FIDD.php
index d2a1e5e..d15ab35 100644
--- a/lib/FIDD.php
+++ b/lib/FIDD.php
@@ -10,6 +10,7 @@
include 'lib/lib.php';
include 'lib/fabpot-yaml/lib/sfYaml.php';
+include 'lib/magnet.php';
/**
*/
@@ -133,10 +134,12 @@ class FIDD
$isos = glob($dir . '/*');
foreach ($isos as $isodir) {
+
$data = array();
$files = glob($isodir . '/*.*');
foreach ($files as $f) {
+
$fi = pathinfo($f);
$ext = $fi['extension'];
@@ -146,30 +149,41 @@ class FIDD
$key = str_replace('.iso.md5', '.iso', basename($f));
$data['file'] = $key;
$data['md5'] = self::get_checksum_value($f);
- $md5gpg = str_replace('.iso.md5', '.md5.gpg', basename($f));
- $data['md5.gpg'] = $md5gpg;
-
- break;
- case 'sha1':
- $data['sha1'] = self::get_checksum_value($f);
- $sha1gpg = str_replace('.iso.sha1', '.sha1.gpg', basename($f));
- $data['sha1.gpg'] = $sha1gpg;
-
- break;
- case 'sha512': $data['sha512'] = self::get_checksum_value($f); break;
- case 'langs': $data['langs'] = implode(', ', explode("\n", trim(file_get_contents($f)))); break;
+ $md5gpg = str_replace('.iso.md5', '.md5.gpg', basename($f));
+ $data['md5.gpg'] = $md5gpg;
+ break;
+ case 'sha1':
+ $data['sha1'] = self::get_checksum_value($f);
+ $sha1gpg = str_replace('.iso.sha1', '.sha1.gpg', basename($f));
+ $data['sha1.gpg'] = $sha1gpg;
+ break;
+ case 'sha512':
+ $data['sha512'] = self::get_checksum_value($f);
+ $sha512gpg = str_replace('.iso.sha512', '.sha512.gpg', basename($f));
+ $data['sha512.gpg'] = $sha512gpg;
+ break;
+ case 'langs': $data['langs'] = implode(', ', explode("\n", trim(file_get_contents($f))));
+ break;
+
}
}
+
if (null !== ($ret = self::is_correct_name($data['file']))) {
$data['path'] = sprintf('%s/%s',
$ret['release'] == '' ? sprintf('iso/%s', $ret['version']) : 'iso/cauldron',
str_replace('.iso', '', $data['file'])
);
+ $torrentfile = str_replace('.iso', '.torrent', $data['file']);
$data['torrent'] = sprintf('%s/%s',
$ret['release'] == '' ? sprintf('iso/%s/torrents', $ret['version']) : 'iso/cauldron/torrents',
- str_replace('.iso', '.torrent', $data['file'])
+ $torrentfile
);
+ $torrentfile = "var/tmp/torrents/".$torrentfile;
+ $data['magnet'] = sprintf('%s&dn=%s&tr=%s',
+ magnet($torrentfile),
+ str_replace('.iso', '', $data['file']),
+ 'udp%3A%2F%2Ftracker.torrent.eu.org%3A451');
$data['name'] = str_replace(array('-', '.iso', 'i586', 'x86_64'), array(' ', '', '32bit', '64bit'), $data['file']);
$data['size'] = $filesizes[$data['file']];