From 5f4a14ebe2aa2daa21266f7d2cbc368675e26d4a Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 23 Oct 2023 23:37:15 +0300 Subject: [PATCH] add APP_TORRENT_WANTED_FTP_FOLDER setting #27 --- .env | 1 + config/services.yaml | 1 + src/Controller/TorrentController.php | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 9b83a59..afba1d3 100644 --- a/.env +++ b/.env @@ -88,4 +88,5 @@ APP_TORRENT_FILE_SIZE_MAX=1024000 # Store wanted torrent files in /app/var/ftp by /app/crontab/torrent/scrape/{key} APP_TORRENT_WANTED_FTP_ENABLED=1 +APP_TORRENT_WANTED_FTP_FOLDER=/yggtracker APP_TORRENT_WANTED_FTP_APPROVED_ONLY=1 \ No newline at end of file diff --git a/config/services.yaml b/config/services.yaml index e2cb3f6..e53a8b1 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -19,6 +19,7 @@ parameters: app.yggdrasil: '%env(APP_YGGDRASIL)%' app.torrent.size.max: '%env(APP_TORRENT_FILE_SIZE_MAX)%' app.torrent.wanted.ftp.enabled: '%env(APP_TORRENT_WANTED_FTP_ENABLED)%' + app.torrent.wanted.ftp.folder: '%env(APP_TORRENT_WANTED_FTP_FOLDER)%' app.torrent.wanted.ftp.approved: '%env(APP_TORRENT_WANTED_FTP_APPROVED_ONLY)%' services: diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index cde50c6..09e9755 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -2212,7 +2212,8 @@ class TorrentController extends AbstractController $torrentService->copyToFtpStorage( $torrent->getId(), sprintf( - '/torrents/wanted/all/wanted#%s.%s.torrent', + '%s/torrents/wanted/all/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2224,7 +2225,8 @@ class TorrentController extends AbstractController $torrentService->copyToFtpStorage( $torrent->getId(), sprintf( - '/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', + '%s/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2236,7 +2238,8 @@ class TorrentController extends AbstractController $torrentService->copyToFtpStorage( $torrent->getId(), sprintf( - '/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', + '%s/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2249,7 +2252,8 @@ class TorrentController extends AbstractController $torrentService->copyToFtpStorage( $torrent->getId(), sprintf( - '/torrents/wanted/locale/%s/wanted#%s.%s.torrent', + '%s/torrents/wanted/locale/%s/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $locale, $torrent->getId(), $file->getName() @@ -2265,7 +2269,8 @@ class TorrentController extends AbstractController /// All $torrentService->removeFromFtpStorage( sprintf( - '/torrents/wanted/all/wanted#%s.%s.torrent', + '%s/torrents/wanted/all/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2274,7 +2279,8 @@ class TorrentController extends AbstractController /// Sensitive $torrentService->removeFromFtpStorage( sprintf( - '/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', + '%s/torrents/wanted/sensitive/yes/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2282,7 +2288,8 @@ class TorrentController extends AbstractController $torrentService->removeFromFtpStorage( sprintf( - '/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', + '%s/torrents/wanted/sensitive/no/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $torrent->getId(), $file->getName() ) @@ -2293,7 +2300,8 @@ class TorrentController extends AbstractController { $torrentService->removeFromFtpStorage( sprintf( - '/torrents/wanted/locale/%s/wanted#%s.%s.torrent', + '%s/torrents/wanted/locale/%s/wanted#%s.%s.torrent', + $this->getParameter('app.torrent.wanted.ftp.folder'), $locale, $torrent->getId(), $file->getName()