wip-feat: adds download message queue logic
This commit is contained in:
27
src/Download/Downloader/WgetDownloader.php
Normal file
27
src/Download/Downloader/WgetDownloader.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Download\Downloader;
|
||||
|
||||
use App\Message\DownloadMessage;
|
||||
use App\Message\DownloadMovieMessage;
|
||||
use App\Message\DownloadTvShowMessage;
|
||||
|
||||
class WgetDownloader implements DownloaderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* SSHs into the NAS and performs the download.
|
||||
* This way retains the fast DL speed on the NAS.
|
||||
*/
|
||||
public function download(string $baseDir, string $title, string $url, ?int $downloadId): void
|
||||
{
|
||||
// SSHs into the NAS, cds into movies dir, makes new dir based on filename, cds into that dir, downloads movie
|
||||
system(sprintf(
|
||||
'sh /var/www/bash/app/wget_download.sh "%s" "%s" "%s"',
|
||||
$baseDir,
|
||||
$title,
|
||||
$url
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user