Browse Source

add direct downloads indicator

main
ghost 1 year ago
parent
commit
387ca35a9c
  1. 11
      src/library/database.php
  2. 11
      src/public/index.php
  3. 11
      src/public/magnet.php

11
src/library/database.php

@ -885,6 +885,17 @@ class Database { @@ -885,6 +885,17 @@ class Database {
return (int) $query->fetch()->result;
}
public function getMagnetToAcceptableSourceTotalByMagnetId(int $magnetId) : int {
$this->_debug->query->select->total++;
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetToAcceptableSource` WHERE `magnetId` = ?');
$query->execute([$magnetId]);
return (int) $query->fetch()->result;
}
public function getMagnetToAddressTrackerSeedersSum() : int {
$this->_debug->query->select->total++;

11
src/public/index.php

@ -151,7 +151,8 @@ else @@ -151,7 +151,8 @@ else
],
'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId),
'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId),
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId)
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId),
'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId)
];
}
}
@ -307,6 +308,14 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> @@ -307,6 +308,14 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
</svg>
<sup><?php echo $magnet->leechers ?></sup>
</span>
<?php if ($magnet->directs) { ?>
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Direct') ?>">
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-database" viewBox="0 0 16 16">
<path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313ZM13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 5.698ZM14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13V4Zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 8.698Zm0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525Z"/>
</svg>
<sup><?php echo $magnet->directs ?></sup>
</span>
<?php } ?>
<span class="float-right margin-l-12">
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/action.php?target=magnet&toggle=star&magnetId=<?php echo $magnet->magnetId ?>&callback=<?php echo base64_encode(sprintf('%s/index.php?query=%s#magnet-%s', WEBSITE_URL, urlencode($request->query), $magnet->magnetId)) ?>" title="<?php echo _('Star') ?>">
<?php if ($magnet->star->status) { ?>

11
src/public/magnet.php

@ -133,7 +133,8 @@ else @@ -133,7 +133,8 @@ else
],
'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId),
'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId),
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId)
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId),
'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId),
];
}
@ -288,6 +289,14 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> @@ -288,6 +289,14 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
</svg>
<sup><?php echo $response->magnet->leechers ?></sup>
</span>
<?php if ($response->magnet->directs) { ?>
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Direct') ?>">
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-database" viewBox="0 0 16 16">
<path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313ZM13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 5.698ZM14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13V4Zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 8.698Zm0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525Z"/>
</svg>
<sup><?php echo $response->magnet->directs ?></sup>
</span>
<?php } ?>
<span class="float-right margin-l-12">
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/action.php?target=magnet&toggle=star&magnetId=<?php echo $response->magnet->magnetId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $response->magnet->magnetId)) ?>" title="<?php echo _('Star') ?>">
<?php if ($response->magnet->star->status) { ?>

Loading…
Cancel
Save