Browse Source

request scrape update on torrent download

main
ghost 1 year ago
parent
commit
a47893ff9b
  1. 18
      src/Controller/TorrentController.php
  2. 16
      src/Service/TorrentService.php

18
src/Controller/TorrentController.php

@ -1826,6 +1826,12 @@ class TorrentController extends AbstractController @@ -1826,6 +1826,12 @@ class TorrentController extends AbstractController
time()
);
// Request scrape
$torrentService->updateTorrentScraped(
$torrent->getId(),
0
);
// Register download event
$activityService->addEventTorrentDownloadFileAdd(
$user->getId(),
@ -1947,6 +1953,12 @@ class TorrentController extends AbstractController @@ -1947,6 +1953,12 @@ class TorrentController extends AbstractController
time()
);
// Request scrape
$torrentService->updateTorrentScraped(
$torrent->getId(),
0
);
// Register download event
$activityService->addEventTorrentDownloadFileAdd(
$user->getId(),
@ -2065,6 +2077,12 @@ class TorrentController extends AbstractController @@ -2065,6 +2077,12 @@ class TorrentController extends AbstractController
time()
);
// Request scrape
$torrentService->updateTorrentScraped(
$torrent->getId(),
0
);
// Register download event
$activityService->addEventTorrentDownloadMagnetAdd(
$user->getId(),

16
src/Service/TorrentService.php

@ -407,6 +407,22 @@ class TorrentService @@ -407,6 +407,22 @@ class TorrentService
}
}
public function updateTorrentScraped(
int $torrentId,
int $time
): void
{
if ($torrent = $this->getTorrent($torrentId))
{
$torrent->setScraped(
time()
);
$this->entityManagerInterface->persist($torrent);
$this->entityManagerInterface->flush();
}
}
public function updateTorrentScrape(
int $torrentId,
int $seeders,

Loading…
Cancel
Save