Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 182708b8f0 | |||
| d6ba4d7d2a | |||
| e5c5ec93a8 | |||
| 942911d8ef | |||
| 2f7d406d12 | |||
| 4e1adc576c | |||
| 575fc08f24 | |||
| 87bdde801d | |||
| 7d35b6266b | |||
| caeda625fd | |||
| d710e31d2b | |||
| 39a64faa74 | |||
| c6a84df2fd |
7
.env
7
.env
@@ -51,3 +51,10 @@ OIDC_CLIENT_ID="Enter your OIDC client id"
|
||||
OIDC_CLIENT_SECRET="Enter your OIDC client secret"
|
||||
OIDC_BYPASS_FORM_LOGIN=false
|
||||
###< drenso/symfony-oidc-bundle ###
|
||||
|
||||
###> symfony/ntfy-notifier ###
|
||||
# NTFY_DSN=ntfy://default/TOPIC
|
||||
###< symfony/ntfy-notifier ###
|
||||
|
||||
NOTIFICATION_TRANSPORT=
|
||||
NTFY_DNS=
|
||||
|
||||
@@ -18,11 +18,3 @@ var observer = new MutationObserver(function(mutations) {
|
||||
});
|
||||
|
||||
observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true});
|
||||
|
||||
const ptr = PullToRefresh.init({
|
||||
mainElement: 'body',
|
||||
onRefresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
57
assets/controllers/upcoming_episodes_controller.js
Normal file
57
assets/controllers/upcoming_episodes_controller.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
import { Calendar } from '@fullcalendar/core';
|
||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
calendar = null;
|
||||
|
||||
initialize() {
|
||||
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.calendar = new Calendar(this.element, {
|
||||
plugins: [ dayGridPlugin, timeGridPlugin ],
|
||||
initialView: 'dayGridMonth',
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
||||
},
|
||||
editable: true, // Allow events to be dragged and resized
|
||||
events: '/api/events', // Symfony route to fetch events
|
||||
eventDrop: function(info) {
|
||||
// Handle event drop (e.g., update event in database via AJAX)
|
||||
},
|
||||
eventResize: function(info) {
|
||||
// Handle event resize (e.g., update event in database via AJAX)
|
||||
}
|
||||
});
|
||||
this.calendar.render();
|
||||
// this.calendar = new Calendar(this.element, {
|
||||
// plugins: [ dayGridPlugin, timeGridPlugin, listPlugin ],
|
||||
// initialView: 'dayGridMonth',
|
||||
// headerToolbar: {
|
||||
// left: 'prev,next today',
|
||||
// center: 'title',
|
||||
// right: 'dayGridMonth,timeGridWeek,listWeek'
|
||||
// }
|
||||
// });
|
||||
// this.calendar.render();
|
||||
// calendar.render();
|
||||
}
|
||||
|
||||
// Add custom controller actions here
|
||||
// fooBar() { this.fooTarget.classList.toggle(this.bazClass) }
|
||||
|
||||
disconnect() {
|
||||
// Called anytime its element is disconnected from the DOM
|
||||
// (on page change, when it's removed from or moved in the DOM, etc.)
|
||||
|
||||
// Here you should remove all event listeners added in "connect()"
|
||||
// this.fooTarget.removeEventListener('click', this._fooBar)
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
:root {
|
||||
--fc-border-color: #a65b27;
|
||||
}
|
||||
|
||||
/* Prevent scrolling while dialog is open */
|
||||
body:has(dialog[data-dialog-target="dialog"][open]) {
|
||||
overflow: hidden;
|
||||
@@ -137,7 +141,7 @@ dialog[data-dialog-target="dialog"][closing] {
|
||||
|
||||
#search .ts-dropdown {
|
||||
background: unset;
|
||||
@apply bg-orange-500/80 backdrop-filter backdrop-blur-md text-white border border-orange-500 rounded-md
|
||||
@apply bg-orange-500/80 backdrop-filter backdrop-blur-md text-white border border-orange-500 rounded-md z-20
|
||||
}
|
||||
|
||||
#search .ts-dropdown .ts-dropdown-content .option.active {
|
||||
@@ -193,3 +197,7 @@ dialog[data-dialog-target="dialog"][closing] {
|
||||
.filter-label {
|
||||
@apply flex flex-col gap-1 justify-between;
|
||||
}
|
||||
|
||||
.fc-col-header-cell {
|
||||
@apply bg-orange-500/60 text-white;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
"symfony/mailer": "7.3.*",
|
||||
"symfony/mercure-bundle": "^0.3.9",
|
||||
"symfony/messenger": "7.3.*",
|
||||
"symfony/notifier": "7.3.*",
|
||||
"symfony/ntfy-notifier": "7.3.*",
|
||||
"symfony/runtime": "7.3.*",
|
||||
"symfony/scheduler": "7.3.*",
|
||||
"symfony/security-bundle": "7.3.*",
|
||||
|
||||
148
composer.lock
generated
148
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f4953f7b233a466d94269f35096f3385",
|
||||
"content-hash": "6f57ba35ae317ec6370836bda0012db8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "1tomany/rich-bundle",
|
||||
@@ -7578,6 +7578,152 @@
|
||||
],
|
||||
"time": "2025-02-19T08:51:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/notifier",
|
||||
"version": "v7.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/notifier.git",
|
||||
"reference": "9e68a3266c8b0381f8756022b1c1ba3c0264416e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/notifier/zipball/9e68a3266c8b0381f8756022b1c1ba3c0264416e",
|
||||
"reference": "9e68a3266c8b0381f8756022b1c1ba3c0264416e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"psr/log": "^1|^2|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/event-dispatcher": "<6.4",
|
||||
"symfony/event-dispatcher-contracts": "<2.5",
|
||||
"symfony/http-client-contracts": "<2.5",
|
||||
"symfony/http-kernel": "<6.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/event-dispatcher-contracts": "^2.5|^3",
|
||||
"symfony/http-client-contracts": "^2.5|^3",
|
||||
"symfony/http-foundation": "^6.4|^7.0",
|
||||
"symfony/messenger": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Notifier\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Sends notifications via one or more channels (email, SMS, ...)",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"notification",
|
||||
"notifier"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/notifier/tree/v7.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-05-01T12:12:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/ntfy-notifier",
|
||||
"version": "v7.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/ntfy-notifier.git",
|
||||
"reference": "094154ba36eac54078a71076effe46feaec59036"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/ntfy-notifier/zipball/094154ba36eac54078a71076effe46feaec59036",
|
||||
"reference": "094154ba36eac54078a71076effe46feaec59036",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/clock": "^6.4|^7.0",
|
||||
"symfony/http-client": "^6.4|^7.0",
|
||||
"symfony/notifier": "^7.3"
|
||||
},
|
||||
"type": "symfony-notifier-bridge",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Notifier\\Bridge\\Ntfy\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mickael Perraud",
|
||||
"email": "mikaelkael.fr@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Ntfy Notifier Bridge",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"Ntfy",
|
||||
"notifier"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/ntfy-notifier/tree/v7.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-13T10:27:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v7.3.0",
|
||||
|
||||
13
config/packages/notifier.yaml
Normal file
13
config/packages/notifier.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
framework:
|
||||
notifier:
|
||||
chatter_transports:
|
||||
texter_transports:
|
||||
ntfy: '%notification.ntfy.dsn%'
|
||||
channel_policy:
|
||||
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
||||
urgent: ['email']
|
||||
high: ['email']
|
||||
medium: ['email']
|
||||
low: ['email']
|
||||
admin_recipients:
|
||||
- { email: admin@example.com }
|
||||
@@ -44,6 +44,10 @@ parameters:
|
||||
auth.oidc.client_secret: '%env(OIDC_CLIENT_SECRET)%'
|
||||
auth.oidc.bypass_form_login: '%env(bool:OIDC_BYPASS_FORM_LOGIN)%'
|
||||
|
||||
# Notifications
|
||||
notification.transport: '%env(NOTIFICATION_TRANSPORT)%'
|
||||
notification.ntfy.dsn: '%env(NTFY_DSN)%'
|
||||
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
|
||||
@@ -6,7 +6,6 @@ services:
|
||||
environment:
|
||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||
tty: true
|
||||
deploy:
|
||||
replicas: 2
|
||||
volumes:
|
||||
@@ -16,6 +15,10 @@ services:
|
||||
- mercure_config:/config
|
||||
depends_on:
|
||||
- database
|
||||
logging:
|
||||
driver: "gelf"
|
||||
options:
|
||||
gelf-address: "tcp://192.168.1.197:12202"
|
||||
|
||||
|
||||
worker:
|
||||
@@ -29,6 +32,10 @@ services:
|
||||
replicas: 2
|
||||
depends_on:
|
||||
- app
|
||||
logging:
|
||||
driver: "gelf"
|
||||
options:
|
||||
gelf-address: "tcp://192.168.1.197:12203"
|
||||
|
||||
|
||||
scheduler:
|
||||
@@ -40,6 +47,11 @@ services:
|
||||
command: -vv
|
||||
depends_on:
|
||||
- app
|
||||
logging:
|
||||
driver: "gelf"
|
||||
options:
|
||||
gelf-address: "tcp://192.168.1.197:12204"
|
||||
|
||||
|
||||
|
||||
redis:
|
||||
|
||||
35
migrations/Version20250823173128.php
Normal file
35
migrations/Version20250823173128.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 Version20250823173128 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 monitor ADD air_date DATETIME 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 air_date
|
||||
SQL);
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,12 @@ final class ConfigResolver
|
||||
|
||||
#[Autowire(param: 'auth.oidc.bypass_form_login')]
|
||||
private ?bool $authOidcBypassFormLogin = null,
|
||||
|
||||
#[Autowire(param: 'notification.transport')]
|
||||
private ?string $notificationTransport = null,
|
||||
|
||||
#[Autowire(param: 'notification.ntfy.dsn')]
|
||||
private ?string $notificationNtfyDsn = null,
|
||||
) {}
|
||||
|
||||
public function validate(): bool
|
||||
@@ -54,6 +60,12 @@ final class ConfigResolver
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if (null !== $this->notificationTransport) {
|
||||
if (null === $this->notificationNtfyDsn || "" === $this->notificationNtfyDsn) {
|
||||
$this->messages[] = "Your NOTIFICATION_TRANSPORT is set to 'ntfy' but you don't have the NTFY_DSN environment variable set.";
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,9 +53,6 @@ final class IndexController extends AbstractController
|
||||
#[Route('/test')]
|
||||
public function monitorTvShow(): Response
|
||||
{
|
||||
$this->monitorTvShowHandler->handle(new MonitorTvShowCommand(96));
|
||||
return $this->json([
|
||||
'Success' => 'Monitor added'
|
||||
]);
|
||||
return $this->render('index/test.html.twig', []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,33 +2,53 @@
|
||||
|
||||
namespace App\Base\Service;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
use Symfony\Component\Mercure\Update;
|
||||
use Symfony\Component\Notifier\Notification\Notification;
|
||||
use Symfony\Component\Notifier\NotifierInterface;
|
||||
use Twig\Environment;
|
||||
|
||||
readonly class Broadcaster
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(param: 'notification.transport')]
|
||||
private string $notificationTransport,
|
||||
#[Autowire(service: 'twig')]
|
||||
private Environment $renderer,
|
||||
private HubInterface $hub,
|
||||
private RequestStack $requestStack,
|
||||
private NotifierInterface $notifier,
|
||||
private LoggerInterface $logger,
|
||||
) {}
|
||||
|
||||
public function alert(string $title, string $message, string $type = "success"): void
|
||||
public function alert(string $title, string $message, string $type = "success", bool $sendPush = false): void
|
||||
{
|
||||
$userAlertTopic = $this->requestStack->getCurrentRequest()->getSession()->get('mercure_alert_topic');
|
||||
$update = new Update(
|
||||
$userAlertTopic,
|
||||
$this->renderer->render('broadcast/Alert.stream.html.twig', [
|
||||
'alert_id' => uniqid(),
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => $type,
|
||||
])
|
||||
);
|
||||
$this->hub->publish($update);
|
||||
try {
|
||||
$userAlertTopic = $this->requestStack->getCurrentRequest()->getSession()->get('mercure_alert_topic');
|
||||
$update = new Update(
|
||||
$userAlertTopic,
|
||||
$this->renderer->render('broadcast/Alert.stream.html.twig', [
|
||||
'alert_id' => uniqid(),
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => $type,
|
||||
])
|
||||
);
|
||||
$this->hub->publish($update);
|
||||
} catch (\Throwable $exception) {
|
||||
// ToDo: look for better handling to get message to end user
|
||||
}
|
||||
|
||||
if (true === $sendPush && in_array($this->notificationTransport, ['ntfy'])) {
|
||||
try {
|
||||
$notification = new Notification($title, ['push'])->content($message);
|
||||
$this->notifier->send($notification);
|
||||
} catch (\Throwable $exception) {
|
||||
$this->logger->error('Unable to send push notification: ' . $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Download\Downloader;
|
||||
|
||||
use App\Base\Service\Broadcaster;
|
||||
use App\Base\Service\MediaFiles;
|
||||
use App\Download\Framework\Entity\Download;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -19,6 +20,7 @@ class ProcessDownloader implements DownloaderInterface
|
||||
private EntityManagerInterface $entityManager,
|
||||
private MediaFiles $mediaFiles,
|
||||
private CacheInterface $cache,
|
||||
private readonly Broadcaster $broadcaster,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -82,6 +84,7 @@ class ProcessDownloader implements DownloaderInterface
|
||||
});
|
||||
if ($downloadEntity->getStatus() !== 'Paused') {
|
||||
$downloadEntity->setProgress(100);
|
||||
$this->alertComplete($downloadEntity);
|
||||
}
|
||||
} catch (ProcessFailedException $exception) {
|
||||
$downloadEntity->setStatus('Failed');
|
||||
@@ -105,4 +108,15 @@ class ProcessDownloader implements DownloaderInterface
|
||||
|
||||
throw new \Exception("There is no download path for media type: $mediaType");
|
||||
}
|
||||
|
||||
private function alertComplete(Download $download): void
|
||||
{
|
||||
if ("tvshows" === $download->getMediaType()) {
|
||||
$message = '"' . $download->getTitle() . '" - ' . $download->getEpisodeId() . ' has finished downloading.';
|
||||
} else {
|
||||
$message = '"' . $download->getTitle() . '" has finished downloading.';
|
||||
}
|
||||
|
||||
$this->broadcaster->alert('Success', $message, sendPush: true);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ namespace App\Monitor\Action\Handler;
|
||||
use App\Base\Util\EpisodeId;
|
||||
use App\Download\Action\Command\DownloadMediaCommand;
|
||||
use App\Download\DownloadOptionEvaluator;
|
||||
use App\Download\Framework\Entity\Download;
|
||||
use App\Download\Framework\Repository\DownloadRepository;
|
||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||
use App\Monitor\Action\Result\MonitorTvEpisodeResult;
|
||||
@@ -44,6 +43,11 @@ readonly class MonitorTvEpisodeHandler implements HandlerInterface
|
||||
$this->logger->info('> [MonitorTvEpisodeHandler] Executing MonitorTvEpisodeHandler for ' . $monitor->getTitle() . ' season ' . $monitor->getSeason() . ' episode ' . $monitor->getEpisode());
|
||||
|
||||
$episodeData = $this->tmdb->episodeDetails($monitor->getTmdbId(), $monitor->getSeason(), $monitor->getEpisode());
|
||||
|
||||
if (null === $monitor->getAirDate() && null !== $episodeData->episodeAirDate && "" !== $episodeData->episodeAirDate) {
|
||||
$monitor->setAirDate(Carbon::parse($episodeData->episodeAirDate));
|
||||
}
|
||||
|
||||
if (Carbon::createFromTimestamp($episodeData->episodeAirDate) > Carbon::today('UTC')) {
|
||||
$this->logger->info('> [MonitorTvEpisodeHandler] ...Episode has not aired yet, skipping for now');
|
||||
return new MonitorTvEpisodeResult(
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Monitor\Framework\Entity\Monitor;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Tmdb\Tmdb;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonImmutable;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Base\Util\PTN;
|
||||
@@ -96,6 +97,7 @@ readonly class MonitorTvShowHandler implements HandlerInterface
|
||||
->setMonitorType('tvepisode')
|
||||
->setSeason($episode['season_number'])
|
||||
->setEpisode($episode['episode_number'])
|
||||
->setAirDate($episode['air_date'] !== null && $episode['air_date'] !== "" ? Carbon::parse($episode['air_date']) : null)
|
||||
->setCreatedAt(new DateTimeImmutable())
|
||||
->setSearchCount(0)
|
||||
->setStatus('New');
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Monitor\Framework\Controller;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\Base\Service\Broadcaster;
|
||||
use App\Monitor\Action\Handler\AddMonitorHandler;
|
||||
use App\Monitor\Action\Handler\DeleteMonitorHandler;
|
||||
use App\Monitor\Action\Input\AddMonitorInput;
|
||||
use App\Monitor\Action\Input\DeleteMonitorInput;
|
||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||
use App\Monitor\Framework\Scheduler\MonitorDispatcher;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -65,4 +67,25 @@ class ApiController extends AbstractController
|
||||
'message' => 'Manually dispatched MonitorDispatcher'
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/monitor/upcoming-episodes', name: 'api.monitor.upcoming-episodes', methods: ['GET'])]
|
||||
public function upcomingEpisodes(MonitorRepository $repository): Response
|
||||
{
|
||||
$monitors = $repository->whereAirDateNotNull();
|
||||
$monitors = Map::from($monitors)->map(function ($monitor) {
|
||||
return [
|
||||
'id' => $monitor->getId(),
|
||||
'title' => $monitor->getTitle() . ' (S' . str_pad($monitor->getSeason(), 2, '0', STR_PAD_LEFT) . 'E' . str_pad($monitor->getEpisode(), 2, '0', STR_PAD_LEFT) . ')',
|
||||
'start' => $monitor->getAirDate()->format('Y-m-d H:i:s'),
|
||||
'allDay' => true
|
||||
];
|
||||
});
|
||||
|
||||
return $this->json([
|
||||
'status' => 200,
|
||||
'data' => [
|
||||
'episodes' => $monitors->toArray(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,10 @@ class WebController extends AbstractController
|
||||
{
|
||||
return $this->render('monitor/index.html.twig');
|
||||
}
|
||||
|
||||
#[Route('/monitors/upcoming-episodes', name: 'app.monitor.upcoming-episodes', methods: ['GET'])]
|
||||
public function upcomingEpisodes()
|
||||
{
|
||||
return $this->render('monitor/upcoming-episodes.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ class Monitor
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $lastSearch = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTime $airDate = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
@@ -257,6 +260,17 @@ class Monitor
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAirDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->airDate;
|
||||
}
|
||||
|
||||
public function setAirDate(?\DateTimeInterface $airDate): static
|
||||
{
|
||||
$this->airDate = $airDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeChild(self $child): static
|
||||
{
|
||||
if ($this->children->removeElement($child)) {
|
||||
|
||||
@@ -33,4 +33,12 @@ class MonitorRepository extends ServiceEntityRepository
|
||||
|
||||
return $this->paginator->paginate($query, $page, $perPage);
|
||||
}
|
||||
|
||||
public function whereAirDateNotNull()
|
||||
{
|
||||
$query = $this->createQueryBuilder('m')
|
||||
->andWhere('m.airDate IS NOT NULL')
|
||||
->getQuery();
|
||||
return $query->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,13 +286,18 @@ class Tmdb
|
||||
|
||||
private function parseTvShow(array $data, string $posterBasePath): TmdbResult
|
||||
{
|
||||
if (!in_array($data['first_air_date'], ['', null,])) {
|
||||
$airDate = (new \DateTime($data['first_air_date']))->format('Y-m-d');
|
||||
} else {
|
||||
$airDate = null;
|
||||
}
|
||||
return new TmdbResult(
|
||||
imdbId: $data['external_ids']['imdb_id'],
|
||||
tmdbId: $data['id'],
|
||||
title: $data['name'],
|
||||
poster: (null !== $data['poster_path']) ? $posterBasePath . $data['poster_path'] : null,
|
||||
description: $data['overview'],
|
||||
year: (new \DateTime($data['first_air_date']))->format('Y'),
|
||||
year: $airDate,
|
||||
mediaType: "tvshows",
|
||||
episodes: $data['episodes'],
|
||||
);
|
||||
@@ -300,6 +305,11 @@ class Tmdb
|
||||
|
||||
private function parseEpisode(array $data, string $posterBasePath): TmdbResult
|
||||
{
|
||||
if (!in_array($data['air_date'], ['', null,])) {
|
||||
$airDate = (new \DateTime($data['air_date']))->format('Y-m-d');
|
||||
} else {
|
||||
$airDate = null;
|
||||
}
|
||||
return new TmdbResult(
|
||||
imdbId: $data['external_ids']['imdb_id'],
|
||||
tmdbId: $data['id'],
|
||||
@@ -309,12 +319,17 @@ class Tmdb
|
||||
year: (new \DateTime($data['air_date']))->format('Y'),
|
||||
mediaType: "tvshows",
|
||||
episodes: null,
|
||||
episodeAirDate: (new \DateTime($data['air_date']))->format('m/d/Y'),
|
||||
episodeAirDate: $airDate,
|
||||
);
|
||||
}
|
||||
|
||||
private function parseMovie(array $data, string $posterBasePath): TmdbResult
|
||||
{
|
||||
if (!in_array($data['release_date'], ['', null,])) {
|
||||
$airDate = (new \DateTime($data['release_date']))->format('Y-m-d');
|
||||
} else {
|
||||
$airDate = null;
|
||||
}
|
||||
return new TmdbResult(
|
||||
imdbId: $data['external_ids']['imdb_id'],
|
||||
tmdbId: $data['id'],
|
||||
@@ -323,7 +338,7 @@ class Tmdb
|
||||
description: $data['overview'],
|
||||
year: (new \DateTime($data['release_date']))->format('Y'),
|
||||
mediaType: "movies",
|
||||
episodeAirDate: (new \DateTime($data['release_date']))->format('m/d/Y'),
|
||||
episodeAirDate: $airDate,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
21
symfony.lock
21
symfony.lock
@@ -232,6 +232,27 @@
|
||||
"config/packages/messenger.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/notifier": {
|
||||
"version": "7.3",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.0",
|
||||
"ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/notifier.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/ntfy-notifier": {
|
||||
"version": "7.3",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.4",
|
||||
"ref": "0d5e496659d7361bb4e6648eb8332f8cf097533d"
|
||||
}
|
||||
},
|
||||
"symfony/property-info": {
|
||||
"version": "7.3",
|
||||
"recipe": {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
{% block javascripts %}
|
||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body class="flex flex-col bg-stone-700">
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
{% if entity.status != "Complete" %}
|
||||
<turbo-stream action="update" target="download_progress_{{ id }}">
|
||||
<template>
|
||||
<div class="background text-black text-center rounded-sm text-bold bg-green-300 h-5 relative z-10"
|
||||
{% if entity.progress >= 50 %}
|
||||
{% set text_color = "text-black dark:text-black" %}
|
||||
{% else %}
|
||||
{% set text_color = "text-black dark:text-white" %}
|
||||
{% endif %}
|
||||
<div class="background {{ text_color }} text-center rounded-sm text-bold bg-green-300 h-5 relative z-10"
|
||||
style="width: {{ entity.progress }}%">
|
||||
</div>
|
||||
<div class="number text-black font-bold text-center z-40"
|
||||
<div class="number {{ text_color }} font-bold text-center z-40"
|
||||
>{{ entity.progress }}%</div>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
@@ -50,7 +55,11 @@
|
||||
|
||||
<turbo-stream action="prepend" target="alert_list">
|
||||
<template>
|
||||
<twig:Alert title="Finished downloading" message="{{ entity.title }}" alert_id="{{ entity.id }}" data-controller="alert" />
|
||||
{% if entity.mediaType == "tvshows" %}
|
||||
<twig:Alert title="Success" message="{{ entity.title }} - ({{ entity.episodeId }}) has finished downloading." alert_id="{{ entity.id }}" data-controller="alert" />
|
||||
{% else %}
|
||||
<twig:Alert title="Success" message="{{ entity.title }} has finished downloading." alert_id="{{ entity.id }}" data-controller="alert" />
|
||||
{% endif %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
<svg class="shrink-0 w-4 h-4 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
||||
</svg>
|
||||
<span class="sr-only">Info</span>
|
||||
|
||||
<h3 class="text-lg font-medium font-bold">{{ title|default('') }}</h3>
|
||||
|
||||
<twig:ux:icon name="ic:twotone-cancel" style="text-align:right" width="16.75px" height="16.75px" class="modal-close rounded-full align-end text-red-600 hover:text-red-700" />
|
||||
|
||||
<span class="sr-only">Info</span>
|
||||
</div>
|
||||
<div class="mt-2 text-sm w-[300px] font-bold overflow-hidden text-wrap">
|
||||
{{ message }}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<div{{ attributes }}>
|
||||
<div class="flex flex-col bg-sky-950 border-neutral-700 border-t-4 border-t-orange-500 rounded-xl
|
||||
backdrop-filter backdrop-blur-md bg-opacity-40 z-10
|
||||
">
|
||||
<div class="flex flex-col bg-sky-950/40 border-neutral-700 border-t-4 border-t-orange-500 rounded-xl">
|
||||
<div class="p-4 md:p-5">
|
||||
<h3 class="mb-4 text-lg font-bold text-white">
|
||||
{{ title }}
|
||||
</h3>
|
||||
|
||||
<div class="{{ contentClass|default('flex flex-col overflow-hidden rounded-md') }}">
|
||||
<div class="{{ contentClass|default('flex flex-col rounded-md') }}">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,45 +7,45 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<table id="downloads" class="divide-y divide-gray-200 bg-gray-50 overflow-hidden rounded-lg table-auto w-full" {{ turbo_stream_listen('App\\Download\\Framework\\Entity\\Download') }}>
|
||||
<table id="downloads" class="divide-y divide-gray-200 dark:divide-gray-800 bg-gray-50 overflow-hidden rounded-lg table-auto w-full" {{ turbo_stream_listen('App\\Download\\Framework\\Entity\\Download') }}>
|
||||
<thead>
|
||||
<tr class="bg-orange-500 bg-filter bg-blur-lg bg-opacity-80 text-gray-950">
|
||||
<tr class="bg-orange-500/80 text-gray-800 dark:text-stone-800 text-xs font-medium uppercase">
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium text-stone-500 uppercase dark:text-stone-800 truncate">
|
||||
class="px-6 py-3 truncate text-start">
|
||||
Title
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium text-stone-500 uppercase dark:text-stone-800 truncate {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
class="px-6 py-3 truncate text-start {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
Filename
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium text-stone-500 uppercase dark:text-stone-800 truncate {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
class="px-6 py-3 truncate text-start {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
Media type
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-stone-800">
|
||||
class="px-6 py-3 text-start">
|
||||
Progress
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-stone-800">
|
||||
class="px-6 py-3 text-start">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="{{ table_body_id }}" class="divide-y divide-gray-200 dark:divide-gray-50" data-download-list-target="download">
|
||||
<tbody id="{{ table_body_id }}" class="dark:text-white divide-y divide-gray-200 dark:divide-gray-900" data-download-list-target="download">
|
||||
{% if this.downloads.items|length > 0 %}
|
||||
{% for download in this.downloads.items %}
|
||||
<twig:DownloadListRow download="{{ download }}" isWidget="{{ isWidget }}" />
|
||||
{% endfor %}
|
||||
{% if this.isWidget == true and this.downloads.items|length > this.perPage %}
|
||||
<tr id="download_view_all">
|
||||
<td class="py-2 whitespace-nowrap bg-orange-300 uppercase text-xs font-medium text-center text-black truncate" colspan="100%">
|
||||
<td class="py-2 whitespace-nowrap bg-orange-500/80 uppercase text-xs font-medium text-center truncate dark:text-black" colspan="100%">
|
||||
<a href="{{ path('app_downloads') }}">View All Downloads</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr id="{{ table_body_id }}_no_downloads">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center font-medium text-gray-800 dark:text-stone-800" colspan="100%">
|
||||
<tr id="{{ table_body_id }}_no_downloads" class="text-black dark:text-white dark:bg-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center font-medium" colspan="100%">
|
||||
No downloads
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<tr{{ attributes }} is="download-list-row" class="hover:bg-gray-200" id="ad_download_{{ download.id }}" data-title="{{ download.title }}"
|
||||
<tr{{ attributes }} is="download-list-row" class="dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-900" id="ad_download_{{ download.id }}" data-title="{{ download.title }}"
|
||||
download-id="{{ download.id }}"
|
||||
imdb-id="{{ download.imdbId }}"
|
||||
media-title="{{ download.title }}"
|
||||
@@ -12,7 +12,7 @@
|
||||
updated-at="{{ download.updatedAt|date('m/d/Y g:i a') }}"
|
||||
data-filename="{{ download.filename }}" data-media-type="{{ download.mediaType }}" data-status="{{ download.status }}" data-progress="{{ download.progress }}"
|
||||
>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium truncate">
|
||||
{% if download.mediaType == "movies" %}
|
||||
{% set routeParams = {imdbId: download.imdbId, mediaType: download.mediaType} %}
|
||||
{% set route = path('app_search_result', routeParams) %}
|
||||
@@ -31,11 +31,11 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 max-w-[60ch] {{ isWidget == true ? "hidden" : "r-tablecell" }} truncate">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium max-w-[60ch] {{ isWidget == true ? "hidden" : "r-tablecell" }} truncate">
|
||||
{{ download.filename }}
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium truncate {{ isWidget == true ? "hidden" : "r-tablecell" }}">
|
||||
{{ download.mediaType }}
|
||||
</td>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<div class="background text-black text-center rounded-sm text-bold bg-green-300 h-5 relative z-10"
|
||||
style="width: {{ download.progress }}%">
|
||||
</div>
|
||||
<div class="number text-black font-bold text-center z-40"
|
||||
<div class="number text-black dark:text-white font-bold text-center z-40"
|
||||
>{{ download.progress }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,57 +4,57 @@
|
||||
<twig:DownloadSearch search_path="app_search" placeholder="Find {{ type == "complete" ? "a" : "an" }} {{ type }} monitor..." />
|
||||
</div>
|
||||
{% endif %}
|
||||
<table id="monitor_list" class="divide-y divide-gray-200 bg-gray-50 overflow-hidden rounded-lg table-auto w-full" {{ turbo_stream_listen('App\\Monitor\\Framework\\Entity\\Monitor') }}
|
||||
<table id="monitor_list" class="divide-y divide-gray-200 dark:divide-gray-800 bg-gray-50 overflow-hidden rounded-lg table-auto w-full" {{ turbo_stream_listen('App\\Monitor\\Framework\\Entity\\Monitor') }}
|
||||
{{ stimulus_target('monitor_list', 'monitorList') }}
|
||||
>
|
||||
<thead>
|
||||
<tr class="bg-orange-500 bg-filter bg-blur-lg bg-opacity-80 text-gray-950">
|
||||
<tr class="bg-orange-500/80 text-gray-800 dark:text-stone-800 text-xs font-medium uppercase">
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium uppercase truncate">
|
||||
class="px-6 py-3 text-start truncate">
|
||||
Title
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="px-6 py-3 text-start">
|
||||
ID
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="hidden md:table-cell px-6 py-3 text-start">
|
||||
Search Count
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="hidden md:table-cell px-6 py-3 text-start">
|
||||
Created at
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="hidden md:table-cell px-6 py-3 text-start">
|
||||
Last Search Date
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="hidden md:table-cell px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="hidden md:table-cell px-6 py-3 text-start">
|
||||
Type
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-start text-xs font-medium uppercase">
|
||||
class="px-6 py-3 text-start">
|
||||
Status
|
||||
</th>
|
||||
<th class="hidden md:table-cell"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="monitors" class="divide-y divide-gray-50">
|
||||
<tbody id="monitors" class="dark:text-white divide-y divide-gray-200 dark:divide-gray-900">
|
||||
{% if this.monitors.items|length > 0 %}
|
||||
{% for monitor in this.monitors.items %}
|
||||
<twig:MonitorListRow :monitor="monitor" isWidget="{{ this.isWidget }}" />
|
||||
{% endfor %}
|
||||
{% if this.isWidget and this.monitors.items|length > 5 %}
|
||||
<tr id="monitor_view_all">
|
||||
<td colspan="100%" class="py-2 whitespace-nowrap bg-orange-300 uppercase text-xs font-medium text-center text-black min-w-[50ch] max-w-[50ch] truncate">
|
||||
<td colspan="100%" class="py-2 whitespace-nowrap bg-gray-400 dark:bg-gray-700 uppercase text-xs font-medium text-center text-black dark:text-white min-w-[50ch] max-w-[50ch] truncate">
|
||||
<a href="{{ path('app_monitors') }}">View All Monitors</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr id="active_monitors_no_monitors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-xs uppercase text-center col-span-2 font-medium text-stone-800" colspan="100%">
|
||||
<td class="px-6 py-4 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-900 text-center text-xs uppercase font-medium" colspan="100%">
|
||||
No monitors
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<tr{{ attributes }} is="monitor-list-row" id="monitor_{{ monitor.id }}" class="hover:bg-gray-200"
|
||||
<tr{{ attributes }} is="monitor-list-row" id="monitor_{{ monitor.id }}" class="dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-900"
|
||||
monitor-id="{{ monitor.id }}"
|
||||
imdb-id="{{ monitor.imdbId }}"
|
||||
media-title="{{ monitor.title }}"
|
||||
@@ -26,24 +26,24 @@
|
||||
{% set route = path('app_search_result', routeParams) ~ "#" ~ episode_anchor(episodeIdDto.season, episodeIdDto.episode) %}
|
||||
{% endif %}
|
||||
<a href="{{ route }}"
|
||||
class="mr-1 hover:underline rounded-md max-w-[10ch] md:max-w-[unset] truncate">
|
||||
class="mr-1 hover:underline rounded-md max-w-[10ch] md:max-w-[unset] truncate dark:text-white">
|
||||
{{ monitor.title }}
|
||||
</a>
|
||||
</a>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
||||
{{ monitor|monitor_media_id }}
|
||||
</td>
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm">
|
||||
{{ monitor.searchCount }}
|
||||
</td>
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm">
|
||||
{{ monitor.createdAt|date('m/d/Y h:i a') }}
|
||||
</td>
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm">
|
||||
{{ monitor.lastSearch|date('m/d/Y h:i a') }}
|
||||
</td>
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="hidden md:table-cell px-6 py-4 whitespace-nowrap text-sm">
|
||||
{% if monitor.monitorType == "tvshow" %}
|
||||
<twig:StatusBadge color="blue" number="300" text="black" status="{{ monitor.monitorType|monitor_type }}" />
|
||||
{% elseif monitor.monitorType == "tvseason" %}
|
||||
@@ -52,7 +52,7 @@
|
||||
<twig:StatusBadge color="fuchsia" number="300" text="black" status="{{ monitor.monitorType|monitor_type }}" />
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
||||
{% if monitor.status == "New" %}
|
||||
<twig:StatusBadge color="orange" status="{{ monitor.status }}" />
|
||||
{% elseif monitor.status == "In Progress" or monitor.status == "Active" %}
|
||||
@@ -72,11 +72,11 @@
|
||||
{{ monitor.title }}
|
||||
</td>
|
||||
{% if monitor|monitor_media_id != "-" %}
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
||||
{{ monitor|monitor_media_id }}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
||||
{% if monitor.monitorType == "tvshow" %}
|
||||
<twig:StatusBadge color="blue" number="300" text="black" status="{{ monitor.monitorType|monitor_type }}" />
|
||||
{% elseif monitor.monitorType == "tvseason" %}
|
||||
@@ -85,7 +85,7 @@
|
||||
<twig:StatusBadge color="fuchsia" number="300" text="black" status="{{ monitor.monitorType|monitor_type }}" />
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
||||
{% if monitor.status == "New" %}
|
||||
<twig:StatusBadge color="orange" status="{{ monitor.status }}" />
|
||||
{% elseif monitor.status == "In Progress" or monitor.status == "Active" %}
|
||||
|
||||
9
templates/index/test.html.twig
Normal file
9
templates/index/test.html.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block h2 %}Test Test{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div>
|
||||
<!-- Well what are you doing here? -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -4,6 +4,10 @@
|
||||
{% block h2 %}Monitors{% endblock %}
|
||||
|
||||
{% block action_buttons %}
|
||||
<a href="{{ path('app.monitor.upcoming-episodes') }}" data-turbo="false"
|
||||
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
||||
Upcoming Episodes
|
||||
</a>
|
||||
<twig:ActionButton action="monitorDispatch" text="Run Monitors" />
|
||||
{% endblock %}
|
||||
|
||||
|
||||
37
templates/monitor/upcoming-episodes.html.twig
Normal file
37
templates/monitor/upcoming-episodes.html.twig
Normal file
@@ -0,0 +1,37 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block h2 %}Upcoming Episodes{% endblock %}
|
||||
|
||||
{% block action_buttons %}
|
||||
<a href="{{ path('app.monitor.upcoming-episodes') }}"
|
||||
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
||||
Upcoming Episodes
|
||||
</a>
|
||||
<twig:ActionButton action="monitorDispatch" text="Run Monitors" />
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{{ turbo_page_requires_reload() }}
|
||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
||||
|
||||
<div class="p-4">
|
||||
<twig:Card title="Upcoming episodes of shows your monitoring">
|
||||
<div id="calendar" class="text-white">
|
||||
</div>
|
||||
</twig:Card>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
let data = await fetch('/api/monitor/upcoming-episodes');
|
||||
data = (await data.json())['data'];
|
||||
|
||||
const calendarEl = document.getElementById('calendar');
|
||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
initialView: 'dayGridMonth',
|
||||
events: data['episodes'],
|
||||
});
|
||||
calendar.render();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user