Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec0d2a198c | ||
|
|
1f1c6f775f | ||
|
|
cd14a197aa |
@@ -67,6 +67,9 @@ export default class MonitorListRow extends HTMLTableRowElement {
|
|||||||
<th class="px-4 py-2">
|
<th class="px-4 py-2">
|
||||||
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Downloaded At</div>
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Downloaded At</div>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="px-4 py-2">
|
||||||
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Air Date</div>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -107,6 +110,9 @@ export default class MonitorListRow extends HTMLTableRowElement {
|
|||||||
<td class="px-4 py-2">
|
<td class="px-4 py-2">
|
||||||
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('downloaded-at') ?? "-"}</div>
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('downloaded-at') ?? "-"}</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-4 py-2">
|
||||||
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('air-date') ?? "-"}</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
34
migrations/Version20251106045808.php
Normal file
34
migrations/Version20251106045808.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?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 Version20251106045808 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE monitor ADD poster VARCHAR(1024) 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 monitor DROP poster
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ use App\Monitor\Action\Result\AddMonitorResult;
|
|||||||
use App\Monitor\Framework\Entity\Monitor;
|
use App\Monitor\Framework\Entity\Monitor;
|
||||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||||
use App\Monitor\MonitorEvents;
|
use App\Monitor\MonitorEvents;
|
||||||
|
use App\Tmdb\TmdbClient;
|
||||||
use App\User\Framework\Repository\UserRepository;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||||
@@ -22,13 +23,17 @@ readonly class AddMonitorHandler implements HandlerInterface
|
|||||||
private MessageBusInterface $bus,
|
private MessageBusInterface $bus,
|
||||||
private MonitorRepository $movieMonitorRepository,
|
private MonitorRepository $movieMonitorRepository,
|
||||||
private UserRepository $userRepository,
|
private UserRepository $userRepository,
|
||||||
|
private TmdbClient $tmdb,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function handle(CommandInterface $command): ResultInterface
|
public function handle(CommandInterface $command): ResultInterface
|
||||||
{
|
{
|
||||||
$user = $this->userRepository->find($command->userId);
|
$user = $this->userRepository->find($command->userId);
|
||||||
|
$poster = $this->getPoster($command->imdbId);
|
||||||
|
|
||||||
$monitor = (new Monitor())
|
$monitor = (new Monitor())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
->setPoster($poster)
|
||||||
->setTmdbId($command->tmdbId)
|
->setTmdbId($command->tmdbId)
|
||||||
->setImdbId($command->imdbId)
|
->setImdbId($command->imdbId)
|
||||||
->setTitle($command->title)
|
->setTitle($command->title)
|
||||||
@@ -56,4 +61,10 @@ readonly class AddMonitorHandler implements HandlerInterface
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getPoster(string $imdbId): ?string
|
||||||
|
{
|
||||||
|
$data = $this->tmdb->tvShowDetails($imdbId);
|
||||||
|
return $data->poster;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use App\Download\Framework\Repository\DownloadRepository;
|
|||||||
use App\EventLog\Action\Command\AddEventLogCommand;
|
use App\EventLog\Action\Command\AddEventLogCommand;
|
||||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||||
use App\Monitor\Action\Result\MonitorTvEpisodeResult;
|
use App\Monitor\Action\Result\MonitorTvEpisodeResult;
|
||||||
|
use App\Monitor\Framework\Entity\Monitor;
|
||||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||||
use App\Monitor\MonitorEvents;
|
use App\Monitor\MonitorEvents;
|
||||||
use App\Tmdb\TmdbClient;
|
use App\Tmdb\TmdbClient;
|
||||||
@@ -43,6 +44,7 @@ readonly class MonitorTvEpisodeHandler implements HandlerInterface
|
|||||||
try {
|
try {
|
||||||
$monitor = $this->monitorRepository->find($command->movieMonitorId);
|
$monitor = $this->monitorRepository->find($command->movieMonitorId);
|
||||||
$this->logger->info('> [MonitorTvEpisodeHandler] Executing MonitorTvEpisodeHandler for ' . $monitor->getTitle() . ' season ' . $monitor->getSeason() . ' episode ' . $monitor->getEpisode());
|
$this->logger->info('> [MonitorTvEpisodeHandler] Executing MonitorTvEpisodeHandler for ' . $monitor->getTitle() . ' season ' . $monitor->getSeason() . ' episode ' . $monitor->getEpisode());
|
||||||
|
$this->refreshData($monitor);
|
||||||
|
|
||||||
$this->bus->dispatch(new AddEventLogCommand(
|
$this->bus->dispatch(new AddEventLogCommand(
|
||||||
$monitor->getUser(),
|
$monitor->getUser(),
|
||||||
@@ -151,4 +153,15 @@ readonly class MonitorTvEpisodeHandler implements HandlerInterface
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function refreshData(Monitor $monitor)
|
||||||
|
{
|
||||||
|
if (null === $monitor->getPoster()) {
|
||||||
|
$this->logger->info('> [MonitorTvEpisodeHandler] Refreshing poster for "' . $monitor->getTitle() . '"');
|
||||||
|
$poster = $monitor->getParent()->getPoster();
|
||||||
|
if (null !== $poster && "" !== $poster) {
|
||||||
|
$monitor->setPoster($poster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ readonly class MonitorTvShowHandler implements HandlerInterface
|
|||||||
{
|
{
|
||||||
$this->logger->info('> [MonitorTvShowHandler] Executing MonitorTvShowHandler');
|
$this->logger->info('> [MonitorTvShowHandler] Executing MonitorTvShowHandler');
|
||||||
$monitor = $this->monitorRepository->find($command->monitorId);
|
$monitor = $this->monitorRepository->find($command->monitorId);
|
||||||
|
$this->refreshData($monitor);
|
||||||
|
|
||||||
// Check current episodes
|
// Check current episodes
|
||||||
$downloadedEpisodes = $this->mediaFiles
|
$downloadedEpisodes = $this->mediaFiles
|
||||||
@@ -157,4 +158,15 @@ readonly class MonitorTvShowHandler implements HandlerInterface
|
|||||||
'status' => ['New', 'Active', 'In Progress']
|
'status' => ['New', 'Active', 'In Progress']
|
||||||
]) !== null;
|
]) !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function refreshData(Monitor $monitor)
|
||||||
|
{
|
||||||
|
if (null === $monitor->getPoster()) {
|
||||||
|
$this->logger->info('> [MonitorTvShowHandler] Refreshing poster for "' . $monitor->getTitle() . '"');
|
||||||
|
$poster = $this->tmdb->tvshowDetails($monitor->getImdbId())->poster;
|
||||||
|
if (null !== $poster && "" !== $poster) {
|
||||||
|
$monitor->setPoster($poster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Monitor\Framework\Controller;
|
namespace App\Monitor\Framework\Controller;
|
||||||
|
|
||||||
use Aimeos\Map;
|
use Aimeos\Map;
|
||||||
|
use App\Monitor\Framework\Entity\Monitor;
|
||||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||||
use App\User\Framework\Entity\User;
|
use App\User\Framework\Entity\User;
|
||||||
use Spatie\IcalendarGenerator\Components\Calendar;
|
use Spatie\IcalendarGenerator\Components\Calendar;
|
||||||
@@ -27,9 +28,10 @@ class CalendarController extends AbstractController
|
|||||||
->refreshInterval(10);
|
->refreshInterval(10);
|
||||||
|
|
||||||
$monitors = $monitorRepository->whereAirDateNotNull();
|
$monitors = $monitorRepository->whereAirDateNotNull();
|
||||||
$calendar->event(Map::from($monitors)->map(function ($monitor) {
|
$calendar->event(Map::from($monitors)->map(function (Monitor $monitor) {
|
||||||
return new Event($monitor->getTitle())
|
return new Event($monitor->getTitle())
|
||||||
->startsAt($monitor->getAirDate())
|
->startsAt($monitor->getAirDate())
|
||||||
|
->attachment($monitor->getPoster())
|
||||||
->fullDay();
|
->fullDay();
|
||||||
})->toArray());
|
})->toArray());
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class Monitor
|
|||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?int $searchCount = null;
|
private ?int $searchCount = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?string $poster = null;
|
||||||
|
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
private bool $onlyFuture = true;
|
private bool $onlyFuture = true;
|
||||||
|
|
||||||
@@ -230,6 +233,17 @@ class Monitor
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPoster(): ?string
|
||||||
|
{
|
||||||
|
return $this->poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPoster(?string $poster): ?self
|
||||||
|
{
|
||||||
|
$this->poster = $poster;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getParent(): ?self
|
public function getParent(): ?self
|
||||||
{
|
{
|
||||||
return $this->parent;
|
return $this->parent;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
created-at="{{ monitor.createdAt|date('m/d/Y g:i a') }}"
|
created-at="{{ monitor.createdAt|date('m/d/Y g:i a') }}"
|
||||||
last-search="{{ monitor.lastSearch|date('m/d/Y g:i a') }}"
|
last-search="{{ monitor.lastSearch|date('m/d/Y g:i a') }}"
|
||||||
downloaded-at="{{null != monitor.downloadedAt ? monitor.downloadedAt|date('m/d/Y g:i a') : '-' }}"
|
downloaded-at="{{null != monitor.downloadedAt ? monitor.downloadedAt|date('m/d/Y g:i a') : '-' }}"
|
||||||
|
air-date="{{ null != monitor.airDate ? monitor.airDate|date('m/d/Y g:i a') : '-' }}"
|
||||||
>
|
>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-stone-800 truncate">
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-stone-800 truncate">
|
||||||
<a href="{{ path('app_search_result', {imdbId: monitor.imdbId, mediaType: monitor.monitorType|as_download_type}) }}"
|
<a href="{{ path('app_search_result', {imdbId: monitor.imdbId, mediaType: monitor.monitorType|as_download_type}) }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user