Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42e232bef3 | |||
| 45b484d44c | |||
| dd52a903f6 |
@@ -1,22 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
caddy:
|
|
||||||
image: caddy:2.9.1
|
|
||||||
restart: unless-stopped
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
- "443:443/udp"
|
|
||||||
volumes:
|
|
||||||
- $PWD/../../bash/caddy:/etc/caddy
|
|
||||||
- $PWD/../../bash/certs:/etc/ssl
|
|
||||||
# The "entrypoint" into the application. This reverse proxy
|
|
||||||
# proxies traffic back to their respective services. If not
|
|
||||||
# running behind a reverse proxy inject your SSL certificates
|
|
||||||
# into this container.
|
|
||||||
# This container runs the actual web app in a php:8.4-fpm
|
|
||||||
# base container.
|
|
||||||
app:
|
app:
|
||||||
image: code.caldwell.digital/home/torsearch-app:latest
|
image: code.caldwell.digital/home/torsearch-app:latest
|
||||||
ports:
|
ports:
|
||||||
@@ -48,7 +30,7 @@ services:
|
|||||||
- ./downloads/tvshows:/var/download/tvshows
|
- ./downloads/tvshows:/var/download/tvshows
|
||||||
environment:
|
environment:
|
||||||
TZ: America/Chicago
|
TZ: America/Chicago
|
||||||
command: -vvv
|
command: -vv --time-limit=3600 --limit=10
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
restart: always
|
restart: always
|
||||||
@@ -68,6 +50,7 @@ services:
|
|||||||
- ./downloads/tvshows:/var/download/tvshows
|
- ./downloads/tvshows:/var/download/tvshows
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
command: -vv
|
||||||
environment:
|
environment:
|
||||||
TZ: America/Chicago
|
TZ: America/Chicago
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
35
migrations/Version20250709161037.php
Normal file
35
migrations/Version20250709161037.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250709161037 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE download CHANGE batch_id episode_id VARCHAR(255) DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE download CHANGE episode_id batch_id VARCHAR(255) DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
/**
|
/**
|
||||||
* @var RedisAdapter $cache
|
* @var RedisAdapter $cache
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
private MediaFiles $mediaFiles,
|
private MediaFiles $mediaFiles,
|
||||||
@@ -34,11 +33,11 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
$downloadPreferences = $downloadEntity->getUser()->getDownloadPreferences();
|
$downloadPreferences = $downloadEntity->getUser()->getDownloadPreferences();
|
||||||
$path = $this->getDownloadPath($mediaType, $title, $downloadPreferences);
|
$path = $this->getDownloadPath($mediaType, $title, $downloadPreferences);
|
||||||
|
|
||||||
$processArgs = ['wget', $url];
|
$processArgs = ['wget', '-O', $downloadEntity->getFilename(), $url];
|
||||||
|
|
||||||
if ($downloadEntity->getStatus() === 'Paused') {
|
if ($downloadEntity->getStatus() === 'Paused') {
|
||||||
$downloadEntity->setStatus('In Progress');
|
$downloadEntity->setStatus('In Progress');
|
||||||
$processArgs = ['wget', '-c', $url];
|
$processArgs = ['wget', '-c', '-O', $downloadEntity->getFilename(), $url];
|
||||||
} else {
|
} else {
|
||||||
$downloadEntity->setProgress(0);
|
$downloadEntity->setProgress(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ class ApiController extends AbstractController
|
|||||||
public function download(
|
public function download(
|
||||||
DownloadMediaInput $input,
|
DownloadMediaInput $input,
|
||||||
): Response {
|
): Response {
|
||||||
$ptn = (object) new Ptn()->parse($input->filename);
|
|
||||||
if ($input->mediaType === "tvshows" &&
|
|
||||||
!property_exists($ptn, 'episode') && !property_exists($ptn, 'season')
|
|
||||||
) {
|
|
||||||
$input->filename = $input->episodeId . '_' . $input->filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
$download = $this->downloadRepository->insert(
|
$download = $this->downloadRepository->insert(
|
||||||
$this->getUser(),
|
$this->getUser(),
|
||||||
$input->url,
|
$input->url,
|
||||||
@@ -46,10 +39,8 @@ class ApiController extends AbstractController
|
|||||||
$input->filename,
|
$input->filename,
|
||||||
$input->imdbId,
|
$input->imdbId,
|
||||||
$input->mediaType,
|
$input->mediaType,
|
||||||
"",
|
$input->episodeId,
|
||||||
);
|
);
|
||||||
$this->downloadRepository->getEntityManager()->persist($download);
|
|
||||||
$this->downloadRepository->getEntityManager()->flush();
|
|
||||||
$input->downloadId = $download->getId();
|
$input->downloadId = $download->getId();
|
||||||
$input->userId = $this->getUser()->getId();
|
$input->userId = $this->getUser()->getId();
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Download
|
|||||||
private ?int $progress = null;
|
private ?int $progress = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $batchId = null;
|
private ?string $episodeId = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'downloads')]
|
#[ORM\ManyToOne(inversedBy: 'downloads')]
|
||||||
private ?User $user = null;
|
private ?User $user = null;
|
||||||
@@ -143,14 +143,14 @@ class Download
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBatchId(): ?string
|
public function getEpisodeId(): ?string
|
||||||
{
|
{
|
||||||
return $this->batchId;
|
return $this->episodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBatchId(?string $batchId): static
|
public function setEpisodeId(?string $episodeId): static
|
||||||
{
|
{
|
||||||
$this->batchId = $batchId;
|
$this->episodeId = $episodeId;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Download\Framework\Entity\Download;
|
|||||||
use App\User\Framework\Entity\User;
|
use App\User\Framework\Entity\User;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Nihilarr\PTN;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,9 +63,15 @@ class DownloadRepository extends ServiceEntityRepository
|
|||||||
string $filename,
|
string $filename,
|
||||||
string $imdbId,
|
string $imdbId,
|
||||||
string $mediaType,
|
string $mediaType,
|
||||||
string $batchId,
|
?string $episodeId = null,
|
||||||
string $status = 'New'
|
string $status = 'New'
|
||||||
): Download {
|
): Download {
|
||||||
|
$ptn = (object) new Ptn()->parse($filename);
|
||||||
|
if ($mediaType === "tvshows" &&
|
||||||
|
!property_exists($ptn, 'episode') && !property_exists($ptn, 'season')
|
||||||
|
) {
|
||||||
|
$filename = $episodeId . '_' . $filename;
|
||||||
|
}
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$download = (new Download())
|
$download = (new Download())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
@@ -73,7 +80,7 @@ class DownloadRepository extends ServiceEntityRepository
|
|||||||
->setFilename($filename)
|
->setFilename($filename)
|
||||||
->setImdbId($imdbId)
|
->setImdbId($imdbId)
|
||||||
->setMediaType($mediaType)
|
->setMediaType($mediaType)
|
||||||
->setBatchId($batchId)
|
->setEpisodeId($episodeId)
|
||||||
->setProgress(0)
|
->setProgress(0)
|
||||||
->setStatus($status);
|
->setStatus($status);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user