From a47893ff9beb194fd0be38a8dabeac4ef23dcb44 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 26 Oct 2023 04:02:35 +0300 Subject: [PATCH] request scrape update on torrent download --- src/Controller/TorrentController.php | 18 ++++++++++++++++++ src/Service/TorrentService.php | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index 5e97ac0..c275c74 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -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 time() ); + // Request scrape + $torrentService->updateTorrentScraped( + $torrent->getId(), + 0 + ); + // Register download event $activityService->addEventTorrentDownloadFileAdd( $user->getId(), @@ -2065,6 +2077,12 @@ class TorrentController extends AbstractController time() ); + // Request scrape + $torrentService->updateTorrentScraped( + $torrent->getId(), + 0 + ); + // Register download event $activityService->addEventTorrentDownloadMagnetAdd( $user->getId(), diff --git a/src/Service/TorrentService.php b/src/Service/TorrentService.php index 5e2c4c3..6cb8a10 100644 --- a/src/Service/TorrentService.php +++ b/src/Service/TorrentService.php @@ -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,